echo-audio / scratch.py
freddyaboulton's picture
Upload folder using huggingface_hub
45482ae verified
raw
history blame contribute delete
712 Bytes
from fastrtc import Stream, ReplyOnPause
import numpy as np
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",
ui_args={
"icon": "https://upload.wikimedia.org/wikipedia/commons/thumb/0/01/Portrait-of-a-woman.jpg/960px-Portrait-of-a-woman.jpg?20200608215745",
"pulse_color": "rgb(35, 157, 225)",
"icon_button_color": "rgb(35, 157, 225)",
"title": "Gemini Audio Video Chat",
},
)
stream.ui.launch()