mgbam commited on
Commit
55e16c4
·
verified ·
1 Parent(s): 2444fd1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -11
app.py CHANGED
@@ -10,17 +10,6 @@ def run_server(app_path: str, port: int):
10
  """Helper function to run a uvicorn server."""
11
  uvicorn.run(app_path, host="127.0.0.1", port=port, log_level="info")
12
 
13
- # --- Launch background MCP servers ---
14
- # This code runs once when the Gradio app starts.
15
- servers_to_run = {
16
- "mock_mcp_servers.github_server:app": 8001,
17
- "mock_mcp_servers.sandbox_server:app": 8002,
18
- }
19
- for app_path, port in servers_to_run.items():
20
- thread = threading.Thread(target=run_server, args=(app_path, port), daemon=True)
21
- thread.start()
22
- time.sleep(2) # Give servers a moment to start
23
-
24
  async def run_forge_agent(goal: str, hf_token: str, progress=gr.Progress(track_tqdm=True)):
25
  """
26
  The main function to be called by the Gradio interface.
@@ -80,4 +69,15 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
80
  run_button.click(fn=run_forge_agent, inputs=[goal_input, hf_token_input], outputs=[chatbot])
81
 
82
  if __name__ == "__main__":
 
 
 
 
 
 
 
 
 
 
 
83
  demo.launch()
 
10
  """Helper function to run a uvicorn server."""
11
  uvicorn.run(app_path, host="127.0.0.1", port=port, log_level="info")
12
 
 
 
 
 
 
 
 
 
 
 
 
13
  async def run_forge_agent(goal: str, hf_token: str, progress=gr.Progress(track_tqdm=True)):
14
  """
15
  The main function to be called by the Gradio interface.
 
69
  run_button.click(fn=run_forge_agent, inputs=[goal_input, hf_token_input], outputs=[chatbot])
70
 
71
  if __name__ == "__main__":
72
+ # --- Launch background MCP servers ---
73
+ # This code runs once when the Gradio app starts.
74
+ servers_to_run = {
75
+ "mock_mcp_servers.github_server:app": 8001,
76
+ "mock_mcp_servers.sandbox_server:app": 8002,
77
+ }
78
+ for app_path, port in servers_to_run.items():
79
+ thread = threading.Thread(target=run_server, args=(app_path, port), daemon=True)
80
+ thread.start()
81
+ time.sleep(2) # Give servers a moment to start
82
+
83
  demo.launch()