| import gradio as gr | |
| from xiaozhi_gradio import XiaozhiClient | |
| client = XiaozhiClient() | |
| def converse(text_input): | |
| return client.chat(text_input) | |
| demo = gr.Interface( | |
| fn=converse, | |
| inputs=gr.Textbox(label="用户输入"), | |
| outputs=gr.Textbox(label="小智回复"), | |
| title="py-xiaozhi 语音客户端" | |
| ) | |
| if __name__ == "__main__": | |
| demo.launch() | |