| import gradio as gr |
| import requests |
|
|
| |
| def chat_and_collect(message, history): |
| |
| bot_message = f"I've noted that you said: '{message}'. To help further, could you tell me more about your symptoms?" |
| |
| |
| history.append((message, bot_message)) |
| |
| |
| return "", history |
|
|
| |
| with gr.Blocks(theme=gr.themes.Soft()) as demo: |
| gr.Markdown("# 🏥 Patient Data Intake Assistant") |
| |
| with gr.Row(): |
| |
| avatar_display = gr.Image("avatar.webp", label="Your Assistant", width=300) |
| |
| |
| chatbot = gr.Chatbot() |
| |
| |
| msg = gr.Textbox(label="Your Response", placeholder="Type here...") |
| |
| |
| clear = gr.Button("Restart Conversation") |
|
|
| |
| msg.submit(chat_and_collect, [msg, chatbot], [msg, chatbot]) |
| |
| |
| clear.click(lambda: None, None, chatbot, queue=False) |
|
|
| |
| demo.launch(server_name="0.0.0.0", server_port=7860) |
|
|
|
|