Spaces:
Sleeping
Sleeping
updated code
Browse files
app.py
CHANGED
@@ -6,7 +6,7 @@ import time
|
|
6 |
from transformers import pipeline
|
7 |
from io import BytesIO
|
8 |
import tempfile
|
9 |
-
from streamlit_webrtc import webrtc_streamer, WebRtcMode,
|
10 |
import av
|
11 |
import queue
|
12 |
|
@@ -48,15 +48,16 @@ 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 |
webrtc_ctx = webrtc_streamer(
|
52 |
key="audio-stream",
|
53 |
mode=WebRtcMode.SENDONLY,
|
54 |
-
|
55 |
-
|
56 |
-
"audio": True,
|
57 |
-
"video": False,
|
58 |
-
}
|
59 |
-
),
|
60 |
audio_frame_callback=audio_frame_callback,
|
61 |
)
|
62 |
|
|
|
6 |
from transformers import pipeline
|
7 |
from io import BytesIO
|
8 |
import tempfile
|
9 |
+
from streamlit_webrtc import webrtc_streamer, WebRtcMode, RTCConfiguration
|
10 |
import av
|
11 |
import queue
|
12 |
|
|
|
48 |
if audio_option == 'Record Audio':
|
49 |
st.write("Click the button to start/stop recording.")
|
50 |
|
51 |
+
# Use rtc_configuration and media_stream_constraints instead of client_settings
|
52 |
+
rtc_configuration = RTCConfiguration(
|
53 |
+
{"iceServers": [{"urls": ["stun:stun.l.google.com:19302"]}]}
|
54 |
+
)
|
55 |
+
|
56 |
webrtc_ctx = webrtc_streamer(
|
57 |
key="audio-stream",
|
58 |
mode=WebRtcMode.SENDONLY,
|
59 |
+
rtc_configuration=rtc_configuration,
|
60 |
+
media_stream_constraints={"audio": True, "video": False},
|
|
|
|
|
|
|
|
|
61 |
audio_frame_callback=audio_frame_callback,
|
62 |
)
|
63 |
|