Upload live_app.py with huggingface_hub
Browse files- live_app.py +2 -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,
|
| 8 |
import numpy as np
|
| 9 |
import tempfile
|
| 10 |
import wave
|
|
@@ -30,7 +30,7 @@ def get_translator():
|
|
| 30 |
return translator
|
| 31 |
|
| 32 |
# --- StreamHandler Class for Real-Time Translation ---
|
| 33 |
-
class LiveTranslationHandler(
|
| 34 |
"""
|
| 35 |
StreamHandler for real-time audio translation.
|
| 36 |
Receives audio chunks, accumulates, translates, and returns TTS audio.
|
|
|
|
| 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
|
|
|
|
| 30 |
return translator
|
| 31 |
|
| 32 |
# --- StreamHandler Class for Real-Time Translation ---
|
| 33 |
+
class LiveTranslationHandler(StreamHandler):
|
| 34 |
"""
|
| 35 |
StreamHandler for real-time audio translation.
|
| 36 |
Receives audio chunks, accumulates, translates, and returns TTS audio.
|