apple muncy commited on
Commit
1011949
Β·
1 Parent(s): 277b513

remove gradio run -add streamable http

Browse files

Signed-off-by: apple muncy <[email protected]>

Files changed (1) hide show
  1. app.py +12 -7
app.py CHANGED
@@ -27,10 +27,10 @@ HF_TOKEN = os.getenv("HF_TOKEN")
27
  hf_api = HfApi(token=HF_TOKEN) if HF_TOKEN else None
28
 
29
  # Create the FastMCP server
30
- mcp = FastMCP("hf-tagging-bot-server")
31
 
32
 
33
- @mcp.tool()
34
  def get_current_tags(repo_id: str) -> str:
35
  """Get current tags from a HuggingFace model repository"""
36
  print(f"πŸ”§ get_current_tags called with repo_id: {repo_id}")
@@ -65,7 +65,7 @@ def get_current_tags(repo_id: str) -> str:
65
  return json_str
66
 
67
 
68
- @mcp.tool()
69
  def add_new_tag(repo_id: str, new_tag: str) -> str:
70
  """Add a new tag to a HuggingFace model repository via PR"""
71
  print(f"πŸ”§ add_new_tag called with repo_id: {repo_id}, new_tag: {new_tag}")
@@ -211,7 +211,7 @@ def create_gradio_app():
211
  return demo
212
  # Mount Gradio app
213
  gradio_app = create_gradio_app()
214
- app_gradio = gr.mount_gradio_app(mcp, gradio_app, path="/gradio")
215
 
216
 
217
 
@@ -219,6 +219,11 @@ app_gradio = gr.mount_gradio_app(mcp, gradio_app, path="/gradio")
219
  if __name__ == "__main__":
220
  print("πŸš€ Starting HF Tagging Bot server")
221
  print("πŸ“Š Dashboard: http://localhost:7860/gradio")
222
-
223
- uvicorn.run("app:my_app", host="0.0.0.0", port=7860, reload=True)
224
- mcp.run()
 
 
 
 
 
 
27
  hf_api = HfApi(token=HF_TOKEN) if HF_TOKEN else None
28
 
29
  # Create the FastMCP server
30
+ my_mcp = FastMCP("hf-tagging-bot-server")
31
 
32
 
33
+ @my_mcp.tool()
34
  def get_current_tags(repo_id: str) -> str:
35
  """Get current tags from a HuggingFace model repository"""
36
  print(f"πŸ”§ get_current_tags called with repo_id: {repo_id}")
 
65
  return json_str
66
 
67
 
68
+ @my_mcp.tool()
69
  def add_new_tag(repo_id: str, new_tag: str) -> str:
70
  """Add a new tag to a HuggingFace model repository via PR"""
71
  print(f"πŸ”§ add_new_tag called with repo_id: {repo_id}, new_tag: {new_tag}")
 
211
  return demo
212
  # Mount Gradio app
213
  gradio_app = create_gradio_app()
214
+ app_gradio = gr.mount_gradio_app(my_mcp, gradio_app, path="/gradio")
215
 
216
 
217
 
 
219
  if __name__ == "__main__":
220
  print("πŸš€ Starting HF Tagging Bot server")
221
  print("πŸ“Š Dashboard: http://localhost:7860/gradio")
222
+ print(" Starting http://localhost:8000/mcp")
223
+ mcp.run(
224
+ transport="http",
225
+ host="0.0.0.0",
226
+ port=8000,
227
+ path="/mcp",
228
+ log_level="debug",
229
+ )