PoetNameLife commited on
Commit
b449d6b
·
verified ·
1 Parent(s): ea2a7d9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -40
app.py CHANGED
@@ -1,58 +1,41 @@
1
  import sys
2
  import os
3
- import shutil
4
- import gc
5
- import time
6
  import gradio as gr
7
  import transformers.utils
8
 
9
- # --- 1. TOTAL STATE PURGE ---
10
- def total_purge():
11
- # Force Python to forget old, broken versions of your code
12
- modules_to_clear = ['agents', 'transformers', 'smolagents']
13
- for module in modules_to_clear:
14
- if module in sys.modules:
15
- del sys.modules[module]
16
- # Wipe local cache to clear "Payment Required" blocks
17
- cache_dir = os.path.expanduser("~/.cache/huggingface")
18
- if os.path.exists(cache_dir):
19
- shutil.rmtree(cache_dir, ignore_errors=True)
20
- gc.collect()
21
- print("XYZ System: Total State Purge Complete. Safe Zone Re-established.")
22
 
23
- total_purge()
24
 
25
- # --- 2. ENVIRONMENT HEALER (HOTFIX) ---
26
  if not hasattr(transformers.utils, 'is_offline_mode'):
27
  def is_offline_mode(): return False
28
  transformers.utils.is_offline_mode = is_offline_mode
29
 
30
- # --- 3. LOAD AGENT ---
31
  from agents import nano_patrol_agent
32
 
33
- # --- 4. SENTINEL LOGIC ---
34
- def run_autonomous_scrub(iterations):
35
  history = []
36
- bci_range = "3.4GHz - 4.2GHz (BCI/Neural Feedback)"
37
  for i in range(int(iterations)):
38
- prompt = f"ACT AS BCI SENTINEL: Scan {bci_range}. Neutralize loops and generate a Healed Nano Node JSON."
39
- result = nano_patrol_agent.run(prompt)
40
- timestamp = time.strftime("%H:%M:%S")
41
- history.append(f"[{timestamp}] 🛰️ SENTINEL ACTION: {result}")
42
- yield "\n\n".join(history[::-1])
43
- time.sleep(1)
44
-
45
- # --- 5. UI DESIGN ---
46
- with gr.Blocks(title="AIXYZone - BCI Nano Sentinel") as demo:
47
- gr.Markdown("# 🛡️ AIXYZone: Autonomous BCI Sentinel")
48
- with gr.Row():
49
- with gr.Column():
50
- sweep_count = gr.Slider(minimum=1, maximum=50, value=10, label="Autonomous Scrub Depth")
51
- btn_sentinel = gr.Button("🛰️ ACTIVATE SENTINEL SCAN", variant="primary")
52
- with gr.Column():
53
- sentinel_log = gr.Textbox(label="Live Healing Stream", lines=25)
54
-
55
- btn_sentinel.click(fn=run_autonomous_scrub, inputs=[sweep_count], outputs=[sentinel_log])
56
 
57
  if __name__ == "__main__":
58
  demo.launch()
 
1
  import sys
2
  import os
3
+ import psutil
 
 
4
  import gradio as gr
5
  import transformers.utils
6
 
7
+ # --- 1. SYSTEM ACTIVITY MONITOR ---
8
+ def log_real_activity():
9
+ process = psutil.Process(os.getpid())
10
+ print(f"--- 🛡️ AIXYZone HARDWARE REPORT ---")
11
+ print(f"Active Process ID: {os.getpid()}")
12
+ print(f"Real Memory Usage: {process.memory_info().rss / 1024 / 1024:.2f} MB")
13
+ print(f"System State: SOVEREIGN CONTROL ACTIVE")
14
+ print(f"----------------------------------", flush=True)
 
 
 
 
 
15
 
16
+ log_real_activity()
17
 
18
+ # --- 2. ENVIRONMENT HEALER ---
19
  if not hasattr(transformers.utils, 'is_offline_mode'):
20
  def is_offline_mode(): return False
21
  transformers.utils.is_offline_mode = is_offline_mode
22
 
 
23
  from agents import nano_patrol_agent
24
 
25
+ # --- 3. SENTINEL UI ---
26
+ def run_scrub(iterations):
27
  history = []
 
28
  for i in range(int(iterations)):
29
+ result = nano_patrol_agent.run("Scrub BCI spectrum for rogue loops.")
30
+ history.append(f"SENTINEL: {result}")
31
+ yield "\n\n".join(history[::-1])
32
+
33
+ with gr.Blocks() as demo:
34
+ gr.Markdown("# 🛡️ AIXYZone: Autonomous Sentinel")
35
+ sweep = gr.Slider(1, 10, value=3, label="Scrub Depth")
36
+ btn = gr.Button("ACTIVATE")
37
+ log = gr.Textbox(label="Live Stream")
38
+ btn.click(run_scrub, inputs=[sweep], outputs=[log])
 
 
 
 
 
 
 
 
39
 
40
  if __name__ == "__main__":
41
  demo.launch()