pavanmutha commited on
Commit
a0420eb
·
verified ·
1 Parent(s): 815346d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -1
app.py CHANGED
@@ -61,6 +61,8 @@ agent = CodeAgent(
61
  visual_output = gr.Gallery(label="Generated Visualizations", columns=3, height=600, object_fit="contain")
62
 
63
  def run_agent(_):
 
 
64
 
65
  if df_global is None:
66
  return "Please upload a file first.", []
@@ -106,7 +108,19 @@ def run_agent(_):
106
  insights = "\n".join(raw_insights) if isinstance(raw_insights, list) else str(raw_insights)
107
 
108
  image_paths = result.get("figures", [])
109
- print("🔍 Image paths
 
 
 
 
 
 
 
 
 
 
 
 
110
 
111
 
112
 
 
61
  visual_output = gr.Gallery(label="Generated Visualizations", columns=3, height=600, object_fit="contain")
62
 
63
  def run_agent(_):
64
+ import os
65
+ from PIL import Image
66
 
67
  if df_global is None:
68
  return "Please upload a file first.", []
 
108
  insights = "\n".join(raw_insights) if isinstance(raw_insights, list) else str(raw_insights)
109
 
110
  image_paths = result.get("figures", [])
111
+ print("🔍 Image paths received:", image_paths)
112
+
113
+ for path in image_paths:
114
+ if os.path.exists(path):
115
+ try:
116
+ images.append(Image.open(path))
117
+ except Exception as e:
118
+ print(f"⚠️ Error loading {path}: {e}")
119
+ else:
120
+ print(f"❌ File not found: {path}")
121
+
122
+ return insights, images
123
+
124
 
125
 
126