akhaliq HF staff commited on
Commit
739dded
·
verified ·
1 Parent(s): 9f1bc1c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -3
app.py CHANGED
@@ -1,5 +1,5 @@
1
  import gradio as gr
2
- from gradio_webrtc import WebRTC, StreamHandler
3
  import websockets.sync.client
4
  import numpy as np
5
  import json
@@ -161,6 +161,7 @@ class GeminiHandler(StreamHandler):
161
 
162
  class GeminiVoiceChat:
163
  def __init__(self):
 
164
  self.demo = self._create_interface()
165
 
166
  def _create_interface(self):
@@ -177,7 +178,8 @@ class GeminiVoiceChat:
177
  webrtc = WebRTC(
178
  label="Conversation",
179
  modality="audio",
180
- mode="send-receive"
 
181
  )
182
 
183
  webrtc.stream(
@@ -193,7 +195,10 @@ class GeminiVoiceChat:
193
  self.demo.launch(
194
  server_name="0.0.0.0",
195
  server_port=int(os.environ.get("PORT", 7860)),
196
- share=True # Only if you want to create a public URL
 
 
 
197
  )
198
 
199
  if __name__ == "__main__":
 
1
  import gradio as gr
2
+ from gradio_webrtc import WebRTC, StreamHandler, get_twilio_turn_credentials
3
  import websockets.sync.client
4
  import numpy as np
5
  import json
 
161
 
162
  class GeminiVoiceChat:
163
  def __init__(self):
164
+ load_dotenv()
165
  self.demo = self._create_interface()
166
 
167
  def _create_interface(self):
 
178
  webrtc = WebRTC(
179
  label="Conversation",
180
  modality="audio",
181
+ mode="send-receive",
182
+ rtc_configuration=get_twilio_turn_credentials()
183
  )
184
 
185
  webrtc.stream(
 
195
  self.demo.launch(
196
  server_name="0.0.0.0",
197
  server_port=int(os.environ.get("PORT", 7860)),
198
+ share=True,
199
+ ssl_verify=False,
200
+ ssl_keyfile=None,
201
+ ssl_certfile=None
202
  )
203
 
204
  if __name__ == "__main__":