Spaces:
Sleeping
Sleeping
Commit
·
1b5729a
1
Parent(s):
cc5f905
Check point 4
Browse files
app.py
CHANGED
|
@@ -706,7 +706,6 @@ def create_interface():
|
|
| 706 |
# Add WebRTC component for audio streaming
|
| 707 |
audio_webrtc = WebRTC(
|
| 708 |
label="Audio Input",
|
| 709 |
-
sources=["microphone"],
|
| 710 |
streaming=True,
|
| 711 |
rtc_configuration={"iceServers": [{"urls": ["stun:stun.l.google.com:19302"]}]}
|
| 712 |
)
|
|
@@ -840,7 +839,14 @@ def create_interface():
|
|
| 840 |
# Auto-refresh status every 2 seconds
|
| 841 |
status_timer = gr.Timer(2)
|
| 842 |
status_timer.tick(refresh_status, outputs=[status_output])
|
| 843 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 844 |
return interface
|
| 845 |
|
| 846 |
|
|
@@ -953,4 +959,10 @@ if __name__ == "__main__":
|
|
| 953 |
api_thread.start()
|
| 954 |
|
| 955 |
# Start Gradio in main thread
|
| 956 |
-
run_gradio()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 706 |
# Add WebRTC component for audio streaming
|
| 707 |
audio_webrtc = WebRTC(
|
| 708 |
label="Audio Input",
|
|
|
|
| 709 |
streaming=True,
|
| 710 |
rtc_configuration={"iceServers": [{"urls": ["stun:stun.l.google.com:19302"]}]}
|
| 711 |
)
|
|
|
|
| 839 |
# Auto-refresh status every 2 seconds
|
| 840 |
status_timer = gr.Timer(2)
|
| 841 |
status_timer.tick(refresh_status, outputs=[status_output])
|
| 842 |
+
|
| 843 |
+
# After creating the WebRTC component:
|
| 844 |
+
audio_webrtc.stream(
|
| 845 |
+
fn=process_webrtc_audio,
|
| 846 |
+
inputs=[audio_webrtc],
|
| 847 |
+
outputs=[conversation_output]
|
| 848 |
+
)
|
| 849 |
+
|
| 850 |
return interface
|
| 851 |
|
| 852 |
|
|
|
|
| 959 |
api_thread.start()
|
| 960 |
|
| 961 |
# Start Gradio in main thread
|
| 962 |
+
run_gradio()
|
| 963 |
+
|
| 964 |
+
def process_webrtc_audio(frames):
|
| 965 |
+
# Process frames and send them to your diarization system
|
| 966 |
+
for frame in frames:
|
| 967 |
+
diarization_system.process_audio_chunk(frame)
|
| 968 |
+
return get_conversation()
|