Rustamshry commited on
Commit
2ef3ebb
·
verified ·
1 Parent(s): 1388d60

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -0
app.py CHANGED
@@ -432,11 +432,21 @@ def analyze_data(file):
432
  If a target is found, run AutoML to train the best model.
433
  Return all insights, metrics, and visualizations.
434
  """
 
435
  try:
436
  results = agent.run(prompt)
437
  except Exception as e:
438
  results = {"error": f"Agent failed: {str(e)}"}
439
 
 
 
 
 
 
 
 
 
 
440
  # === Text Report ===
441
  text_output = ""
442
 
 
432
  If a target is found, run AutoML to train the best model.
433
  Return all insights, metrics, and visualizations.
434
  """
435
+
436
  try:
437
  results = agent.run(prompt)
438
  except Exception as e:
439
  results = {"error": f"Agent failed: {str(e)}"}
440
 
441
+ if not isinstance(results, dict):
442
+ # AgentText or string → convert to dict-like structure
443
+ if hasattr(results, "content"):
444
+ text_content = results.content
445
+ else:
446
+ text_content = str(results)
447
+ results = {"summary": text_content}
448
+
449
+
450
  # === Text Report ===
451
  text_output = ""
452