pavanmutha commited on
Commit
632978a
·
verified ·
1 Parent(s): ec81562

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -7
app.py CHANGED
@@ -53,12 +53,12 @@ agent = CodeAgent(
53
  additional_authorized_imports=["numpy", "pandas", "matplotlib.pyplot", "seaborn"]
54
  )
55
 
56
- # Modify `run_agent` to directly use the cleaned `df_global`
57
- def run_agent(_):
58
- if df_global is None or df_global.empty:
59
- return "No data available for analysis."
60
 
61
- # Use the cleaned data (df_global) for analysis
62
  analysis_result = agent.run(
63
  """
64
  You are an expert data analyst. Perform comprehensive analysis including:
@@ -70,11 +70,11 @@ def run_agent(_):
70
  """,
71
  additional_args={
72
  "additional_notes": additional_notes, # Pass additional notes
73
- "source_file": "uploaded_file.csv" # Use the appropriate file name or path if needed
74
  }
75
  )
76
- return analysis_result
77
 
 
78
 
79
  # Optionally, you can inspect the results
80
  print(analysis_result)
 
53
  additional_authorized_imports=["numpy", "pandas", "matplotlib.pyplot", "seaborn"]
54
  )
55
 
56
+ def run_agent(file_data):
57
+ # Ensure that the file data is being used here
58
+ global df_global # Use the global df_global if required
59
+ df_global = file_data # Set the global df to the uploaded data
60
 
61
+ # Run the agent analysis logic
62
  analysis_result = agent.run(
63
  """
64
  You are an expert data analyst. Perform comprehensive analysis including:
 
70
  """,
71
  additional_args={
72
  "additional_notes": additional_notes, # Pass additional notes
73
+ "source_file": df_global # Use the uploaded file's dataframe directly
74
  }
75
  )
 
76
 
77
+ return analysis_result
78
 
79
  # Optionally, you can inspect the results
80
  print(analysis_result)