Spaces:
Running
Running
Commit
•
c259114
1
Parent(s):
f6fd70e
Update app.py
Browse files
app.py
CHANGED
@@ -1,12 +1,14 @@
|
|
1 |
from typing import Literal
|
2 |
import gradio as gr
|
3 |
-
from gradio_webrtc import WebRTC, StreamHandler, AdditionalOutputs
|
4 |
from numpy import ndarray
|
5 |
import sphn
|
6 |
import websockets.sync.client
|
7 |
import numpy as np
|
8 |
|
9 |
|
|
|
|
|
10 |
class MoshiHandler(StreamHandler):
|
11 |
|
12 |
def __init__(self,
|
@@ -101,7 +103,7 @@ with gr.Blocks() as demo:
|
|
101 |
)
|
102 |
response = gr.State(value="")
|
103 |
chatbot = gr.Chatbot(type="messages", value=[])
|
104 |
-
webrtc = WebRTC(label="Conversation", modality="audio", mode="send-receive", rtc_configuration=
|
105 |
webrtc.stream(MoshiHandler("https://freddyaboulton-moshi-server.hf.space"),
|
106 |
inputs=[webrtc, chatbot], outputs=[webrtc], time_limit=90)
|
107 |
|
|
|
1 |
from typing import Literal
|
2 |
import gradio as gr
|
3 |
+
from gradio_webrtc import WebRTC, StreamHandler, AdditionalOutputs, get_twilio_turn_credentials
|
4 |
from numpy import ndarray
|
5 |
import sphn
|
6 |
import websockets.sync.client
|
7 |
import numpy as np
|
8 |
|
9 |
|
10 |
+
rtc_configuration = get_twilio_turn_credentials()
|
11 |
+
|
12 |
class MoshiHandler(StreamHandler):
|
13 |
|
14 |
def __init__(self,
|
|
|
103 |
)
|
104 |
response = gr.State(value="")
|
105 |
chatbot = gr.Chatbot(type="messages", value=[])
|
106 |
+
webrtc = WebRTC(label="Conversation", modality="audio", mode="send-receive", rtc_configuration=rtc_configuration)
|
107 |
webrtc.stream(MoshiHandler("https://freddyaboulton-moshi-server.hf.space"),
|
108 |
inputs=[webrtc, chatbot], outputs=[webrtc], time_limit=90)
|
109 |
|