Update app.py
Browse files
app.py
CHANGED
|
@@ -53,12 +53,12 @@ agent = CodeAgent(
|
|
| 53 |
additional_authorized_imports=["numpy", "pandas", "matplotlib.pyplot", "seaborn"]
|
| 54 |
)
|
| 55 |
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
|
| 61 |
-
#
|
| 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":
|
| 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)
|