Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1053,33 +1053,36 @@ title = """
|
|
1053 |
</div>
|
1054 |
"""
|
1055 |
|
1056 |
-
|
1057 |
-
|
1058 |
-
|
1059 |
-
|
1060 |
-
|
1061 |
-
|
1062 |
-
|
1063 |
-
|
1064 |
-
|
1065 |
-
|
1066 |
-
|
1067 |
-
|
1068 |
-
|
1069 |
-
|
1070 |
-
|
1071 |
-
|
1072 |
-
|
1073 |
-
|
1074 |
-
|
1075 |
-
|
1076 |
-
|
1077 |
-
|
1078 |
-
|
1079 |
-
|
1080 |
-
<
|
1081 |
-
|
1082 |
-
|
1083 |
-
|
1084 |
-
|
1085 |
-
demo
|
|
|
|
|
|
|
|
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
|