Git Product home page Git Product logo

gemini's Introduction

FREE Reverse Engineering Self-Study Course HERE


Gemini

Google Gemini AI model w/speech recognition and voice.


Obtain API Key

HERE

Setup: Linux/MAC

Add API Environment Variable GOOGLE_GEMINI_API_KEY HERE

Install ffmpeg HERE

python3 -m venv venv
.\venv\Scripts\activate
pip install -r requirements.txt

Setup: Windows

Add API Environment Variable GOOGLE_GEMINI_API_KEY

export GOOGLE_GEMINI_API_KEY="<YOUR_GOOGLE_GEMINI_API_KEY>"

Install ffmpeg HERE

python3 -m venv venv
source venv/bin/active
pip install -r requirements.txt

Usage:

python gemini.py

gemini.py

import os
import subprocess
import pathlib
import textwrap
import google.generativeai as genai
from IPython.display import display, Markdown
from gtts import gTTS
import speech_recognition as sr

GOOGLE_GEMINI_API_KEY = os.environ['GOOGLE_GEMINI_API_KEY']
genai.configure(api_key=GOOGLE_GEMINI_API_KEY)
model = genai.GenerativeModel('gemini-pro')

while True:
	r = sr.Recognizer()
	mic = sr.Microphone()
	with mic as source:
		print("Speak now to Gemini...")
		audio = r.listen(source)
	text = r.recognize_google(audio)
	response = model.generate_content(text)
	speech = gTTS(response.text, lang='en')
	speech.save('output.mp3')
	process = subprocess.Popen(['ffplay', '-nodisp', '-autoexit', '-loglevel', 'quiet', 'output.mp3'],
		stdout=subprocess.DEVNULL,
		stderr=subprocess.DEVNULL)
	process.wait()

License

MIT

gemini's People

Contributors

mytechnotalent 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.