Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -7,7 +7,6 @@ os.environ["MODEL_ID"] = "groq/openai/gpt-oss-20b"
|
|
| 7 |
|
| 8 |
import gradio as gr
|
| 9 |
import time
|
| 10 |
-
import json
|
| 11 |
from litellm import completion
|
| 12 |
|
| 13 |
# --- 📁 THE SECURE VAULT STORAGE SYSTEM ---
|
|
@@ -75,9 +74,7 @@ def run_single_scan_step(current_index, current_xp, logs_history):
|
|
| 75 |
</div>
|
| 76 |
"""
|
| 77 |
|
| 78 |
-
# Generate interactive script instructions for our live 3D visual monitor canvas
|
| 79 |
visual_update = f"""<div style='display:none;' id='telemetry' data-color='{task['color']}' data-mode='{task['mode']}'></div>"""
|
| 80 |
-
|
| 81 |
new_log_entry = f"[{timestamp}] 🛰️ {task['name']}: {result}\n"
|
| 82 |
updated_logs = new_log_entry + (logs_history if logs_history else "")
|
| 83 |
next_index = idx + 1
|
|
@@ -98,8 +95,8 @@ with gr.Blocks(theme=gr.themes.Monochrome(), title="AIXYZone Sentinel Core") as
|
|
| 98 |
task_index_state = gr.State(value=0)
|
| 99 |
total_xp_state = gr.State(value=0)
|
| 100 |
|
| 101 |
-
# 🔮 INTERACTIVE 3D TELEMETRY MONITOR CANVAS
|
| 102 |
-
|
| 103 |
<div style="background:#000; border:2px solid #222; border-radius:15px; padding:10px; margin-bottom:15px;">
|
| 104 |
<p style="color:#666; font-size:11px; margin:0 0 5px 5px; font-family:monospace;">🛰️ LIVE MATRIX MONITOR 3D VISUALIZATION</p>
|
| 105 |
<canvas id="sentinelCanvas" style="width:100%; height:200px; background:#050505; border-radius:8px; display:block;"></canvas>
|
|
@@ -168,7 +165,6 @@ with gr.Blocks(theme=gr.themes.Monochrome(), title="AIXYZone Sentinel Core") as
|
|
| 168 |
</script>
|
| 169 |
""")
|
| 170 |
|
| 171 |
-
# Target placeholder hidden element to bridge python data streams straight into the front-end script
|
| 172 |
telemetry_bridge = gr.HTML("<div style='display:none;' id='telemetry' data-color='#00ffcc' data-mode='particles'></div>")
|
| 173 |
|
| 174 |
with gr.Row():
|
|
@@ -206,7 +202,6 @@ with gr.Blocks(theme=gr.themes.Monochrome(), title="AIXYZone Sentinel Core") as
|
|
| 206 |
* State Machine: Gradio 6 Standard Native Track
|
| 207 |
""")
|
| 208 |
|
| 209 |
-
# --- 🛰️ EVENT ACTION CONNECTIONS ---
|
| 210 |
# Manual Single Trigger Configuration
|
| 211 |
start_btn.click(
|
| 212 |
fn=run_single_scan_step,
|
|
@@ -214,8 +209,18 @@ with gr.Blocks(theme=gr.themes.Monochrome(), title="AIXYZone Sentinel Core") as
|
|
| 214 |
outputs=[task_index_state, total_xp_state, live_log, xp_display, download_file, telemetry_bridge]
|
| 215 |
)
|
| 216 |
|
| 217 |
-
# Auto-Pilot Timer Engine Configuration (
|
| 218 |
auto_timer = gr.Timer(value=6, active=False)
|
| 219 |
auto_timer.tick(
|
| 220 |
fn=run_single_scan_step,
|
| 221 |
inputs=[task_index_state, total_xp_state, live_log],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
import gradio as gr
|
| 9 |
import time
|
|
|
|
| 10 |
from litellm import completion
|
| 11 |
|
| 12 |
# --- 📁 THE SECURE VAULT STORAGE SYSTEM ---
|
|
|
|
| 74 |
</div>
|
| 75 |
"""
|
| 76 |
|
|
|
|
| 77 |
visual_update = f"""<div style='display:none;' id='telemetry' data-color='{task['color']}' data-mode='{task['mode']}'></div>"""
|
|
|
|
| 78 |
new_log_entry = f"[{timestamp}] 🛰️ {task['name']}: {result}\n"
|
| 79 |
updated_logs = new_log_entry + (logs_history if logs_history else "")
|
| 80 |
next_index = idx + 1
|
|
|
|
| 95 |
task_index_state = gr.State(value=0)
|
| 96 |
total_xp_state = gr.State(value=0)
|
| 97 |
|
| 98 |
+
# 🔮 INTERACTIVE 3D TELEMETRY MONITOR CANVAS
|
| 99 |
+
gr.HTML("""
|
| 100 |
<div style="background:#000; border:2px solid #222; border-radius:15px; padding:10px; margin-bottom:15px;">
|
| 101 |
<p style="color:#666; font-size:11px; margin:0 0 5px 5px; font-family:monospace;">🛰️ LIVE MATRIX MONITOR 3D VISUALIZATION</p>
|
| 102 |
<canvas id="sentinelCanvas" style="width:100%; height:200px; background:#050505; border-radius:8px; display:block;"></canvas>
|
|
|
|
| 165 |
</script>
|
| 166 |
""")
|
| 167 |
|
|
|
|
| 168 |
telemetry_bridge = gr.HTML("<div style='display:none;' id='telemetry' data-color='#00ffcc' data-mode='particles'></div>")
|
| 169 |
|
| 170 |
with gr.Row():
|
|
|
|
| 202 |
* State Machine: Gradio 6 Standard Native Track
|
| 203 |
""")
|
| 204 |
|
|
|
|
| 205 |
# Manual Single Trigger Configuration
|
| 206 |
start_btn.click(
|
| 207 |
fn=run_single_scan_step,
|
|
|
|
| 209 |
outputs=[task_index_state, total_xp_state, live_log, xp_display, download_file, telemetry_bridge]
|
| 210 |
)
|
| 211 |
|
| 212 |
+
# Auto-Pilot Timer Engine Configuration (Safely closed parenting loop)
|
| 213 |
auto_timer = gr.Timer(value=6, active=False)
|
| 214 |
auto_timer.tick(
|
| 215 |
fn=run_single_scan_step,
|
| 216 |
inputs=[task_index_state, total_xp_state, live_log],
|
| 217 |
+
outputs=[task_index_state, total_xp_state, live_log, xp_display, download_file, telemetry_bridge]
|
| 218 |
+
)
|
| 219 |
+
|
| 220 |
+
# Link the Auto-Pilot toggle checkbox
|
| 221 |
+
autopilot_switch.change(
|
| 222 |
+
fn=handle_autopilot_toggle,
|
| 223 |
+
inputs=[autopilot_switch],
|
| 224 |
+
outputs=[start_btn, auto_timer]
|
| 225 |
+
)
|
| 226 |
+
|