Ruurd commited on
Commit
20df145
·
verified ·
1 Parent(s): 6969efa

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -3
app.py CHANGED
@@ -284,12 +284,12 @@ def load_patient_conversation(patient_key):
284
  {
285
  "role": "assistant",
286
  "content": (
287
- "**Welcome to the Radiologist's Companion!**\n\n"
288
  "You can ask me about the patient's medical history or available imaging data.\n"
289
  "- I can summarize key details from the EHR.\n"
290
  "- I can tell you which medical images are available.\n"
291
  "- If you'd like an organ segmentation (e.g. spleen, liver, kidney_left, colon, femur_right) on an abdominal CT scan, just ask!\n\n"
292
- "**Example Requests:**\n"
293
  "- \"What do we know about this patient?\"\n"
294
  "- \"Which images are available for this patient?\"\n"
295
  "- \"Can you segment the spleen from the CT scan?\"\n"
@@ -340,7 +340,7 @@ with gr.Blocks(css=css) as demo:
340
  # Chat
341
  with gr.Column(scale=3):
342
  gr.Markdown("### Chat")
343
- chatbot = gr.Chatbot(label="Chat", type="messages", height=400)
344
  msg = gr.Textbox(label="Your message", placeholder="Enter your chat message...", show_label=False)
345
  with gr.Row():
346
  submit_btn = gr.Button("Submit", variant="primary")
@@ -404,6 +404,17 @@ with gr.Blocks(css=css) as demo:
404
  chatbot,
405
  )
406
 
 
 
 
 
 
 
 
 
 
 
 
407
 
408
  # Clear chat
409
  clear_btn.click(lambda: [], None, chatbot, queue=False)
 
284
  {
285
  "role": "assistant",
286
  "content": (
287
+ "Welcome to the Radiologist's Companion!\n\n"
288
  "You can ask me about the patient's medical history or available imaging data.\n"
289
  "- I can summarize key details from the EHR.\n"
290
  "- I can tell you which medical images are available.\n"
291
  "- If you'd like an organ segmentation (e.g. spleen, liver, kidney_left, colon, femur_right) on an abdominal CT scan, just ask!\n\n"
292
+ "Example Requests:\n"
293
  "- \"What do we know about this patient?\"\n"
294
  "- \"Which images are available for this patient?\"\n"
295
  "- \"Can you segment the spleen from the CT scan?\"\n"
 
340
  # Chat
341
  with gr.Column(scale=3):
342
  gr.Markdown("### Chat")
343
+ chatbot = gr.Chatbot(label="Chat", type="messages", height=450)
344
  msg = gr.Textbox(label="Your message", placeholder="Enter your chat message...", show_label=False)
345
  with gr.Row():
346
  submit_btn = gr.Button("Submit", variant="primary")
 
404
  chatbot,
405
  )
406
 
407
+ submit_btn.click(
408
+ add_user_message,
409
+ [msg, chatbot, patient_id],
410
+ [msg, chatbot],
411
+ queue=False,
412
+ ).then(
413
+ chat_with_model,
414
+ [chatbot, patient_id],
415
+ chatbot,
416
+ )
417
+
418
 
419
  # Clear chat
420
  clear_btn.click(lambda: [], None, chatbot, queue=False)