Upload live_app.py with huggingface_hub
Browse files- live_app.py +10 -3
live_app.py
CHANGED
|
@@ -110,13 +110,19 @@ class LiveTranslationHandler(StreamHandler):
|
|
| 110 |
|
| 111 |
return np.zeros(self.output_frame_size, dtype=np.float32)
|
| 112 |
|
| 113 |
-
# --- FastRTC Stream with Public STUN
|
| 114 |
stream = Stream(
|
| 115 |
handler=LiveTranslationHandler(),
|
| 116 |
modality="audio",
|
| 117 |
mode="send-receive",
|
| 118 |
rtc_configuration={
|
| 119 |
-
"iceServers": [
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 120 |
},
|
| 121 |
concurrency_limit=5,
|
| 122 |
time_limit=60,
|
|
@@ -127,4 +133,5 @@ if __name__ == "__main__":
|
|
| 127 |
print("[SIMBOTI] Starting Live Translation...")
|
| 128 |
print("[SIMBOTI] Languages: English -> Polish")
|
| 129 |
print("[SIMBOTI] Open your browser to the URL below:")
|
| 130 |
-
|
|
|
|
|
|
| 110 |
|
| 111 |
return np.zeros(self.output_frame_size, dtype=np.float32)
|
| 112 |
|
| 113 |
+
# --- FastRTC Stream with Robust Public STUN Servers ---
|
| 114 |
stream = Stream(
|
| 115 |
handler=LiveTranslationHandler(),
|
| 116 |
modality="audio",
|
| 117 |
mode="send-receive",
|
| 118 |
rtc_configuration={
|
| 119 |
+
"iceServers": [
|
| 120 |
+
{"urls": ["stun:stun.l.google.com:19302"]},
|
| 121 |
+
{"urls": ["stun:stun1.l.google.com:19302"]},
|
| 122 |
+
{"urls": ["stun:stun2.l.google.com:19302"]},
|
| 123 |
+
{"urls": ["stun:stun3.l.google.com:19302"]},
|
| 124 |
+
{"urls": ["stun:stun4.l.google.com:19302"]},
|
| 125 |
+
]
|
| 126 |
},
|
| 127 |
concurrency_limit=5,
|
| 128 |
time_limit=60,
|
|
|
|
| 133 |
print("[SIMBOTI] Starting Live Translation...")
|
| 134 |
print("[SIMBOTI] Languages: English -> Polish")
|
| 135 |
print("[SIMBOTI] Open your browser to the URL below:")
|
| 136 |
+
# Disable SSR (Server Side Rendering) for better WebRTC stability
|
| 137 |
+
stream.ui.launch(ssr=False)
|