Skip to content

Latest commit

 

History

History
71 lines (44 loc) · 2.32 KB

README.md

File metadata and controls

71 lines (44 loc) · 2.32 KB

TalktoGemini

Please # for Google Developer account at https://aistudio.google.com use your gmail account.

Please get API-KEY from https://aistudio.google.com/app/apikey open an account and get an apikey. "Free for limited time"

please set up an .env file ins your code folder to place the api key

GOOGLE_API_KEY= "input your api key"

create virtual enviroment file in your code folder

https://www.youtube.com/watch?v=yG9kmBQAtW4

python -m venv ai1

source ai1/Scripts/activate ("ai1" is the name of the file you can name it to your liking) use this for git ai1/Scripts/activate " use this for vscode"

python -m venv filename

source filename/Scripts/activate for git

filename/Scripts/activate for vscode terminal

create virtual-venv file in your vscode terminal or pycharm

for mac https://www.youtube.com/watch?v=Kg1Yvry_Ydk

cd my-project/ virtualenv venv

source venv/bin/activate

pip install openai pip install datetime pip install pyttsx3 pip install SpeechRecognition pip install pyaudio pip install pygame pip install gtts pip install playsound pip isntall datetime pip install python-dotenv pip install numpy pip install pyautogen # this will have all the python repo packages.

I have set up three files to talk to Gemini and you can add more Gemini function. This core voice engine using GTTS and PYTTSX3 you can add more voice experiment.

Isntall python modules in you env.file Pip install google.generativeai Pip install speechrecognition Pip install pygame Pip install pyaudio Pip install gtts Pip install pyttsx3

Update : I have added two new files requirements.txt and main.py. requirements.txt is for all python repo you will to install in venv to run application. run this file in venv: pip install -r requiremnets.txt main.py is Gradio chat window application html. format running "gemini-1.5-pro" model. I have my window desktop default to dark mode if you want to add dark mode to gradio please see code below.


import gradio as gr

js_func = """ function refresh() { const url = new URL(window.location);

if (url.searchParams.get('__theme') !== 'dark') {
    url.searchParams.set('__theme', 'dark');
    window.location.href = url.href;
}

} """

with gr.Blocks(js=js_func) as demo: demo.launch()

Chat with Gemini