Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -244,20 +244,10 @@ def save_uploaded(file_obj):
|
|
| 244 |
"""Return a filesystem path for the uploaded file object."""
|
| 245 |
if not file_obj:
|
| 246 |
return None
|
| 247 |
-
if isinstance(file_obj, dict):
|
| 248 |
-
for key in ("name", "path", "file"):
|
| 249 |
-
p = file_obj.get(key)
|
| 250 |
-
if p and os.path.exists(p):
|
| 251 |
-
return p
|
| 252 |
if isinstance(file_obj, str) and os.path.exists(file_obj):
|
| 253 |
return file_obj
|
| 254 |
-
|
| 255 |
-
|
| 256 |
-
# fallback: dump bytes to tmp file
|
| 257 |
-
fd, tmp = tempfile.mkstemp(suffix=".csv")
|
| 258 |
-
with os.fdopen(fd, "wb") as f:
|
| 259 |
-
f.write(file_obj.read())
|
| 260 |
-
return tmp
|
| 261 |
|
| 262 |
def load_file_to_df(path):
|
| 263 |
if path is None:
|
|
@@ -315,7 +305,7 @@ with gr.Blocks(title="Agentic Evaluation Framework") as demo:
|
|
| 315 |
"`task_id, task_type, prompt, agent, response, metadata`")
|
| 316 |
|
| 317 |
with gr.Row():
|
| 318 |
-
file_upload = gr.File(label="Upload CSV", type="
|
| 319 |
eval_btn = gr.Button("Run Evaluation", variant="primary")
|
| 320 |
|
| 321 |
gallery = gr.Gallery(label="Visualizations", columns=2, height="auto")
|
|
|
|
| 244 |
"""Return a filesystem path for the uploaded file object."""
|
| 245 |
if not file_obj:
|
| 246 |
return None
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 247 |
if isinstance(file_obj, str) and os.path.exists(file_obj):
|
| 248 |
return file_obj
|
| 249 |
+
return None
|
| 250 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 251 |
|
| 252 |
def load_file_to_df(path):
|
| 253 |
if path is None:
|
|
|
|
| 305 |
"`task_id, task_type, prompt, agent, response, metadata`")
|
| 306 |
|
| 307 |
with gr.Row():
|
| 308 |
+
file_upload = gr.File(label="Upload CSV", type="filepath", file_types=[".csv"])
|
| 309 |
eval_btn = gr.Button("Run Evaluation", variant="primary")
|
| 310 |
|
| 311 |
gallery = gr.Gallery(label="Visualizations", columns=2, height="auto")
|