samwell Claude commited on
Commit
39784b3
·
1 Parent(s): 9b867b2

fix: Display generated X-ray images in visualization panel

Browse files

Updated visualization detection to include generated X-ray images alongside
grounding and segmentation outputs. Now all three visualization types are
properly displayed in the UI.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -261,9 +261,9 @@ def chat(message, history, mode, uploaded_image_path=None):
261
  # Extract text response
262
  assistant_message = response["messages"][-1].content
263
 
264
- # Check for visualization images (grounding or segmentation)
265
  viz_image = None
266
- viz_files = glob.glob("temp/grounding_*.png") + glob.glob("temp/segmentation_*.png")
267
  if viz_files:
268
  # Get the most recent visualization
269
  viz_files.sort(key=os.path.getmtime, reverse=True)
@@ -278,6 +278,8 @@ def chat(message, history, mode, uploaded_image_path=None):
278
  assistant_message = "I've segmented the requested anatomical structures. The visualization is shown on the right."
279
  elif "grounding" in latest_viz:
280
  assistant_message = "I've highlighted the requested regions. The visualization is shown on the right."
 
 
281
  else:
282
  # No visualization generated - show the uploaded image as reference
283
  if current_upload:
 
261
  # Extract text response
262
  assistant_message = response["messages"][-1].content
263
 
264
+ # Check for visualization images (grounding, segmentation, or generated)
265
  viz_image = None
266
+ viz_files = glob.glob("temp/grounding_*.png") + glob.glob("temp/segmentation_*.png") + glob.glob("temp/generated_xray_*.png")
267
  if viz_files:
268
  # Get the most recent visualization
269
  viz_files.sort(key=os.path.getmtime, reverse=True)
 
278
  assistant_message = "I've segmented the requested anatomical structures. The visualization is shown on the right."
279
  elif "grounding" in latest_viz:
280
  assistant_message = "I've highlighted the requested regions. The visualization is shown on the right."
281
+ elif "generated_xray" in latest_viz:
282
+ assistant_message = "I've generated the requested chest X-ray image. The visualization is shown on the right."
283
  else:
284
  # No visualization generated - show the uploaded image as reference
285
  if current_upload: