LordXido commited on
Commit
5f3038a
·
verified ·
1 Parent(s): a962e65

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +38 -43
app.py CHANGED
@@ -1,45 +1,40 @@
 
 
 
1
  import gradio as gr
2
- import base64
3
 
4
- # ---------------------------------------------------------
5
- # Utility: Load static files (manifest + vislang diagram)
6
- # ---------------------------------------------------------
7
-
8
- MANIFEST_PATH = "Codex_TC2E_Beyond_SOTA_Manifest.pdf"
9
- VISLANG_PATH = "Codex_TC2E_Beyond_SOTA_VisLang.png"
10
-
11
- def load_file_as_base64(path):
12
- with open(path, "rb") as f:
13
- return base64.b64encode(f.read()).decode()
14
-
15
- manifest_data = load_file_as_base64(MANIFEST_PATH)
16
- vislang_data = load_file_as_base64(VISLANG_PATH)
17
-
18
- # ---------------------------------------------------------
19
- # Core TC²E Cognitive Simulation (Demo Logic)
20
- # ---------------------------------------------------------
21
-
22
- def run_simulation(intent):
23
- if not intent or intent.strip() == "":
24
- return "⚠️ Please enter an intent to run the TC²E cognition."
25
-
26
- trace = f"""
27
- # 🧠 Jarvis X — TC²E Cognitive Trace
28
-
29
- **Frame Budget:** 60 frames
30
- **Input Intent:** `{intent}`
31
-
32
- ---
33
-
34
- ### 🌀 Stage 1 — Ψ Intent Processing
35
- Intent embedded and normalized.
36
-
37
- ### 🧭 Stage 2 — Φ Planning Field
38
- Field populated with geometric affordances.
39
-
40
- ### 🛡 Stage 3 — Λ Constraint Gate
41
- All unsafe tool paths removed.
42
- Valid tool family: `[search, retrieve, compute, verify, summarize]`
43
-
44
- ### 🔧 Stage 4 — TC-ANN Tool Selection
45
- Selected Chain:
 
1
+ import os
2
+ import zipfile
3
+ from pathlib import Path
4
  import gradio as gr
 
5
 
6
+ # === CONFIGURATION ===
7
+ BUNDLE_ZIP = "Codex_TC2E_Beyond_SOTA_SystemBundle.zip"
8
+ EXTRACT_DIR = "CodexReflexSystem"
9
+ BOOT_SCRIPT = "main.py" # Ensure this file exists in your bundle
10
+
11
+ # === UNPACK SYSTEM ONCE ===
12
+ def extract_system_bundle():
13
+ if not Path(EXTRACT_DIR).exists():
14
+ with zipfile.ZipFile(BUNDLE_ZIP, 'r') as zip_ref:
15
+ zip_ref.extractall(EXTRACT_DIR)
16
+ print(f"[+] Extracted system into: {EXTRACT_DIR}")
17
+ else:
18
+ print("[i] System already extracted.")
19
+
20
+ # === RUN SYSTEM ===
21
+ def run_codex():
22
+ extract_system_bundle()
23
+ os.chdir(EXTRACT_DIR)
24
+ os.system(f"python {BOOT_SCRIPT}")
25
+
26
+ # === GRADIO UI WRAPPER ===
27
+ def launch_system():
28
+ run_codex()
29
+ return "Codex Reflex System executed."
30
+
31
+ iface = gr.Interface(fn=launch_system,
32
+ inputs=[],
33
+ outputs="text",
34
+ title="Codex Reflex Launcher",
35
+ description="Click to initialize and execute the CodexReflex system.")
36
+
37
+ # === ENTRYPOINT ===
38
+ if __name__ == "__main__":
39
+ extract_system_bundle()
40
+ iface.launch(debug=True)