Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -157,15 +157,13 @@ def interact_with_agent(file_input, additional_notes):
|
|
| 157 |
os.makedirs(FIGURES_DIR, exist_ok=True)
|
| 158 |
|
| 159 |
if file_input is None:
|
| 160 |
-
|
| 161 |
-
return
|
| 162 |
|
| 163 |
# Analyze the data
|
| 164 |
data_description, visualization_paths, target = analyze_data(file_input.name)
|
| 165 |
|
| 166 |
if data_description is None:
|
| 167 |
-
|
| 168 |
-
return
|
| 169 |
|
| 170 |
# Construct the prompt for the model
|
| 171 |
prompt = base_prompt.format(
|
|
@@ -197,7 +195,7 @@ def interact_with_agent(file_input, additional_notes):
|
|
| 197 |
else:
|
| 198 |
messages.append({"role": "assistant", "content": f"⚠️ Unable to find image: {image_path}"})
|
| 199 |
|
| 200 |
-
|
| 201 |
|
| 202 |
# Define the Gradio interface
|
| 203 |
with gr.Blocks(
|
|
@@ -248,3 +246,6 @@ if __name__ == "__main__":
|
|
| 248 |
|
| 249 |
|
| 250 |
|
|
|
|
|
|
|
|
|
|
|
|
| 157 |
os.makedirs(FIGURES_DIR, exist_ok=True)
|
| 158 |
|
| 159 |
if file_input is None:
|
| 160 |
+
return [{"role": "assistant", "content": "❌ No file uploaded. Please upload a CSV file to proceed."}]
|
|
|
|
| 161 |
|
| 162 |
# Analyze the data
|
| 163 |
data_description, visualization_paths, target = analyze_data(file_input.name)
|
| 164 |
|
| 165 |
if data_description is None:
|
| 166 |
+
return [{"role": "assistant", "content": data_description}] # data_description contains the error message
|
|
|
|
| 167 |
|
| 168 |
# Construct the prompt for the model
|
| 169 |
prompt = base_prompt.format(
|
|
|
|
| 195 |
else:
|
| 196 |
messages.append({"role": "assistant", "content": f"⚠️ Unable to find image: {image_path}"})
|
| 197 |
|
| 198 |
+
return messages
|
| 199 |
|
| 200 |
# Define the Gradio interface
|
| 201 |
with gr.Blocks(
|
|
|
|
| 246 |
|
| 247 |
|
| 248 |
|
| 249 |
+
|
| 250 |
+
|
| 251 |
+
|