-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Pure Python audio chat app with Multimodal Live API #1551
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @freddyaboulton and reviewers,
Gemini is currently reviewing this pull request; a full review should follow in a few minutes. In the meantime, here's a quick summary to help everyone get up to speed:
This PR adds a pure-Python web application built with Gradio that enables audio input/output streaming for the multimodal API. The goal is to provide a more accessible entry point for developers who prefer Python, eliminating the need for HTML and JavaScript knowledge to get started with the multimodal API. The main changes involve creating a new app.py
file (gemini/gradio-voice/app.py) which contains a complete Gradio application for voice interaction with the Gemini API. The requirements.txt
file (gemini/gradio-voice/requirements.txt) has also been updated to include the necessary libraries: gradio_webrtc
, librosa
, and python-dotenv
.
The app.py
file implements a WebSocket connection to the Gemini API, handles audio encoding and decoding, and manages the real-time audio streaming between the user and the Gemini model. The Gradio interface provides a simple user experience for interacting with the voice chat functionality. The API key is securely handled via a password-protected textbox.
If there's anything unclear or missing from this summary, please let me know. I'll provide a more detailed review shortly.
And now, a little haiku to lighten the mood:
Python's gentle grace,
Streams of audio, flowing free,
Gemini speaks back.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This pull request introduces a Python-based Gradio web application that facilitates real-time voice chat with Gemini. This is a great addition, as it allows developers to interact with Gemini using a familiar language and a user-friendly interface. The code is generally well-structured, but there are some areas where improvements can be made to enhance robustness, error handling, and user experience.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please also resolve spelling errors and respond to Gemini review comments. Deferring to Zack/Katie for further review
Thank you @holtskinner ! I will address the Gemini comments today/tomorrow. I think there is something wrong with the spellcheck as |
Hi @freddyaboulton, Regarding your question about the spellcheck flagging |
Hi @holtskinner @katiemn @ZackAkil - I switched the demo to use |
@freddyaboulton Thanks for making the adjustments! Can you please resolve the linter errors? https://github.com/GoogleCloudPlatform/generative-ai/actions/runs/12584981682/job/35075770729?pr=1551 |
Hi @holtskinner ! Thanks for the patience over the holidays. I've updated the demo based on your suggestions and fixed the lint! |
Hi @holtskinner ! Thanks for adding the dropdowns for region and voice! I moved the directory and added a README as well as addressing the other comments. |
Description
The
multimodal-live-app
requires knowledge of html and js.Adding a pure-python webapp built with Gradio that supports audio input/output streaming will help developers get started building with the multimodal api without leaving their preferred language.
CONTRIBUTING
Guide.CODEOWNERS
for the file(s).nox -s format
from the repository root to format).