Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,31 +1,24 @@
|
|
| 1 |
-
import os
|
| 2 |
import zipfile
|
| 3 |
-
import shutil
|
| 4 |
from pathlib import Path
|
| 5 |
-
|
| 6 |
-
# Optional: Gradio import if using UI
|
| 7 |
import gradio as gr
|
| 8 |
|
| 9 |
# === CONFIGURATION ===
|
| 10 |
BUNDLE_ZIP = "CodexReflex_HF_SpaceBundle_20260104.zip"
|
| 11 |
EXTRACT_DIR = "CodexReflexSystem"
|
| 12 |
-
BOOT_SCRIPT = "main.py" # Replace if different
|
| 13 |
|
| 14 |
-
# ===
|
| 15 |
def extract_system_bundle():
|
| 16 |
if not Path(EXTRACT_DIR).exists():
|
| 17 |
with zipfile.ZipFile(BUNDLE_ZIP, 'r') as zip_ref:
|
| 18 |
zip_ref.extractall(EXTRACT_DIR)
|
| 19 |
-
print(f"[+] Extracted system into: {EXTRACT_DIR}")
|
| 20 |
-
else:
|
| 21 |
-
print(f"[i] System already extracted.")
|
| 22 |
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
|
|
|
|
|
|
|
|
|
| 27 |
|
| 28 |
-
# ===
|
| 29 |
-
|
| 30 |
-
extract_system_bundle()
|
| 31 |
-
run_system()
|
|
|
|
|
|
|
| 1 |
import zipfile
|
|
|
|
| 2 |
from pathlib import Path
|
|
|
|
|
|
|
| 3 |
import gradio as gr
|
| 4 |
|
| 5 |
# === CONFIGURATION ===
|
| 6 |
BUNDLE_ZIP = "CodexReflex_HF_SpaceBundle_20260104.zip"
|
| 7 |
EXTRACT_DIR = "CodexReflexSystem"
|
|
|
|
| 8 |
|
| 9 |
+
# === SYSTEM: Extract and Load ===
|
| 10 |
def extract_system_bundle():
|
| 11 |
if not Path(EXTRACT_DIR).exists():
|
| 12 |
with zipfile.ZipFile(BUNDLE_ZIP, 'r') as zip_ref:
|
| 13 |
zip_ref.extractall(EXTRACT_DIR)
|
|
|
|
|
|
|
|
|
|
| 14 |
|
| 15 |
+
extract_system_bundle()
|
| 16 |
+
|
| 17 |
+
# === Example: Minimal Gradio Interface ===
|
| 18 |
+
def run_logic(input_text):
|
| 19 |
+
return f"[Codex Reflex]: You said: {input_text}"
|
| 20 |
+
|
| 21 |
+
iface = gr.Interface(fn=run_logic, inputs="text", outputs="text", title="Codex Reflex Test")
|
| 22 |
|
| 23 |
+
# === Expose Interface ===
|
| 24 |
+
iface.launch()
|
|
|
|
|
|