Spaces:
Runtime error
Runtime error
Commit
·
77f2f5c
1
Parent(s):
235b0f1
rtc_config
Browse files
app.py
CHANGED
|
@@ -6,6 +6,10 @@ import torch
|
|
| 6 |
import time
|
| 7 |
import numpy as np
|
| 8 |
from gradio_webrtc import WebRTC
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
|
| 10 |
from transformers import RTDetrForObjectDetection, RTDetrImageProcessor
|
| 11 |
|
|
@@ -14,6 +18,21 @@ from draw_boxes import draw_bounding_boxes
|
|
| 14 |
image_processor = RTDetrImageProcessor.from_pretrained("PekingU/rtdetr_r50vd")
|
| 15 |
model = RTDetrForObjectDetection.from_pretrained("PekingU/rtdetr_r50vd").to("cuda")
|
| 16 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
|
| 18 |
SUBSAMPLE = 2
|
| 19 |
|
|
|
|
| 6 |
import time
|
| 7 |
import numpy as np
|
| 8 |
from gradio_webrtc import WebRTC
|
| 9 |
+
import os
|
| 10 |
+
|
| 11 |
+
from twilio.rest import Client
|
| 12 |
+
|
| 13 |
|
| 14 |
from transformers import RTDetrForObjectDetection, RTDetrImageProcessor
|
| 15 |
|
|
|
|
| 18 |
image_processor = RTDetrImageProcessor.from_pretrained("PekingU/rtdetr_r50vd")
|
| 19 |
model = RTDetrForObjectDetection.from_pretrained("PekingU/rtdetr_r50vd").to("cuda")
|
| 20 |
|
| 21 |
+
account_sid = os.environ.get("TWILIO_ACCOUNT_SID")
|
| 22 |
+
auth_token = os.environ.get("TWILIO_AUTH_TOKEN")
|
| 23 |
+
|
| 24 |
+
if account_sid and auth_token:
|
| 25 |
+
client = Client(account_sid, auth_token)
|
| 26 |
+
|
| 27 |
+
token = client.tokens.create()
|
| 28 |
+
|
| 29 |
+
rtc_configuration = {
|
| 30 |
+
"iceServers": token.ice_servers,
|
| 31 |
+
"iceTransportPolicy": "relay",
|
| 32 |
+
}
|
| 33 |
+
else:
|
| 34 |
+
rtc_configuration = None
|
| 35 |
+
|
| 36 |
|
| 37 |
SUBSAMPLE = 2
|
| 38 |
|