pavanmutha commited on
Commit
08666a8
·
verified ·
1 Parent(s): c06552d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -6
app.py CHANGED
@@ -73,20 +73,25 @@ def run_agent(_):
73
  - At least 3 visualizations showing important trends.
74
  4. Derive at least 3 actionable real-world insights.
75
  5. Save all visualizations to ./figures/ directory.
76
- Return:
77
- - A summary of the insights in clean bullet-point format.
78
- - File paths of the generated visualizations.
79
  """
80
 
81
- result = agent.run(prompt, additional_args={"source_file": temp_file.name})
 
 
 
82
 
83
- image_paths = [line.strip() for line in result.splitlines() if line.strip().endswith(".png")]
84
- insights = "\n".join([line for line in result.splitlines() if not line.strip().endswith(".png")])
 
85
 
86
  return insights, image_paths
87
 
88
 
89
 
 
90
  def train_model(_):
91
  wandb.login(key=os.environ.get("WANDB_API_KEY"))
92
  #wandb_run = wandb.init(project="huggingface-data-analysis", name="Optuna_Run", reinit=True)
 
73
  - At least 3 visualizations showing important trends.
74
  4. Derive at least 3 actionable real-world insights.
75
  5. Save all visualizations to ./figures/ directory.
76
+ Return a dictionary with keys:
77
+ - 'insights': clean bullet-point insights.
78
+ - 'figures': list of file paths of generated visualizations.
79
  """
80
 
81
+ result = agent.run(
82
+ prompt,
83
+ additional_args={"source_file": temp_file.name}
84
+ )
85
 
86
+ # Now, result is expected to be a dictionary
87
+ insights = result.get("insights", "No insights generated.")
88
+ image_paths = result.get("figures", [])
89
 
90
  return insights, image_paths
91
 
92
 
93
 
94
+
95
  def train_model(_):
96
  wandb.login(key=os.environ.get("WANDB_API_KEY"))
97
  #wandb_run = wandb.init(project="huggingface-data-analysis", name="Optuna_Run", reinit=True)