Spaces:
Sleeping
Sleeping
File size: 1,165 Bytes
5f3038a 80a40b5 5f3038a |
1 2 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 |
import os
import zipfile
from pathlib import Path
import gradio as gr
# === CONFIGURATION ===
BUNDLE_ZIP = "Codex_TC2E_Beyond_SOTA_SystemBundle.zip"
EXTRACT_DIR = "CodexReflexSystem"
BOOT_SCRIPT = "main.py" # Ensure this file exists in your bundle
# === UNPACK SYSTEM ONCE ===
def extract_system_bundle():
if not Path(EXTRACT_DIR).exists():
with zipfile.ZipFile(BUNDLE_ZIP, 'r') as zip_ref:
zip_ref.extractall(EXTRACT_DIR)
print(f"[+] Extracted system into: {EXTRACT_DIR}")
else:
print("[i] System already extracted.")
# === RUN SYSTEM ===
def run_codex():
extract_system_bundle()
os.chdir(EXTRACT_DIR)
os.system(f"python {BOOT_SCRIPT}")
# === GRADIO UI WRAPPER ===
def launch_system():
run_codex()
return "Codex Reflex System executed."
iface = gr.Interface(fn=launch_system,
inputs=[],
outputs="text",
title="Codex Reflex Launcher",
description="Click to initialize and execute the CodexReflex system.")
# === ENTRYPOINT ===
if __name__ == "__main__":
extract_system_bundle()
iface.launch(debug=True) |