Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,49 +1,61 @@
|
|
| 1 |
-
import
|
|
|
|
| 2 |
import time
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
from agents import nano_patrol_agent
|
| 4 |
|
| 5 |
-
# --- THE SENTINEL
|
| 6 |
def run_autonomous_scrub(iterations):
|
| 7 |
"""
|
| 8 |
Triggers the agent to scan and heal the BCI spectrum autonomously.
|
| 9 |
"""
|
| 10 |
history = []
|
| 11 |
-
|
| 12 |
-
bci_range = "3.4GHz - 4.2GHz"
|
| 13 |
|
| 14 |
for i in range(int(iterations)):
|
| 15 |
-
prompt =
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
|
| 17 |
# The agent 'spots' and 'heals' on its own
|
| 18 |
result = nano_patrol_agent.run(prompt)
|
| 19 |
|
| 20 |
timestamp = time.strftime("%H:%M:%S")
|
| 21 |
-
history.append(f"[{timestamp}] SENTINEL
|
| 22 |
|
| 23 |
-
#
|
| 24 |
yield "\n\n".join(history[::-1])
|
| 25 |
-
time.sleep(
|
| 26 |
|
| 27 |
# --- UI DESIGN ---
|
| 28 |
with gr.Blocks(title="AIXYZone - BCI Nano Sentinel") as demo:
|
| 29 |
-
gr.Markdown("#
|
| 30 |
-
gr.Markdown("
|
| 31 |
|
| 32 |
with gr.Row():
|
| 33 |
with gr.Column():
|
| 34 |
-
sweep_count = gr.Slider(minimum=1, maximum=
|
| 35 |
btn_sentinel = gr.Button("🛰️ ACTIVATE SENTINEL SCAN", variant="primary")
|
| 36 |
-
gr.Info("
|
| 37 |
|
| 38 |
with gr.Column():
|
| 39 |
sentinel_log = gr.Textbox(
|
| 40 |
-
label="Live
|
| 41 |
-
lines=
|
| 42 |
-
|
| 43 |
-
placeholder="Waiting for Sentinel Activation..."
|
| 44 |
)
|
| 45 |
|
| 46 |
-
# Trigger the autonomous logic
|
| 47 |
btn_sentinel.click(
|
| 48 |
fn=run_autonomous_scrub,
|
| 49 |
inputs=[sweep_count],
|
|
|
|
| 1 |
+
import sys
|
| 2 |
+
import transformers.utils
|
| 3 |
import time
|
| 4 |
+
import gradio as gr
|
| 5 |
+
|
| 6 |
+
# --- THE HOTFIX: Environment Healing ---
|
| 7 |
+
if not hasattr(transformers.utils, 'is_offline_mode'):
|
| 8 |
+
def is_offline_mode():
|
| 9 |
+
return False
|
| 10 |
+
transformers.utils.is_offline_mode = is_offline_mode
|
| 11 |
+
print("XYZ Safe Zone: Environment Healed (is_offline_mode injected)")
|
| 12 |
+
|
| 13 |
+
# Now we can safely import your agent
|
| 14 |
from agents import nano_patrol_agent
|
| 15 |
|
| 16 |
+
# --- THE SENTINEL LOGIC ---
|
| 17 |
def run_autonomous_scrub(iterations):
|
| 18 |
"""
|
| 19 |
Triggers the agent to scan and heal the BCI spectrum autonomously.
|
| 20 |
"""
|
| 21 |
history = []
|
| 22 |
+
bci_range = "3.4GHz - 4.2GHz (BCI/Neural Feedback)"
|
|
|
|
| 23 |
|
| 24 |
for i in range(int(iterations)):
|
| 25 |
+
prompt = (
|
| 26 |
+
f"ACT AS BCI SENTINEL: Scan the {bci_range} range. "
|
| 27 |
+
"Identify unsupervised amateur loops or 'old mess' agentic anomalies. "
|
| 28 |
+
"Neutralize them and generate a Healed Nano Node JSON."
|
| 29 |
+
)
|
| 30 |
|
| 31 |
# The agent 'spots' and 'heals' on its own
|
| 32 |
result = nano_patrol_agent.run(prompt)
|
| 33 |
|
| 34 |
timestamp = time.strftime("%H:%M:%S")
|
| 35 |
+
history.append(f"[{timestamp}] 🛰️ SENTINEL ACTION: {result}")
|
| 36 |
|
| 37 |
+
# Yield allows the UI to update LIVE on your iPhone
|
| 38 |
yield "\n\n".join(history[::-1])
|
| 39 |
+
time.sleep(1)
|
| 40 |
|
| 41 |
# --- UI DESIGN ---
|
| 42 |
with gr.Blocks(title="AIXYZone - BCI Nano Sentinel") as demo:
|
| 43 |
+
gr.Markdown("# 🛡️ AIXYZone: Autonomous BCI Sentinel")
|
| 44 |
+
gr.Markdown("Focused on clearing the 'Old Mess' and amateur BCI abuse loops.")
|
| 45 |
|
| 46 |
with gr.Row():
|
| 47 |
with gr.Column():
|
| 48 |
+
sweep_count = gr.Slider(minimum=1, maximum=50, value=10, step=1, label="Autonomous Scrub Depth (Sweeps)")
|
| 49 |
btn_sentinel = gr.Button("🛰️ ACTIVATE SENTINEL SCAN", variant="primary")
|
| 50 |
+
gr.Info("Micromanaging: 3.4GHz - 4.2GHz Neural Ranges")
|
| 51 |
|
| 52 |
with gr.Column():
|
| 53 |
sentinel_log = gr.Textbox(
|
| 54 |
+
label="Live Healing Stream",
|
| 55 |
+
lines=25,
|
| 56 |
+
placeholder="Sentinel Standby... Waiting for activation."
|
|
|
|
| 57 |
)
|
| 58 |
|
|
|
|
| 59 |
btn_sentinel.click(
|
| 60 |
fn=run_autonomous_scrub,
|
| 61 |
inputs=[sweep_count],
|