samwell commited on
Commit
a5cf627
·
1 Parent(s): 879e071

Return file path instead of PIL Image for grounding visualization

Browse files
Files changed (1) hide show
  1. app.py +3 -5
app.py CHANGED
@@ -66,7 +66,6 @@ agent = Agent(
66
  print(f"Tools loaded: {len(tools)}")
67
 
68
  import glob
69
- from PIL import Image
70
 
71
  def chat(message, history):
72
  config = {"configurable": {"thread_id": "default"}}
@@ -95,10 +94,9 @@ def chat(message, history):
95
  # Get the most recent visualization
96
  viz_files.sort(key=os.path.getmtime, reverse=True)
97
  latest_viz = viz_files[0]
98
- try:
99
- viz_image = Image.open(latest_viz)
100
- except:
101
- pass
102
 
103
  return assistant_message, viz_image
104
 
 
66
  print(f"Tools loaded: {len(tools)}")
67
 
68
  import glob
 
69
 
70
  def chat(message, history):
71
  config = {"configurable": {"thread_id": "default"}}
 
94
  # Get the most recent visualization
95
  viz_files.sort(key=os.path.getmtime, reverse=True)
96
  latest_viz = viz_files[0]
97
+ # Return the file path directly - Gradio can handle it
98
+ if os.path.exists(latest_viz):
99
+ viz_image = latest_viz
 
100
 
101
  return assistant_message, viz_image
102