Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -134,54 +134,6 @@ stream = Stream(
|
|
134 |
},
|
135 |
)
|
136 |
|
137 |
-
css = """
|
138 |
-
#video-source {max-width: 600px !important; max-height: 600 !important;}
|
139 |
-
"""
|
140 |
-
|
141 |
-
with gr.Blocks(css=css) as demo:
|
142 |
-
gr.HTML(
|
143 |
-
"""
|
144 |
-
<div style='display: flex; align-items: center; justify-content: center; gap: 20px'>
|
145 |
-
<div style="background-color: var(--block-background-fill); border-radius: 8px">
|
146 |
-
<img src="https://www.gstatic.com/lamda/images/gemini_favicon_f069958c85030456e93de685481c559f160ea06b.png" style="width: 100px; height: 100px;">
|
147 |
-
</div>
|
148 |
-
<div>
|
149 |
-
<h1>Gen AI SDK Voice Chat</h1>
|
150 |
-
<p>Speak with Gemini using real-time audio + video streaming</p>
|
151 |
-
<p>Powered by <a href="https://gradio.app/">Gradio</a> and <a href=https://freddyaboulton.github.io/gradio-webrtc/">WebRTC</a>⚡️</p>
|
152 |
-
<p>Get an API Key <a href="https://support.google.com/googleapi/answer/6158862?hl=en">here</a></p>
|
153 |
-
</div>
|
154 |
-
</div>
|
155 |
-
"""
|
156 |
-
)
|
157 |
-
with gr.Row() as row:
|
158 |
-
with gr.Column():
|
159 |
-
webrtc = WebRTC(
|
160 |
-
label="Video Chat",
|
161 |
-
modality="audio-video",
|
162 |
-
mode="send-receive",
|
163 |
-
elem_id="video-source",
|
164 |
-
rtc_configuration=get_cloudflare_turn_credentials_async,
|
165 |
-
icon="https://www.gstatic.com/lamda/images/gemini_favicon_f069958c85030456e93de685481c559f160ea06b.png",
|
166 |
-
pulse_color="rgb(255, 255, 255)",
|
167 |
-
icon_button_color="rgb(255, 255, 255)",
|
168 |
-
)
|
169 |
-
with gr.Column():
|
170 |
-
image_input = gr.Image(
|
171 |
-
label="Image", type="numpy", sources=["upload", "clipboard"]
|
172 |
-
)
|
173 |
-
|
174 |
-
webrtc.stream(
|
175 |
-
GeminiHandler(),
|
176 |
-
inputs=[webrtc, image_input],
|
177 |
-
outputs=[webrtc],
|
178 |
-
time_limit=180 if get_space() else None,
|
179 |
-
concurrency_limit=2 if get_space() else None,
|
180 |
-
)
|
181 |
-
|
182 |
-
stream.ui = demo
|
183 |
-
|
184 |
-
|
185 |
if __name__ == "__main__":
|
186 |
if (mode := os.getenv("MODE")) == "UI":
|
187 |
stream.ui.launch(server_port=7860)
|
|
|
134 |
},
|
135 |
)
|
136 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
137 |
if __name__ == "__main__":
|
138 |
if (mode := os.getenv("MODE")) == "UI":
|
139 |
stream.ui.launch(server_port=7860)
|