Spaces:
Runtime error
Runtime error
apple muncy
commited on
Commit
Β·
1011949
1
Parent(s):
277b513
remove gradio run -add streamable http
Browse filesSigned-off-by: apple muncy <apple@dell-deb-12-5.local>
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 |
-
|
| 31 |
|
| 32 |
|
| 33 |
-
@
|
| 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 |
-
@
|
| 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(
|
| 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 |
-
|
| 224 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
)
|