Spaces:
Sleeping
Sleeping
| 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) |