Spaces:
Runtime error
Runtime error
Add option to save results to CSV
Browse files- .gitignore +4 -1
- src/ui.py +11 -0
.gitignore
CHANGED
|
@@ -129,4 +129,7 @@ dmypy.json
|
|
| 129 |
.pyre/
|
| 130 |
|
| 131 |
# Ruff
|
| 132 |
-
.ruff_cache/
|
|
|
|
|
|
|
|
|
|
|
|
| 129 |
.pyre/
|
| 130 |
|
| 131 |
# Ruff
|
| 132 |
+
.ruff_cache/
|
| 133 |
+
|
| 134 |
+
# Custom
|
| 135 |
+
results/
|
src/ui.py
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
|
|
| 1 |
import os
|
| 2 |
|
| 3 |
import gradio as gr
|
|
@@ -176,6 +177,16 @@ def run_and_submit_all(agent: BaseAgent, profile: gr.OAuthProfile | None):
|
|
| 176 |
)
|
| 177 |
print("Submission successful.")
|
| 178 |
results_df = pd.DataFrame(results_log)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 179 |
return final_status, results_df
|
| 180 |
except requests.exceptions.HTTPError as e:
|
| 181 |
error_detail = f"Server responded with status {e.response.status_code}."
|
|
|
|
| 1 |
+
import datetime
|
| 2 |
import os
|
| 3 |
|
| 4 |
import gradio as gr
|
|
|
|
| 177 |
)
|
| 178 |
print("Submission successful.")
|
| 179 |
results_df = pd.DataFrame(results_log)
|
| 180 |
+
|
| 181 |
+
# Save results to CSV for future reference
|
| 182 |
+
results_dir = os.path.join(
|
| 183 |
+
os.path.dirname(os.path.dirname(__file__)), "results"
|
| 184 |
+
)
|
| 185 |
+
os.makedirs(results_dir, exist_ok=True)
|
| 186 |
+
now_str = datetime.datetime.now().strftime("%Y%m%d_%H%M%S")
|
| 187 |
+
csv_path = os.path.join(results_dir, f"results_{now_str}.csv")
|
| 188 |
+
results_df.to_csv(csv_path, index=False)
|
| 189 |
+
|
| 190 |
return final_status, results_df
|
| 191 |
except requests.exceptions.HTTPError as e:
|
| 192 |
error_detail = f"Server responded with status {e.response.status_code}."
|