vasanthfeb13 commited on
Commit
581bd1c
·
1 Parent(s): 6531321

Revert: Split API (8888) and UI (7860) ports for stability

Browse files
Files changed (1) hide show
  1. app.py +16 -8
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
- # 5. Mount Gradio UI
90
- print("💻 Mounting NACC UI...")
91
- demo = create_ui()
92
- app = gr.mount_gradio_app(app, demo, path="/")
93
 
94
  # Start background services
95
  if __name__ == "__main__":
96
- # 1. Start a Local Node in a thread (so the Space works out-of-the-box)
 
 
 
 
97
  node_thread = threading.Thread(target=start_local_node, daemon=True)
98
  node_thread.start()
99
 
100
- # 2. Start the combined app
101
- print("🧠 Starting NACC Orchestrator API & UI on port 7860...")
102
- uvicorn.run(app, host="0.0.0.0", port=7860)
 
 
 
 
 
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)