Miquel Farré
commited on
Commit
·
e6b8427
1
Parent(s):
33a2911
adding examples + fixing reset after bsod
Browse files
app.py
CHANGED
|
@@ -188,6 +188,23 @@ function() {
|
|
| 188 |
}
|
| 189 |
}
|
| 190 |
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 191 |
|
| 192 |
// Function to monitor for error messages
|
| 193 |
const monitorForErrors = function() {
|
|
@@ -215,6 +232,9 @@ function() {
|
|
| 215 |
// Also monitor for errors after button clicks
|
| 216 |
document.addEventListener('click', function(e) {
|
| 217 |
if (e.target.tagName === 'BUTTON') {
|
|
|
|
|
|
|
|
|
|
| 218 |
setTimeout(monitorForErrors, 3000);
|
| 219 |
}
|
| 220 |
});
|
|
@@ -412,9 +432,23 @@ with gr.Blocks(css=custom_css, js=custom_js) as demo:
|
|
| 412 |
# Text input for task
|
| 413 |
task_input = gr.Textbox(
|
| 414 |
value="Find picture of cute puppies",
|
| 415 |
-
label="Enter your command"
|
| 416 |
)
|
| 417 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 418 |
# Results output
|
| 419 |
results_output = gr.Textbox(
|
| 420 |
label="Results",
|
|
|
|
| 188 |
}
|
| 189 |
}
|
| 190 |
};
|
| 191 |
+
|
| 192 |
+
const resetBSOD = function() {
|
| 193 |
+
console.log("Resetting BSOD display");
|
| 194 |
+
const iframe = document.getElementById('sandbox-iframe');
|
| 195 |
+
const bsod = document.getElementById('bsod-image');
|
| 196 |
+
|
| 197 |
+
if (iframe && bsod) {
|
| 198 |
+
if (bsod.style.display === 'block') {
|
| 199 |
+
// BSOD is currently showing, reset it
|
| 200 |
+
iframe.style.display = 'block';
|
| 201 |
+
bsod.style.display = 'none';
|
| 202 |
+
console.log("BSOD reset complete");
|
| 203 |
+
return true; // Indicates reset was performed
|
| 204 |
+
}
|
| 205 |
+
}
|
| 206 |
+
return false; // No reset needed
|
| 207 |
+
};
|
| 208 |
|
| 209 |
// Function to monitor for error messages
|
| 210 |
const monitorForErrors = function() {
|
|
|
|
| 232 |
// Also monitor for errors after button clicks
|
| 233 |
document.addEventListener('click', function(e) {
|
| 234 |
if (e.target.tagName === 'BUTTON') {
|
| 235 |
+
if (e.target.innerText === "Let's go!") {
|
| 236 |
+
resetBSOD();
|
| 237 |
+
}
|
| 238 |
setTimeout(monitorForErrors, 3000);
|
| 239 |
}
|
| 240 |
});
|
|
|
|
| 432 |
# Text input for task
|
| 433 |
task_input = gr.Textbox(
|
| 434 |
value="Find picture of cute puppies",
|
| 435 |
+
label="Enter your command",
|
| 436 |
)
|
| 437 |
+
|
| 438 |
+
# Examples
|
| 439 |
+
gr.Examples(
|
| 440 |
+
examples=[
|
| 441 |
+
"Check the bike commute time between Boll and Bern",
|
| 442 |
+
"Open a text editor and write 'Hello World'",
|
| 443 |
+
"Create a simple drawing in paint",
|
| 444 |
+
"Distract me"
|
| 445 |
+
],
|
| 446 |
+
inputs = task_input,
|
| 447 |
+
label= "Example Tasks",
|
| 448 |
+
examples_per_page=4
|
| 449 |
+
)
|
| 450 |
+
|
| 451 |
+
|
| 452 |
# Results output
|
| 453 |
results_output = gr.Textbox(
|
| 454 |
label="Results",
|