Upload live_app.py with huggingface_hub
Browse files- live_app.py +5 -2
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,11 +110,14 @@ class LiveTranslationHandler(StreamHandler):
|
|
| 110 |
|
| 111 |
return np.zeros(self.output_frame_size, dtype=np.float32)
|
| 112 |
|
| 113 |
-
# --- FastRTC Stream with proper StreamHandler ---
|
| 114 |
stream = Stream(
|
| 115 |
handler=LiveTranslationHandler(),
|
| 116 |
modality="audio",
|
| 117 |
mode="send-receive",
|
|
|
|
|
|
|
|
|
|
| 118 |
)
|
| 119 |
|
| 120 |
# Launch with Gradio UI
|
|
|
|
| 4 |
Uses StreamHandlerBase for proper send-receive mode handling.
|
| 5 |
"""
|
| 6 |
|
| 7 |
+
from fastrtc import Stream, StreamHandler, get_twilio_turn_credentials
|
| 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 proper StreamHandler & TURN Config ---
|
| 114 |
stream = Stream(
|
| 115 |
handler=LiveTranslationHandler(),
|
| 116 |
modality="audio",
|
| 117 |
mode="send-receive",
|
| 118 |
+
rtc_configuration=get_twilio_turn_credentials(),
|
| 119 |
+
concurrency_limit=5,
|
| 120 |
+
time_limit=60,
|
| 121 |
)
|
| 122 |
|
| 123 |
# Launch with Gradio UI
|