freddyaboulton HF staff commited on
Commit
921f2bd
1 Parent(s): f358c7e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -1
app.py CHANGED
@@ -3,6 +3,19 @@ import cv2
3
  import numpy as np
4
  from gradio_webrtc import WebRTC
5
  from pathlib import Path
 
 
 
 
 
 
 
 
 
 
 
 
 
6
 
7
  CLASSES = [
8
  "background",
@@ -88,7 +101,7 @@ with gr.Blocks(css=css) as demo:
88
  """)
89
  with gr.Column(elem_classes=["my-column"]):
90
  with gr.Group(elem_classes=["my-group"]):
91
- image = WebRTC(label="Strean")
92
  conf_threshold = gr.Slider(
93
  label="Confidence Threshold",
94
  minimum=0.0,
 
3
  import numpy as np
4
  from gradio_webrtc import WebRTC
5
  from pathlib import Path
6
+ from twilio.rest import Client
7
+ import os
8
+
9
+ account_sid = os.environ.get("TWILIO_ACCOUNT_SID")
10
+ auth_token = os.environ.get("TWILIO_AUTH_TOKEN")
11
+ client = Client(account_sid, auth_token)
12
+
13
+ token = client.tokens.create()
14
+
15
+ rtc_configuration = {
16
+ "iceServers": token.ice_servers,
17
+ "iceTransportPolicy": "relay",
18
+ }
19
 
20
  CLASSES = [
21
  "background",
 
101
  """)
102
  with gr.Column(elem_classes=["my-column"]):
103
  with gr.Group(elem_classes=["my-group"]):
104
+ image = WebRTC(label="Strean", rtc_configuration=rtc_configuration)
105
  conf_threshold = gr.Slider(
106
  label="Confidence Threshold",
107
  minimum=0.0,