Spaces:
Sleeping
Sleeping
Sandhya
commited on
Commit
Β·
fcf512d
1
Parent(s):
3852212
PQ
Browse files
app.py
CHANGED
|
@@ -13,6 +13,7 @@ from fastapi.middleware.cors import CORSMiddleware
|
|
| 13 |
import gradio as gr
|
| 14 |
import uvicorn
|
| 15 |
from pydantic import BaseModel
|
|
|
|
| 16 |
from huggingface_hub.inference._mcp.agent import Agent
|
| 17 |
from dotenv import load_dotenv
|
| 18 |
load_dotenv()
|
|
@@ -364,10 +365,6 @@ Please process all {len(all_tags)} tags: {", ".join(all_tags)}
|
|
| 364 |
# }
|
| 365 |
# }
|
| 366 |
|
| 367 |
-
from fastapi.responses import RedirectResponse
|
| 368 |
-
@app.get("/")
|
| 369 |
-
async def root_direct():
|
| 370 |
-
return RedirectResponse(url="/gradio")
|
| 371 |
|
| 372 |
|
| 373 |
@app.get("/health")
|
|
@@ -395,10 +392,6 @@ async def get_operations():
|
|
| 395 |
|
| 396 |
|
| 397 |
|
| 398 |
-
|
| 399 |
-
|
| 400 |
-
|
| 401 |
-
|
| 402 |
@app.post("/Webhook")
|
| 403 |
async def webhook_handler(request:Request, background_tasks:BackgroundTasks):
|
| 404 |
"""
|
|
@@ -469,7 +462,7 @@ def create_gradio_app():
|
|
| 469 |
text-generation, etc.
|
| 470 |
""")
|
| 471 |
with gr.Column():
|
| 472 |
-
sim_repo=gr.Textbox(label="Repository",value="burtenshaw/play-mcp-repo-bot",placeholder="
|
| 473 |
sim_title= gr.Textbox(label="Discussion Title",value="Add pytorch tag",placeholder="Discussion title")
|
| 474 |
sim_comment=gr.Textbox(label="comment",lines=3,value="This model should have tags: pytorch, text-generation",placeholder="Comment mentioning tags ...")
|
| 475 |
sim_btn=gr.Button("π·οΈ Test Tag Detection")
|
|
@@ -481,6 +474,10 @@ def create_gradio_app():
|
|
| 481 |
gradio_app=create_gradio_app()
|
| 482 |
app=gr.mount_gradio_app(app,gradio_app,path="/gradio")
|
| 483 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 484 |
if __name__=="__main__":
|
| 485 |
print("π Starting HF Tagging Bot...")
|
| 486 |
print("π Dashboard: http://localhost:7860/gradio")
|
|
|
|
| 13 |
import gradio as gr
|
| 14 |
import uvicorn
|
| 15 |
from pydantic import BaseModel
|
| 16 |
+
from fastapi.responses import RedirectResponse
|
| 17 |
from huggingface_hub.inference._mcp.agent import Agent
|
| 18 |
from dotenv import load_dotenv
|
| 19 |
load_dotenv()
|
|
|
|
| 365 |
# }
|
| 366 |
# }
|
| 367 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 368 |
|
| 369 |
|
| 370 |
@app.get("/health")
|
|
|
|
| 392 |
|
| 393 |
|
| 394 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 395 |
@app.post("/Webhook")
|
| 396 |
async def webhook_handler(request:Request, background_tasks:BackgroundTasks):
|
| 397 |
"""
|
|
|
|
| 462 |
text-generation, etc.
|
| 463 |
""")
|
| 464 |
with gr.Column():
|
| 465 |
+
sim_repo=gr.Textbox(label="Repository",value="burtenshaw/play-mcp-repo-bot",placeholder="username/model-name")
|
| 466 |
sim_title= gr.Textbox(label="Discussion Title",value="Add pytorch tag",placeholder="Discussion title")
|
| 467 |
sim_comment=gr.Textbox(label="comment",lines=3,value="This model should have tags: pytorch, text-generation",placeholder="Comment mentioning tags ...")
|
| 468 |
sim_btn=gr.Button("π·οΈ Test Tag Detection")
|
|
|
|
| 474 |
gradio_app=create_gradio_app()
|
| 475 |
app=gr.mount_gradio_app(app,gradio_app,path="/gradio")
|
| 476 |
|
| 477 |
+
@app.get("/")
|
| 478 |
+
async def root_direct():
|
| 479 |
+
return RedirectResponse(url="/gradio")
|
| 480 |
+
|
| 481 |
if __name__=="__main__":
|
| 482 |
print("π Starting HF Tagging Bot...")
|
| 483 |
print("π Dashboard: http://localhost:7860/gradio")
|