Update app.py
Browse files
app.py
CHANGED
|
@@ -1,29 +1,38 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
import zipfile
|
| 3 |
-
from pathlib import Path
|
| 4 |
import os
|
|
|
|
| 5 |
|
| 6 |
-
# ===
|
| 7 |
BUNDLE_ZIP = "CodexReflex_HF_SpaceBundle_20260104.zip"
|
| 8 |
EXTRACT_DIR = "CodexReflexSystem"
|
| 9 |
|
| 10 |
# === EXTRACT ZIP BUNDLE ===
|
| 11 |
def extract_bundle():
|
| 12 |
if not Path(EXTRACT_DIR).exists():
|
| 13 |
-
|
| 14 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
extract_bundle()
|
| 17 |
|
| 18 |
-
# ===
|
| 19 |
def reflex_response(prompt: str) -> str:
|
|
|
|
| 20 |
return f"CodexReflex received: {prompt}"
|
| 21 |
|
|
|
|
| 22 |
iface = gr.Interface(
|
| 23 |
fn=reflex_response,
|
| 24 |
inputs="text",
|
| 25 |
outputs="text",
|
| 26 |
title="CodexReflex Visual Intelligence",
|
| 27 |
-
description="Enter a prompt to
|
| 28 |
)
|
|
|
|
| 29 |
iface.launch()
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import zipfile
|
|
|
|
| 3 |
import os
|
| 4 |
+
from pathlib import Path
|
| 5 |
|
| 6 |
+
# === CONFIG ===
|
| 7 |
BUNDLE_ZIP = "CodexReflex_HF_SpaceBundle_20260104.zip"
|
| 8 |
EXTRACT_DIR = "CodexReflexSystem"
|
| 9 |
|
| 10 |
# === EXTRACT ZIP BUNDLE ===
|
| 11 |
def extract_bundle():
|
| 12 |
if not Path(EXTRACT_DIR).exists():
|
| 13 |
+
if Path(BUNDLE_ZIP).exists():
|
| 14 |
+
with zipfile.ZipFile(BUNDLE_ZIP, "r") as z:
|
| 15 |
+
z.extractall(EXTRACT_DIR)
|
| 16 |
+
print(f"[+] Extracted bundle into: {EXTRACT_DIR}")
|
| 17 |
+
else:
|
| 18 |
+
print(f"[!] Bundle ZIP not found: {BUNDLE_ZIP}")
|
| 19 |
+
else:
|
| 20 |
+
print("[i] Bundle already extracted.")
|
| 21 |
|
| 22 |
extract_bundle()
|
| 23 |
|
| 24 |
+
# === REFLEX RESPONSE (placeholder) ===
|
| 25 |
def reflex_response(prompt: str) -> str:
|
| 26 |
+
# Replace this function body with a real call into your system if available
|
| 27 |
return f"CodexReflex received: {prompt}"
|
| 28 |
|
| 29 |
+
# === GRADIO UI ===
|
| 30 |
iface = gr.Interface(
|
| 31 |
fn=reflex_response,
|
| 32 |
inputs="text",
|
| 33 |
outputs="text",
|
| 34 |
title="CodexReflex Visual Intelligence",
|
| 35 |
+
description="Enter a prompt to engage the reflex system."
|
| 36 |
)
|
| 37 |
+
|
| 38 |
iface.launch()
|