Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Theme updates
Browse files
app.py
CHANGED
@@ -35,17 +35,25 @@ model = QwenVLAPIModel(
|
|
35 |
|
36 |
|
37 |
custom_css = """
|
38 |
-
|
39 |
-
background-
|
|
|
|
|
|
|
|
|
40 |
}
|
41 |
.sandbox-container {
|
42 |
position: relative;
|
43 |
width: 910px;
|
44 |
-
height: 800px;
|
45 |
overflow: hidden;
|
46 |
margin: auto;
|
47 |
}
|
48 |
-
|
|
|
|
|
|
|
|
|
|
|
49 |
.sandbox-frame {
|
50 |
position: absolute;
|
51 |
top: 0;
|
@@ -65,7 +73,7 @@ custom_css = """
|
|
65 |
border: 4px solid #444444;
|
66 |
transform-origin: 0 0;
|
67 |
}
|
68 |
-
.
|
69 |
/* top: 73px; */
|
70 |
top: 99px;
|
71 |
/* left: 74px; */
|
@@ -76,7 +84,7 @@ custom_css = """
|
|
76 |
/* transform: scale(0.59); */
|
77 |
}
|
78 |
.minimal .sandbox-iframe {
|
79 |
-
transform: scale(0.
|
80 |
}
|
81 |
|
82 |
/* Colored label for task textbox */
|
@@ -88,29 +96,31 @@ custom_css = """
|
|
88 |
/* Status indicator light */
|
89 |
.status-bar {
|
90 |
display: flex;
|
91 |
-
position: absolute;
|
92 |
-
bottom: 86px;
|
93 |
-
left: 355px;
|
94 |
flex-direction: row;
|
95 |
align-items: center;
|
96 |
flex-align:center;
|
97 |
z-index: 100;
|
98 |
}
|
99 |
-
|
|
|
|
|
|
|
|
|
100 |
.status-indicator {
|
101 |
-
width:
|
102 |
-
height:
|
103 |
border-radius: 50%;
|
104 |
}
|
105 |
|
106 |
.status-text {
|
107 |
font-size: 16px;
|
108 |
font-weight: bold;
|
109 |
-
color: #fed244;
|
110 |
padding: 0 10px;
|
111 |
text-shadow: none;
|
112 |
}
|
113 |
-
|
|
|
|
|
114 |
.status-interactive {
|
115 |
background-color: #2ecc71;
|
116 |
animation: blink 2s infinite;
|
@@ -296,8 +306,16 @@ function() {
|
|
296 |
const btn = document.getElementById('refresh-log-btn');
|
297 |
if (btn) btn.click();
|
298 |
}, 5000);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
299 |
}
|
300 |
"""
|
|
|
301 |
def write_to_console_log(log_file_path, message):
|
302 |
"""
|
303 |
Appends a message to the specified log file with a newline character.
|
@@ -544,9 +562,10 @@ class EnrichedGradioUI(GradioUI):
|
|
544 |
finally:
|
545 |
upload_to_hf_and_remove(data_dir)
|
546 |
|
|
|
547 |
|
548 |
# Create a Gradio app with Blocks
|
549 |
-
with gr.Blocks(css=custom_css, js=custom_js, fill_width=True) as demo:
|
550 |
#Storing session hash in a state variable
|
551 |
session_hash_state = gr.State(None)
|
552 |
|
@@ -593,7 +612,6 @@ with gr.Blocks(css=custom_css, js=custom_js, fill_width=True) as demo:
|
|
593 |
|
594 |
update_btn = gr.Button("Let's go!", variant="primary")
|
595 |
theme_checkbox = gr.Checkbox(label="Cyberpunk Mode", value=True)
|
596 |
-
cancel_btn = gr.Button("Interrupt running agent")
|
597 |
|
598 |
chatbot_display = gr.Chatbot(
|
599 |
label="Agent's execution logs",
|
@@ -648,13 +666,6 @@ with gr.Blocks(css=custom_css, js=custom_js, fill_width=True) as demo:
|
|
648 |
inputs=[theme_checkbox],
|
649 |
outputs=sandbox_html
|
650 |
)
|
651 |
-
cancel_btn.click(fn=(lambda x: x), cancels=[view_only_event])
|
652 |
-
|
653 |
-
demo.load(
|
654 |
-
fn=initialize_session,
|
655 |
-
inputs=[is_interactive],
|
656 |
-
outputs=[sandbox_html, session_hash_state]
|
657 |
-
)
|
658 |
|
659 |
theme_checkbox.change(
|
660 |
fn=update_html,
|
@@ -662,6 +673,11 @@ with gr.Blocks(css=custom_css, js=custom_js, fill_width=True) as demo:
|
|
662 |
outputs=[sandbox_html]
|
663 |
)
|
664 |
|
|
|
|
|
|
|
|
|
|
|
665 |
|
666 |
# Launch the app
|
667 |
if __name__ == "__main__":
|
|
|
35 |
|
36 |
|
37 |
custom_css = """
|
38 |
+
:root {
|
39 |
+
--body-background-fill: black!important;
|
40 |
+
--background-fill-secondary: #55221b!important;
|
41 |
+
--block-background-fill: black!important;
|
42 |
+
--body-text-color: #f59e0b!important;
|
43 |
+
--block-text-color: #f59e0b!important;
|
44 |
}
|
45 |
.sandbox-container {
|
46 |
position: relative;
|
47 |
width: 910px;
|
|
|
48 |
overflow: hidden;
|
49 |
margin: auto;
|
50 |
}
|
51 |
+
.cyberpunk {
|
52 |
+
height: 800px;
|
53 |
+
}
|
54 |
+
.minimal {
|
55 |
+
height: 700px;
|
56 |
+
}
|
57 |
.sandbox-frame {
|
58 |
position: absolute;
|
59 |
top: 0;
|
|
|
73 |
border: 4px solid #444444;
|
74 |
transform-origin: 0 0;
|
75 |
}
|
76 |
+
.cyberpunk .sandbox-iframe, .bsod-image {
|
77 |
/* top: 73px; */
|
78 |
top: 99px;
|
79 |
/* left: 74px; */
|
|
|
84 |
/* transform: scale(0.59); */
|
85 |
}
|
86 |
.minimal .sandbox-iframe {
|
87 |
+
transform: scale(0.65);
|
88 |
}
|
89 |
|
90 |
/* Colored label for task textbox */
|
|
|
96 |
/* Status indicator light */
|
97 |
.status-bar {
|
98 |
display: flex;
|
|
|
|
|
|
|
99 |
flex-direction: row;
|
100 |
align-items: center;
|
101 |
flex-align:center;
|
102 |
z-index: 100;
|
103 |
}
|
104 |
+
.cyberpunk .status-bar {
|
105 |
+
position: absolute;
|
106 |
+
bottom: 86px;
|
107 |
+
left: 355px;
|
108 |
+
}
|
109 |
.status-indicator {
|
110 |
+
width: 15px;
|
111 |
+
height: 15px;
|
112 |
border-radius: 50%;
|
113 |
}
|
114 |
|
115 |
.status-text {
|
116 |
font-size: 16px;
|
117 |
font-weight: bold;
|
|
|
118 |
padding: 0 10px;
|
119 |
text-shadow: none;
|
120 |
}
|
121 |
+
.cyberpunk .status-text {
|
122 |
+
color: #fed244;
|
123 |
+
}
|
124 |
.status-interactive {
|
125 |
background-color: #2ecc71;
|
126 |
animation: blink 2s infinite;
|
|
|
306 |
const btn = document.getElementById('refresh-log-btn');
|
307 |
if (btn) btn.click();
|
308 |
}, 5000);
|
309 |
+
|
310 |
+
// Force dark mode
|
311 |
+
const params = new URLSearchParams(window.location.search);
|
312 |
+
if (!params.has('__theme')) {
|
313 |
+
params.set('__theme', 'dark');
|
314 |
+
window.location.search = params.toString();
|
315 |
+
}
|
316 |
}
|
317 |
"""
|
318 |
+
|
319 |
def write_to_console_log(log_file_path, message):
|
320 |
"""
|
321 |
Appends a message to the specified log file with a newline character.
|
|
|
562 |
finally:
|
563 |
upload_to_hf_and_remove(data_dir)
|
564 |
|
565 |
+
theme = gr.themes.Default(primary_hue="amber", secondary_hue="blue")
|
566 |
|
567 |
# Create a Gradio app with Blocks
|
568 |
+
with gr.Blocks(theme=theme, css=custom_css, js=custom_js, fill_width=True) as demo:
|
569 |
#Storing session hash in a state variable
|
570 |
session_hash_state = gr.State(None)
|
571 |
|
|
|
612 |
|
613 |
update_btn = gr.Button("Let's go!", variant="primary")
|
614 |
theme_checkbox = gr.Checkbox(label="Cyberpunk Mode", value=True)
|
|
|
615 |
|
616 |
chatbot_display = gr.Chatbot(
|
617 |
label="Agent's execution logs",
|
|
|
666 |
inputs=[theme_checkbox],
|
667 |
outputs=sandbox_html
|
668 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
669 |
|
670 |
theme_checkbox.change(
|
671 |
fn=update_html,
|
|
|
673 |
outputs=[sandbox_html]
|
674 |
)
|
675 |
|
676 |
+
demo.load(
|
677 |
+
fn=initialize_session,
|
678 |
+
inputs=[is_interactive],
|
679 |
+
outputs=[sandbox_html, session_hash_state],
|
680 |
+
)
|
681 |
|
682 |
# Launch the app
|
683 |
if __name__ == "__main__":
|