Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Upload folder using huggingface_hub
Browse files- README.md +2 -6
- app.py +3 -6
- requirements.txt +1 -1
README.md
CHANGED
|
@@ -4,16 +4,12 @@ emoji: ♊️
|
|
| 4 |
colorFrom: purple
|
| 5 |
colorTo: red
|
| 6 |
sdk: gradio
|
| 7 |
-
sdk_version: 5.
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
license: mit
|
| 11 |
short_description: Gemini understands audio and video!
|
| 12 |
-
tags:
|
| 13 |
-
- webrtc
|
| 14 |
-
- websocket
|
| 15 |
-
- gradio
|
| 16 |
-
- secret|HF_TOKEN secret|GEMINI_API_KEY
|
| 17 |
---
|
| 18 |
|
| 19 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
| 4 |
colorFrom: purple
|
| 5 |
colorTo: red
|
| 6 |
sdk: gradio
|
| 7 |
+
sdk_version: 5.16.0
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
license: mit
|
| 11 |
short_description: Gemini understands audio and video!
|
| 12 |
+
tags: [webrtc, websocket, gradio, secret|HF_TOKEN secret|GEMINI_API_KEY]
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
---
|
| 14 |
|
| 15 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
app.py
CHANGED
|
@@ -12,7 +12,7 @@ from fastrtc import (
|
|
| 12 |
AsyncAudioVideoStreamHandler,
|
| 13 |
Stream,
|
| 14 |
WebRTC,
|
| 15 |
-
|
| 16 |
wait_for_item,
|
| 17 |
)
|
| 18 |
from google import genai
|
|
@@ -66,7 +66,6 @@ class GeminiHandler(AsyncAudioVideoStreamHandler):
|
|
| 66 |
model="gemini-2.0-flash-exp", config=config
|
| 67 |
) as session:
|
| 68 |
self.session = session
|
| 69 |
-
print("set session")
|
| 70 |
while not self.quit.is_set():
|
| 71 |
turn = self.session.receive()
|
| 72 |
try:
|
|
@@ -120,7 +119,7 @@ stream = Stream(
|
|
| 120 |
handler=GeminiHandler(),
|
| 121 |
modality="audio-video",
|
| 122 |
mode="send-receive",
|
| 123 |
-
rtc_configuration=
|
| 124 |
time_limit=90 if get_space() else None,
|
| 125 |
additional_inputs=[
|
| 126 |
gr.Image(label="Image", type="numpy", sources=["upload", "clipboard"])
|
|
@@ -160,9 +159,7 @@ with gr.Blocks(css=css) as demo:
|
|
| 160 |
modality="audio-video",
|
| 161 |
mode="send-receive",
|
| 162 |
elem_id="video-source",
|
| 163 |
-
rtc_configuration=
|
| 164 |
-
if get_space() == "spaces"
|
| 165 |
-
else None,
|
| 166 |
icon="https://www.gstatic.com/lamda/images/gemini_favicon_f069958c85030456e93de685481c559f160ea06b.png",
|
| 167 |
pulse_color="rgb(255, 255, 255)",
|
| 168 |
icon_button_color="rgb(255, 255, 255)",
|
|
|
|
| 12 |
AsyncAudioVideoStreamHandler,
|
| 13 |
Stream,
|
| 14 |
WebRTC,
|
| 15 |
+
get_cloudflare_turn_credentials_async,
|
| 16 |
wait_for_item,
|
| 17 |
)
|
| 18 |
from google import genai
|
|
|
|
| 66 |
model="gemini-2.0-flash-exp", config=config
|
| 67 |
) as session:
|
| 68 |
self.session = session
|
|
|
|
| 69 |
while not self.quit.is_set():
|
| 70 |
turn = self.session.receive()
|
| 71 |
try:
|
|
|
|
| 119 |
handler=GeminiHandler(),
|
| 120 |
modality="audio-video",
|
| 121 |
mode="send-receive",
|
| 122 |
+
rtc_configuration=get_cloudflare_turn_credentials_async,
|
| 123 |
time_limit=90 if get_space() else None,
|
| 124 |
additional_inputs=[
|
| 125 |
gr.Image(label="Image", type="numpy", sources=["upload", "clipboard"])
|
|
|
|
| 159 |
modality="audio-video",
|
| 160 |
mode="send-receive",
|
| 161 |
elem_id="video-source",
|
| 162 |
+
rtc_configuration=get_cloudflare_turn_credentials_async,
|
|
|
|
|
|
|
| 163 |
icon="https://www.gstatic.com/lamda/images/gemini_favicon_f069958c85030456e93de685481c559f160ea06b.png",
|
| 164 |
pulse_color="rgb(255, 255, 255)",
|
| 165 |
icon_button_color="rgb(255, 255, 255)",
|
requirements.txt
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
fastrtc==0.0.
|
| 2 |
python-dotenv
|
| 3 |
google-genai
|
| 4 |
twilio
|
|
|
|
| 1 |
+
fastrtc==0.0.23.rc1
|
| 2 |
python-dotenv
|
| 3 |
google-genai
|
| 4 |
twilio
|