Spaces:
Sleeping
Sleeping
Upload app.py
Browse files
app.py
CHANGED
@@ -101,15 +101,14 @@ User's Message:
|
|
101 |
chat_history.append(("Gemini", response))
|
102 |
save_record(chat_history)
|
103 |
|
104 |
-
# Format display with highlighting
|
105 |
chat_display = "\n".join(
|
106 |
-
f"<b>{sender}:</b> {highlight_diseases(msg) if sender != 'You' else msg}"
|
107 |
for sender, msg in chat_history
|
108 |
)
|
109 |
return chat_display, chat_history
|
110 |
|
111 |
def export_json(history):
|
112 |
-
return json.dumps(history, indent=2)
|
113 |
|
114 |
with gr.Blocks(css="mark { background-color: #ffeb3b; font-weight: bold; }") as demo:
|
115 |
gr.Markdown("# 🩺 Gemini Healthcare Assistant")
|
@@ -127,6 +126,8 @@ with gr.Blocks(css="mark { background-color: #ffeb3b; font-weight: bold; }") as
|
|
127 |
btn = gr.Button("💬 Send")
|
128 |
btn.click(fn=respond, inputs=[name, age, gender, topic, chat, state], outputs=[output, state])
|
129 |
|
130 |
-
gr.
|
|
|
|
|
131 |
|
132 |
demo.launch()
|
|
|
101 |
chat_history.append(("Gemini", response))
|
102 |
save_record(chat_history)
|
103 |
|
|
|
104 |
chat_display = "\n".join(
|
105 |
+
f"<b>{sender}:</b> {highlight_diseases(msg) if sender != 'You' else msg}"
|
106 |
for sender, msg in chat_history
|
107 |
)
|
108 |
return chat_display, chat_history
|
109 |
|
110 |
def export_json(history):
|
111 |
+
return gr.File.update(value=json.dumps(history, indent=2).encode("utf-8"), visible=True)
|
112 |
|
113 |
with gr.Blocks(css="mark { background-color: #ffeb3b; font-weight: bold; }") as demo:
|
114 |
gr.Markdown("# 🩺 Gemini Healthcare Assistant")
|
|
|
126 |
btn = gr.Button("💬 Send")
|
127 |
btn.click(fn=respond, inputs=[name, age, gender, topic, chat, state], outputs=[output, state])
|
128 |
|
129 |
+
export_btn = gr.Button("⬇️ Export Chat")
|
130 |
+
export_file = gr.File(visible=False)
|
131 |
+
export_btn.click(fn=export_json, inputs=[state], outputs=[export_file])
|
132 |
|
133 |
demo.launch()
|