File size: 1,636 Bytes
8fdb8ad
 
 
 
5776437
8fdb8ad
5776437
160d185
5776437
3fe8de8
 
 
 
 
5776437
03a1032
3fe8de8
 
6006fe0
3fe8de8
 
 
6006fe0
 
3fe8de8
6006fe0
3fe8de8
6006fe0
03a1032
3fe8de8
5776437
 
03a1032
3fe8de8
03a1032
5776437
3fe8de8
5776437
 
88a5eb7
5776437
03a1032
3fe8de8
 
8fdb8ad
5776437
3fe8de8
 
 
 
88a5eb7
 
 
 
 
 
 
 
 
 
 
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import gradio as gr
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware

from omega_memory import log_event
from agent_loop import reflex_loop
from codexmesh_sync import CodexMeshSync
from CodexQuantum3D_Engine import simulate_quantum_visual

try:
    from ws_router import router as ws_router
    WS_AVAILABLE = True
except Exception:
    WS_AVAILABLE = False

CodexMeshSync()

def launch_command(user_input: str):
    try:
        if not user_input.strip():
            return "No intent provided.", "Ω-log skipped.", None

        response, log = reflex_loop(user_input)
        img = simulate_quantum_visual(user_input)

        return response, str(log), img

    except Exception as e:
        return f"Execution error: {e}", "Ω-memory failure", None


with gr.Blocks() as interface:
    gr.Markdown("## 🧠 Codex Reality Engine – Phase IX+Ω Quantum Reflex (Streaming Node)")

    user_input = gr.Textbox(label="🔍 Intent")
    btn = gr.Button("⚡ Run Reflex Engine")

    output1 = gr.Textbox(label="📤 Response")
    output2 = gr.Textbox(label="🧾 Ω-Memory Log")
    output3 = gr.Image(type="pil", label="🌀 Quantum Visual Output")

    btn.click(fn=launch_command, inputs=[user_input], outputs=[output1, output2, output3])


app = FastAPI()
app = gr.mount_gradio_app(app, interface, path="/")

if WS_AVAILABLE:
    app.include_router(ws_router)

app.add_middleware(
    CORSMiddleware,
    allow_origins=["*"],
    allow_credentials=True,
    allow_methods=["*"],
    allow_headers=["*"]
)

if __name__ == "__main__":
    import uvicorn
    uvicorn.run(app, host="0.0.0.0", port=7860)