Commit
·
581bd1c
1
Parent(s):
6531321
Revert: Split API (8888) and UI (7860) ports for stability
Browse files
app.py
CHANGED
|
@@ -86,17 +86,25 @@ def start_local_node():
|
|
| 86 |
except Exception as e:
|
| 87 |
print(f"❌ Failed to start local node: {e}")
|
| 88 |
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
|
| 94 |
# Start background services
|
| 95 |
if __name__ == "__main__":
|
| 96 |
-
# 1. Start
|
|
|
|
|
|
|
|
|
|
|
|
|
| 97 |
node_thread = threading.Thread(target=start_local_node, daemon=True)
|
| 98 |
node_thread.start()
|
| 99 |
|
| 100 |
-
#
|
| 101 |
-
|
| 102 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 86 |
except Exception as e:
|
| 87 |
print(f"❌ Failed to start local node: {e}")
|
| 88 |
|
| 89 |
+
def start_orchestrator_api():
|
| 90 |
+
"""Start the orchestrator API in the background."""
|
| 91 |
+
print("🧠 Starting NACC Orchestrator API...")
|
| 92 |
+
uvicorn.run(orchestrator_app, host="127.0.0.1", port=8888)
|
| 93 |
|
| 94 |
# Start background services
|
| 95 |
if __name__ == "__main__":
|
| 96 |
+
# 1. Start the Orchestrator API in a thread
|
| 97 |
+
api_thread = threading.Thread(target=start_orchestrator_api, daemon=True)
|
| 98 |
+
api_thread.start()
|
| 99 |
+
|
| 100 |
+
# 2. Start a Local Node in a thread (so the Space works out-of-the-box)
|
| 101 |
node_thread = threading.Thread(target=start_local_node, daemon=True)
|
| 102 |
node_thread.start()
|
| 103 |
|
| 104 |
+
# 3. Give services a moment to spin up
|
| 105 |
+
time.sleep(3)
|
| 106 |
+
|
| 107 |
+
# 4. Launch the UI
|
| 108 |
+
print("💻 Launching NACC UI...")
|
| 109 |
+
demo = create_ui()
|
| 110 |
+
demo.launch(server_name="0.0.0.0", server_port=7860)
|