Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,45 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
-
import base64
|
| 3 |
|
| 4 |
-
#
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
#
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 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)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|