GithubHelp home page GithubHelp logo

mrrsayarr / gemini-pro-using-with-python Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 78 KB

Used gemini pro with simple Python GUI project - Basit Python GUI arayüzü ile Google Gemini Pro kullanımı

Python 100.00%
bard bard-ai bard-api gemini-api gemini-pro

gemini-pro-using-with-python's Introduction

# Make Application

$ pyinstaller.exe --onefile --noconsole  .\Chatbox\ChatboX.py
# Make Application with ico

$ pyinstaller.exe --onefile --noconsole --icon=gemini.ico .\Chatbox\Chatbox.py
$ pip install google-generativeai
import google.generativeai as genai

#API key (replace with your actual API key)
genai.configure(api_key="YOUR_API_KEY")

# Model setup
generation_config = {
    "temperature": 1,
    "top_p": 1,
    "top_k": 1,
    "max_output_tokens": 4096,
}

safety_settings = [
  {
    "category": "HARM_CATEGORY_HARASSMENT",
    "threshold": "BLOCK_ONLY_HIGH" #BLOCK_NEVER
  },
  {
    "category": "HARM_CATEGORY_HATE_SPEECH",
    "threshold": "BLOCK_ONLY_HIGH"
  },
  {
    "category": "HARM_CATEGORY_SEXUALLY_EXPLICIT",
    "threshold": "BLOCK_ONLY_HIGH"
  },
  {
    "category": "HARM_CATEGORY_DANGEROUS_CONTENT",
    "threshold": "BLOCK_ONLY_HIGH"
  },
]

model = genai.GenerativeModel(model_name="gemini-pro",
                              generation_config=generation_config,
                              safety_settings=safety_settings)

ENG

  • Get an API Key

  • Create a Google Cloud Platform account.

  • Create a project.

  • Under the APIs & Services tab, select APIs & services.

  • Click the New button and select Add API & service.

  • On the Add API & service page, select Google AI and then select Gemini Pro.

  • After selecting Gemini Pro, click the Add button.

  • After the Gemini Pro API is added, select APIs & services under the APIs & Services page.

  • Under the APIs & services page, select Gemini Pro and then select API Keys.

  • On the API Keys page, click the Create New API Key button.

  • On the Create New API Key page, select Read & write for API Key Type and then click the Create button.

  • After the API Key is created, click the Show API Key button on the API Key page.

  • On the API Key page, copy the API Key value.

  • Using Your API Key in Your Code

  • Import the "google.generativeai" module.

  • When calling the "generate_content()" function, pass your API Key to the api_key parameter.

TR

  • API Key'i Alma

  • Google Cloud Platform'da bir hesap oluşturun.

  • Bir proje oluşturun.

  • API ve Hizmetler sekmesinde API'ler ve hizmetler'i seçin.

  • Yeni düğmesini tıklayın ve API ve hizmet ekle'yi seçin.

  • API'ler ve hizmetler ekle sayfasında, Google AI'yı seçin ve ardından Gemini Pro'yu seçin.

  • Gemini Pro'yu seçtikten sonra, Ekle düğmesini tıklayın.

  • Gemini Pro API'si eklendikten sonra, API ve Hizmetler sayfasında API'ler ve hizmetler'i seçin.

  • API'ler ve hizmetler sayfasında, Gemini Pro'yu seçin ve ardından API Anahtarları'nı seçin.

  • API Anahtarları sayfasında, Yeni API Anahtarı Oluştur düğmesini tıklayın.

  • Yeni API Anahtarı Oluştur sayfasında, API Anahtarı Türü için Okuma ve yazma'yı seçin ve ardından Oluştur düğmesini tıklayın.

  • API Anahtarı oluşturulduktan sonra, API Anahtarı sayfasında API Anahtarını Göster düğmesini tıklayın.

  • API Anahtarı sayfasında, API Anahtarı değerini kopyalayın.

  • Kodunuzda API Key'i Kullanma

  • "google.generativeai" modülünü içe aktarın.

  • "generate_content()" işlevini çağırırken api_key parametresine API Key'inizi geçirin.

V1.0

example_chatbox

V1.1

image

  • Red text canceled

V1.2

image

V1.3

image

image

  • Automatically saves Response text

gemini-pro-using-with-python's People

Contributors

mrrsayarr avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.