Spaces:
Running
Running
| 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() | |