simple_demo / app.py
josh
adding turn server
3605aad
Raw History Blame Contribute Delete
629 Bytes
from fastrtc import Stream, ReplyOnPause
import numpy as np
from fastrtc import WebRTC, get_hf_turn_credentials
def echo(audio: tuple[int, np.ndarray]):
# The function will be passed the audio until the user pauses
# Implement any iterator that yields audio
# See "LLM Voice Chat" for a more complete example
yield audio
stream = Stream(
handler=ReplyOnPause(echo),
modality="audio",
mode="send-receive",
server_rtc_configuration=get_hf_turn_credentials(ttl=600*10000),
rtc_configuration=get_hf_turn_credentials(),
time_limit=90,
concurrency_limit=5,
)
stream.ui.launch(port=7860)