Spaces:
Running
Running
bug fix
Browse files
app.py
CHANGED
@@ -10,7 +10,7 @@ from streamlit_webrtc import webrtc_streamer, WebRtcMode, RTCConfiguration
|
|
10 |
import av
|
11 |
import queue
|
12 |
|
13 |
-
# Define the models
|
14 |
MODELS = {
|
15 |
"Whisper (English)": "openai/whisper-small.en",
|
16 |
"Whisper (Multilingual)": "openai/whisper-small",
|
@@ -48,11 +48,17 @@ def audio_frame_callback(frame: av.AudioFrame):
|
|
48 |
if audio_option == 'Record Audio':
|
49 |
st.write("Click the button to start/stop recording.")
|
50 |
|
51 |
-
#
|
52 |
rtc_configuration = RTCConfiguration(
|
53 |
-
{
|
|
|
|
|
|
|
|
|
|
|
54 |
)
|
55 |
-
|
|
|
56 |
webrtc_ctx = webrtc_streamer(
|
57 |
key="audio-stream",
|
58 |
mode=WebRtcMode.SENDONLY,
|
@@ -61,6 +67,7 @@ if audio_option == 'Record Audio':
|
|
61 |
audio_frame_callback=audio_frame_callback,
|
62 |
)
|
63 |
|
|
|
64 |
if webrtc_ctx.state.playing:
|
65 |
st.write("Recording...")
|
66 |
|
|
|
10 |
import av
|
11 |
import queue
|
12 |
|
13 |
+
# Define the models
|
14 |
MODELS = {
|
15 |
"Whisper (English)": "openai/whisper-small.en",
|
16 |
"Whisper (Multilingual)": "openai/whisper-small",
|
|
|
48 |
if audio_option == 'Record Audio':
|
49 |
st.write("Click the button to start/stop recording.")
|
50 |
|
51 |
+
# Change STUN server to a different one to avoid potential issues
|
52 |
rtc_configuration = RTCConfiguration(
|
53 |
+
{
|
54 |
+
"iceServers": [
|
55 |
+
{"urls": ["stun:stun1.l.google.com:19302"]},
|
56 |
+
{"urls": ["stun:stun2.l.google.com:19302"]}
|
57 |
+
]
|
58 |
+
}
|
59 |
)
|
60 |
+
|
61 |
+
# Start WebRTC recording
|
62 |
webrtc_ctx = webrtc_streamer(
|
63 |
key="audio-stream",
|
64 |
mode=WebRtcMode.SENDONLY,
|
|
|
67 |
audio_frame_callback=audio_frame_callback,
|
68 |
)
|
69 |
|
70 |
+
# Ensure we are recording
|
71 |
if webrtc_ctx.state.playing:
|
72 |
st.write("Recording...")
|
73 |
|