Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Updatee dataset
Browse files
app.py
CHANGED
@@ -65,7 +65,7 @@ custom_css = """
|
|
65 |
/* Colored label for task textbox */
|
66 |
.primary-color-label label span {
|
67 |
font-weight: bold;
|
68 |
-
color: var(--
|
69 |
}
|
70 |
|
71 |
/* Status indicator light */
|
@@ -209,11 +209,11 @@ custom_js = """function() {
|
|
209 |
if (iframe && bsod) {
|
210 |
iframe.style.display = 'none';
|
211 |
bsod.style.display = 'block';
|
212 |
-
|
213 |
// Update status indicator
|
214 |
const statusIndicator = document.querySelector('.status-indicator');
|
215 |
const statusTextElem = document.querySelector('.status-text');
|
216 |
-
|
217 |
if (statusIndicator) {
|
218 |
statusIndicator.className = 'status-indicator status-error';
|
219 |
}
|
@@ -312,7 +312,7 @@ def write_to_console_log(log_file_path, message):
|
|
312 |
|
313 |
def upload_to_hf_and_remove(folder_path):
|
314 |
|
315 |
-
repo_id = "
|
316 |
try:
|
317 |
folder_name = os.path.basename(os.path.normpath(folder_path))
|
318 |
|
@@ -536,14 +536,15 @@ class EnrichedGradioUI(GradioUI):
|
|
536 |
finally:
|
537 |
upload_to_hf_and_remove(data_dir)
|
538 |
|
539 |
-
theme = gr.themes.Default(font=["sans-serif"], primary_hue="amber", secondary_hue="blue")
|
540 |
|
541 |
# Create a Gradio app with Blocks
|
542 |
with gr.Blocks(theme=theme, css=custom_css, js=custom_js, fill_width=True) as demo:
|
543 |
#Storing session hash in a state variable
|
544 |
session_hash_state = gr.State(None)
|
545 |
|
546 |
-
gr.
|
|
|
547 |
|
548 |
with gr.Row():
|
549 |
sandbox_html = gr.HTML(
|
@@ -585,21 +586,24 @@ with gr.Blocks(theme=theme, css=custom_css, js=custom_js, fill_width=True) as de
|
|
585 |
|
586 |
update_btn = gr.Button("Let's go!", variant="primary")
|
587 |
|
588 |
-
|
589 |
|
590 |
-
def apply_theme(
|
591 |
-
if
|
592 |
return """
|
593 |
<style>
|
594 |
:root {
|
595 |
--body-background-fill: black!important;
|
596 |
--body-text-color: #f59e0b!important;
|
597 |
--block-text-color: #f59e0b!important;
|
598 |
-
--
|
599 |
}
|
600 |
.sandbox-frame {
|
601 |
display: block!important;
|
602 |
}
|
|
|
|
|
|
|
603 |
|
604 |
.sandbox-iframe, .bsod-image {
|
605 |
/* top: 73px; */
|
@@ -636,9 +640,9 @@ with gr.Blocks(theme=theme, css=custom_css, js=custom_js, fill_width=True) as de
|
|
636 |
|
637 |
# Hidden HTML element to inject CSS dynamically
|
638 |
theme_styles = gr.HTML(apply_theme(False), visible=False)
|
639 |
-
|
640 |
fn=apply_theme,
|
641 |
-
inputs=[
|
642 |
outputs=[theme_styles]
|
643 |
)
|
644 |
|
@@ -654,7 +658,7 @@ with gr.Blocks(theme=theme, css=custom_css, js=custom_js, fill_width=True) as de
|
|
654 |
None,
|
655 |
"https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/smolagents/mascot_smol.png",
|
656 |
),
|
657 |
-
|
658 |
scale=1,
|
659 |
)
|
660 |
|
|
|
65 |
/* Colored label for task textbox */
|
66 |
.primary-color-label label span {
|
67 |
font-weight: bold;
|
68 |
+
color: var(--color-accent);
|
69 |
}
|
70 |
|
71 |
/* Status indicator light */
|
|
|
209 |
if (iframe && bsod) {
|
210 |
iframe.style.display = 'none';
|
211 |
bsod.style.display = 'block';
|
212 |
+
|
213 |
// Update status indicator
|
214 |
const statusIndicator = document.querySelector('.status-indicator');
|
215 |
const statusTextElem = document.querySelector('.status-text');
|
216 |
+
|
217 |
if (statusIndicator) {
|
218 |
statusIndicator.className = 'status-indicator status-error';
|
219 |
}
|
|
|
312 |
|
313 |
def upload_to_hf_and_remove(folder_path):
|
314 |
|
315 |
+
repo_id = "smolagents/computer-agent-logs"
|
316 |
try:
|
317 |
folder_name = os.path.basename(os.path.normpath(folder_path))
|
318 |
|
|
|
536 |
finally:
|
537 |
upload_to_hf_and_remove(data_dir)
|
538 |
|
539 |
+
theme = gr.themes.Default(font=["Oxanium", "sans-serif"], primary_hue="amber", secondary_hue="blue")
|
540 |
|
541 |
# Create a Gradio app with Blocks
|
542 |
with gr.Blocks(theme=theme, css=custom_css, js=custom_js, fill_width=True) as demo:
|
543 |
#Storing session hash in a state variable
|
544 |
session_hash_state = gr.State(None)
|
545 |
|
546 |
+
gr.HTML("""<h1 style="color:var(--color-accent);">Computer Agent - Input your task and run your personal assistant!<h1>
|
547 |
+
<h5>Input your task in the left sidebar to see our agent get to work.</h5>""")
|
548 |
|
549 |
with gr.Row():
|
550 |
sandbox_html = gr.HTML(
|
|
|
586 |
|
587 |
update_btn = gr.Button("Let's go!", variant="primary")
|
588 |
|
589 |
+
minimalist_toggle = gr.Checkbox(label="Minimalist mode - no frame", value=False)
|
590 |
|
591 |
+
def apply_theme(minimalist_mode: bool):
|
592 |
+
if not minimalist_mode:
|
593 |
return """
|
594 |
<style>
|
595 |
:root {
|
596 |
--body-background-fill: black!important;
|
597 |
--body-text-color: #f59e0b!important;
|
598 |
--block-text-color: #f59e0b!important;
|
599 |
+
--color-accent: #00b8ff!important;
|
600 |
}
|
601 |
.sandbox-frame {
|
602 |
display: block!important;
|
603 |
}
|
604 |
+
.body {
|
605 |
+
color: #00b8ff!important;
|
606 |
+
}
|
607 |
|
608 |
.sandbox-iframe, .bsod-image {
|
609 |
/* top: 73px; */
|
|
|
640 |
|
641 |
# Hidden HTML element to inject CSS dynamically
|
642 |
theme_styles = gr.HTML(apply_theme(False), visible=False)
|
643 |
+
minimalist_toggle.change(
|
644 |
fn=apply_theme,
|
645 |
+
inputs=[minimalist_toggle],
|
646 |
outputs=[theme_styles]
|
647 |
)
|
648 |
|
|
|
658 |
None,
|
659 |
"https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/smolagents/mascot_smol.png",
|
660 |
),
|
661 |
+
resizable=True,
|
662 |
scale=1,
|
663 |
)
|
664 |
|