Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Fix consent_storage
Browse files
app.py
CHANGED
@@ -264,7 +264,7 @@ class EnrichedGradioUI(GradioUI):
|
|
264 |
data_dir = os.path.join(TMP_DIR, interaction_id)
|
265 |
print("CREATING DATA DIR", data_dir, "FROM", TMP_DIR, interaction_id)
|
266 |
|
267 |
-
if not os.path.exists(data_dir):
|
268 |
os.makedirs(data_dir)
|
269 |
|
270 |
# Always re-create an agent from scratch, else Qwen-VL gets confused with past history
|
@@ -281,12 +281,13 @@ class EnrichedGradioUI(GradioUI):
|
|
281 |
)
|
282 |
yield stored_messages
|
283 |
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
|
|
|
|
288 |
)
|
289 |
-
)
|
290 |
|
291 |
screenshot_bytes = session_state["agent"].desktop.screenshot(format="bytes")
|
292 |
initial_screenshot = Image.open(BytesIO(screenshot_bytes))
|
@@ -345,11 +346,12 @@ class EnrichedGradioUI(GradioUI):
|
|
345 |
status = "failed"
|
346 |
yield stored_messages
|
347 |
finally:
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
|
|
353 |
|
354 |
|
355 |
theme = gr.themes.Default(
|
|
|
264 |
data_dir = os.path.join(TMP_DIR, interaction_id)
|
265 |
print("CREATING DATA DIR", data_dir, "FROM", TMP_DIR, interaction_id)
|
266 |
|
267 |
+
if not os.path.exists(data_dir) and consent_storage:
|
268 |
os.makedirs(data_dir)
|
269 |
|
270 |
# Always re-create an agent from scratch, else Qwen-VL gets confused with past history
|
|
|
281 |
)
|
282 |
yield stored_messages
|
283 |
|
284 |
+
if consent_storage:
|
285 |
+
with open(os.path.join(data_dir, "metadata.jsonl"), "w") as output_file:
|
286 |
+
output_file.write(
|
287 |
+
json.dumps(
|
288 |
+
{"task": task_input},
|
289 |
+
)
|
290 |
)
|
|
|
291 |
|
292 |
screenshot_bytes = session_state["agent"].desktop.screenshot(format="bytes")
|
293 |
initial_screenshot = Image.open(BytesIO(screenshot_bytes))
|
|
|
346 |
status = "failed"
|
347 |
yield stored_messages
|
348 |
finally:
|
349 |
+
if consent_storage:
|
350 |
+
summary = get_agent_summary_erase_images(session_state["agent"])
|
351 |
+
save_final_status(
|
352 |
+
data_dir, status, summary=summary, error_message=error_message
|
353 |
+
)
|
354 |
+
print("SAVING FINAL STATUS", data_dir, status, summary, error_message)
|
355 |
|
356 |
|
357 |
theme = gr.themes.Default(
|