Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Cosmetic changes: title, note in sidebar
Browse files
app.py
CHANGED
@@ -1,21 +1,21 @@
|
|
1 |
-
import gradio as gr
|
2 |
-
import os
|
3 |
import json
|
|
|
4 |
import shutil
|
5 |
-
import uuid
|
6 |
import time
|
|
|
|
|
7 |
from threading import Timer
|
8 |
-
|
|
|
|
|
9 |
from e2b_desktop import Sandbox
|
10 |
from gradio_modal import Modal
|
11 |
-
from
|
12 |
from PIL import Image
|
13 |
-
from dotenv import load_dotenv
|
14 |
-
|
15 |
from smolagents import CodeAgent
|
16 |
from smolagents.gradio_ui import GradioUI, stream_to_gradio
|
17 |
|
18 |
-
from e2bqwen import
|
19 |
|
20 |
load_dotenv(override=True)
|
21 |
|
@@ -165,7 +165,8 @@ sandbox_html_template = """
|
|
165 |
<style>
|
166 |
@import url('https://fonts.googleapis.com/css2?family=Oxanium:[email protected]&display=swap');
|
167 |
</style>
|
168 |
-
<h1 style="color:var(--color-accent);margin:0;">
|
|
|
169 |
<div class="sandbox-container" style="margin:0;">
|
170 |
<div class="status-bar">
|
171 |
<div class="status-indicator {status_class}"></div>
|
@@ -428,6 +429,7 @@ def save_final_status(folder, status: str, summary, error_message=None) -> None:
|
|
428 |
)
|
429 |
)
|
430 |
|
|
|
431 |
def extract_browser_uuid(js_uuid):
|
432 |
print(f"[BROWSER] Got browser UUID from JS: {js_uuid}")
|
433 |
return js_uuid
|
@@ -525,7 +527,7 @@ class EnrichedGradioUI(GradioUI):
|
|
525 |
# THIS ERASES IMAGES FROM AGENT MEMORY, USE WITH CAUTION
|
526 |
if consent_storage:
|
527 |
summary = get_agent_summary_erase_images(session_state["agent"])
|
528 |
-
save_final_status(data_dir, "completed", summary
|
529 |
yield stored_messages
|
530 |
|
531 |
except Exception as e:
|
@@ -605,6 +607,10 @@ _Please note that we store the task logs by default so **do not write any person
|
|
605 |
label="Store task and agent trace?", value=True
|
606 |
)
|
607 |
|
|
|
|
|
|
|
|
|
608 |
def apply_theme(minimalist_mode: bool):
|
609 |
if not minimalist_mode:
|
610 |
return """
|
|
|
|
|
|
|
1 |
import json
|
2 |
+
import os
|
3 |
import shutil
|
|
|
4 |
import time
|
5 |
+
import uuid
|
6 |
+
from io import BytesIO
|
7 |
from threading import Timer
|
8 |
+
|
9 |
+
import gradio as gr
|
10 |
+
from dotenv import load_dotenv
|
11 |
from e2b_desktop import Sandbox
|
12 |
from gradio_modal import Modal
|
13 |
+
from huggingface_hub import login, upload_folder
|
14 |
from PIL import Image
|
|
|
|
|
15 |
from smolagents import CodeAgent
|
16 |
from smolagents.gradio_ui import GradioUI, stream_to_gradio
|
17 |
|
18 |
+
from e2bqwen import E2BVisionAgent, QwenVLAPIModel, get_agent_summary_erase_images
|
19 |
|
20 |
load_dotenv(override=True)
|
21 |
|
|
|
165 |
<style>
|
166 |
@import url('https://fonts.googleapis.com/css2?family=Oxanium:[email protected]&display=swap');
|
167 |
</style>
|
168 |
+
<h1 style="color:var(--color-accent);margin:0;">Open Computer Agent<h1>
|
169 |
+
<h3 style="color:var(--color-accent);margin:0;">Powered by [smolagents](https://github.com/huggingface/smolagents)<h3>
|
170 |
<div class="sandbox-container" style="margin:0;">
|
171 |
<div class="status-bar">
|
172 |
<div class="status-indicator {status_class}"></div>
|
|
|
429 |
)
|
430 |
)
|
431 |
|
432 |
+
|
433 |
def extract_browser_uuid(js_uuid):
|
434 |
print(f"[BROWSER] Got browser UUID from JS: {js_uuid}")
|
435 |
return js_uuid
|
|
|
527 |
# THIS ERASES IMAGES FROM AGENT MEMORY, USE WITH CAUTION
|
528 |
if consent_storage:
|
529 |
summary = get_agent_summary_erase_images(session_state["agent"])
|
530 |
+
save_final_status(data_dir, "completed", summary=summary)
|
531 |
yield stored_messages
|
532 |
|
533 |
except Exception as e:
|
|
|
607 |
label="Store task and agent trace?", value=True
|
608 |
)
|
609 |
|
610 |
+
gr.Markdown(
|
611 |
+
"""Type your task in the textbox above and click the button to start the agent. The first answer might take time to arrive."""
|
612 |
+
)
|
613 |
+
|
614 |
def apply_theme(minimalist_mode: bool):
|
615 |
if not minimalist_mode:
|
616 |
return """
|