elanuk commited on
Commit
fa33eaa
·
verified ·
1 Parent(s): 1526954

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -27
app.py CHANGED
@@ -1,32 +1,9 @@
1
  import gradio as gr
2
  import requests
3
  from datetime import datetime
4
- import subprocess
5
- import threading
6
- import time
7
 
8
- # Start the MCP server
9
- def start_server():
10
- """Start the MCP server"""
11
- try:
12
- process = subprocess.Popen([
13
- "uvicorn", "server:app",
14
- "--host", "0.0.0.0",
15
- "--port", "8000"
16
- ])
17
- return process
18
- except Exception as e:
19
- print(f"Failed to start server: {e}")
20
- return None
21
-
22
- # Start server in background thread
23
- print("🚀 Starting MCP server...")
24
- server_thread = threading.Thread(target=start_server, daemon=True)
25
- server_thread.start()
26
-
27
- # Wait for server to start
28
- print("⏳ Waiting for server to start...")
29
- time.sleep(10)
30
 
31
  # Bihar districts list
32
  BIHAR_DISTRICTS = [
@@ -115,9 +92,9 @@ def run_workflow(district):
115
  "district": district.lower()
116
  }
117
 
118
- # Call your existing endpoint directly
119
  response = requests.post(
120
- "http://localhost:8000/api/run-workflow",
121
  json=payload,
122
  timeout=60
123
  )
 
1
  import gradio as gr
2
  import requests
3
  from datetime import datetime
 
 
 
4
 
5
+ # Use your deployed server instead of localhost
6
+ MCP_SERVER_URL = "https://elanuk-mcp-hf.hf.space"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
 
8
  # Bihar districts list
9
  BIHAR_DISTRICTS = [
 
92
  "district": district.lower()
93
  }
94
 
95
+ # Call your existing deployed server
96
  response = requests.post(
97
+ f"{MCP_SERVER_URL}/api/run-workflow",
98
  json=payload,
99
  timeout=60
100
  )