PearlIsa commited on
Commit
88c36b7
1 Parent(s): ab1f9e0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +33 -30
app.py CHANGED
@@ -1053,33 +1053,36 @@ title = """
1053
  </div>
1054
  """
1055
 
1056
- with gr.Blocks(css="footer {display: none}") as demo:
1057
- gr.HTML(title)
1058
- chatbot = gr.Chatbot(
1059
- value=[{"role": "assistant", "content": "Hi! I'm Pearly, your GP medical assistant. How can I help you today?"}],
1060
- height=600,
1061
- type="messages",
1062
- label="Medical Consultation"
1063
- )
1064
- msg = gr.Textbox(
1065
- label="Your Message",
1066
- placeholder="Describe your symptoms or ask a medical question...",
1067
- lines=2
1068
- )
1069
- submit = gr.Button("Send", variant="primary")
1070
- clear = gr.Button("Clear Conversation")
1071
-
1072
- # Set up event handlers
1073
- msg.submit(chat, [msg, chatbot], [chatbot], queue=True)
1074
- submit.click(chat, [msg, chatbot], [chatbot], queue=True)
1075
- clear.click(lambda: None, None, chatbot, queue=False)
1076
-
1077
- gr.HTML("""
1078
- <div style="text-align: center; margin-top: 20px; font-size: 0.8em; color: #666;">
1079
- <p>This is a medical triage assistant. For emergencies, always call 999.</p>
1080
- <p>Your privacy is important. Conversations are not stored permanently.</p>
1081
- </div>
1082
- """)
1083
-
1084
- # Enable queuing for Hugging Face Spaces
1085
- demo.queue()
 
 
 
 
1053
  </div>
1054
  """
1055
 
1056
+ def create_demo() -> gr.Blocks:
1057
+ """Create and return the Gradio demo interface"""
1058
+ with gr.Blocks(css="footer {display: none}") as demo:
1059
+ gr.HTML(title)
1060
+ chatbot = gr.Chatbot(
1061
+ value=[{"role": "assistant", "content": "Hi! I'm Pearly, your GP medical assistant. How can I help you today?"}],
1062
+ height=600,
1063
+ type="messages",
1064
+ label="Medical Consultation"
1065
+ )
1066
+ msg = gr.Textbox(
1067
+ label="Your Message",
1068
+ placeholder="Describe your symptoms or ask a medical question...",
1069
+ lines=2
1070
+ )
1071
+ submit = gr.Button("Send", variant="primary")
1072
+ clear = gr.Button("Clear Conversation")
1073
+
1074
+ # Set up event handlers
1075
+ msg.submit(chat, [msg, chatbot], [chatbot], queue=True)
1076
+ submit.click(chat, [msg, chatbot], [chatbot], queue=True)
1077
+ clear.click(lambda: None, None, chatbot, queue=False)
1078
+
1079
+ gr.HTML("""
1080
+ <div style="text-align: center; margin-top: 20px; font-size: 0.8em; color: #666;">
1081
+ <p>This is a medical triage assistant. For emergencies, always call 999.</p>
1082
+ <p>Your privacy is important. Conversations are not stored permanently.</p>
1083
+ </div>
1084
+ """)
1085
+ return demo
1086
+
1087
+ # Enable for Hugging Face Spaces
1088
+ app = demo