Upload live_app.py with huggingface_hub
Browse files- live_app.py +5 -3
live_app.py
CHANGED
|
@@ -4,7 +4,7 @@ This app provides live audio translation using the FastRTC library.
|
|
| 4 |
Uses StreamHandlerBase for proper send-receive mode handling.
|
| 5 |
"""
|
| 6 |
|
| 7 |
-
from fastrtc import Stream, StreamHandler
|
| 8 |
import numpy as np
|
| 9 |
import tempfile
|
| 10 |
import wave
|
|
@@ -110,12 +110,14 @@ class LiveTranslationHandler(StreamHandler):
|
|
| 110 |
|
| 111 |
return np.zeros(self.output_frame_size, dtype=np.float32)
|
| 112 |
|
| 113 |
-
# --- FastRTC Stream with
|
| 114 |
stream = Stream(
|
| 115 |
handler=LiveTranslationHandler(),
|
| 116 |
modality="audio",
|
| 117 |
mode="send-receive",
|
| 118 |
-
rtc_configuration=
|
|
|
|
|
|
|
| 119 |
concurrency_limit=5,
|
| 120 |
time_limit=60,
|
| 121 |
)
|
|
|
|
| 4 |
Uses StreamHandlerBase for proper send-receive mode handling.
|
| 5 |
"""
|
| 6 |
|
| 7 |
+
from fastrtc import Stream, StreamHandler
|
| 8 |
import numpy as np
|
| 9 |
import tempfile
|
| 10 |
import wave
|
|
|
|
| 110 |
|
| 111 |
return np.zeros(self.output_frame_size, dtype=np.float32)
|
| 112 |
|
| 113 |
+
# --- FastRTC Stream with Public STUN Server (No Account Needed) ---
|
| 114 |
stream = Stream(
|
| 115 |
handler=LiveTranslationHandler(),
|
| 116 |
modality="audio",
|
| 117 |
mode="send-receive",
|
| 118 |
+
rtc_configuration={
|
| 119 |
+
"iceServers": [{"urls": ["stun:stun.l.google.com:19302"]}]
|
| 120 |
+
},
|
| 121 |
concurrency_limit=5,
|
| 122 |
time_limit=60,
|
| 123 |
)
|