AAhad commited on
Commit
0c5ffc2
·
1 Parent(s): 68b5c48

updated code

Browse files
Files changed (1) hide show
  1. app.py +8 -7
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, ClientSettings
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
- client_settings=ClientSettings(
55
- media_stream_constraints={
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