Spaces:
Paused
Paused
Create App.py
Browse files
App.py
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
import json
|
| 3 |
+
|
| 4 |
+
def safe_import(module_path, attr=None):
|
| 5 |
+
try:
|
| 6 |
+
module = __import__(module_path, fromlist=[attr] if attr else [])
|
| 7 |
+
return getattr(module, attr) if attr else module
|
| 8 |
+
except Exception:
|
| 9 |
+
return None
|
| 10 |
+
|
| 11 |
+
TIAWorker = safe_import("TIA.worker", "TIAWorker")
|
| 12 |
+
PrimeSchema = safe_import("citadel.primeSchema", "PrimeSchema")
|
| 13 |
+
HoloCommandCentre = safe_import("citadel.holo3d.ui.commandCentre", "CommandCentre")
|
| 14 |
+
|
| 15 |
+
def qgtnl_process(command):
|
| 16 |
+
result = {
|
| 17 |
+
"command": command,
|
| 18 |
+
"tia": None,
|
| 19 |
+
"lineage": None,
|
| 20 |
+
"status": "OK"
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
if TIAWorker:
|
| 24 |
+
try:
|
| 25 |
+
result["tia"] = TIAWorker().process(command)
|
| 26 |
+
except Exception as e:
|
| 27 |
+
result["tia"] = f"TIA error: {e}"
|
| 28 |
+
|
| 29 |
+
if PrimeSchema:
|
| 30 |
+
try:
|
| 31 |
+
result["lineage"] = PrimeSchema().summarize()
|
| 32 |
+
except Exception as e:
|
| 33 |
+
result["lineage"] = f"Lineage error: {e}"
|
| 34 |
+
|
| 35 |
+
return json.dumps(result, indent=2)
|
| 36 |
+
|
| 37 |
+
with gr.Blocks(css="body { background: black; color: cyan; }") as app:
|
| 38 |
+
gr.Markdown("# **QGTNL Command Centre**")
|
| 39 |
+
gr.Markdown("### Citadel • TIA • AION • ORACLE • Holo3D")
|
| 40 |
+
|
| 41 |
+
with gr.Row():
|
| 42 |
+
cmd = gr.Textbox(label="Command Input")
|
| 43 |
+
out = gr.Code(label="System Output")
|
| 44 |
+
|
| 45 |
+
run = gr.Button("Execute")
|
| 46 |
+
run.click(qgtnl_process, cmd, out)
|
| 47 |
+
|
| 48 |
+
gr.Markdown("---")
|
| 49 |
+
gr.Markdown("### Holo3D UI (if available)")
|
| 50 |
+
|
| 51 |
+
if HoloCommandCentre:
|
| 52 |
+
try:
|
| 53 |
+
html = HoloCommandCentre().render()
|
| 54 |
+
gr.HTML(html)
|
| 55 |
+
except:
|
| 56 |
+
gr.Markdown("Holo3D failed to load.")
|
| 57 |
+
|
| 58 |
+
app.launch()
|