apple muncy commited on
Commit
8718425
·
1 Parent(s): acf6e94

change app to my_app

Browse files

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

Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -84,13 +84,13 @@ class WebhookEvent(BaseModel):
84
  repo: Dict[str, str]
85
 
86
 
87
- app = FastAPI(title="HF Tagging Bot")
88
 
89
- @app.get("/")
90
  def read_main():
91
  return {"message": "This is your main app"}
92
 
93
- app.add_middleware(CORSMiddleware, allow_origins=["*"])
94
 
95
 
96
  async def get_agent():
@@ -399,7 +399,7 @@ Please process all {len(all_tags)} tags: {", ".join(all_tags)}
399
  return error_msg
400
 
401
 
402
- @app.post("/webhook")
403
  async def webhook_handler(request: Request, background_tasks: BackgroundTasks):
404
  """Handle HF Hub webhooks"""
405
  webhook_secret = request.headers.get("X-Webhook-Secret")
@@ -530,7 +530,7 @@ def create_gradio_app():
530
 
531
  # Mount Gradio app
532
  gradio_app = create_gradio_app()
533
- app = gr.mount_gradio_app(app, gradio_app, path="/gradio")
534
 
535
 
536
  if __name__ == "__main__":
 
84
  repo: Dict[str, str]
85
 
86
 
87
+ my_app = FastAPI(title="HF Tagging Bot")
88
 
89
+ @my_app.get("/")
90
  def read_main():
91
  return {"message": "This is your main app"}
92
 
93
+ my_app.add_middleware(CORSMiddleware, allow_origins=["*"])
94
 
95
 
96
  async def get_agent():
 
399
  return error_msg
400
 
401
 
402
+ @my_app.post("/webhook")
403
  async def webhook_handler(request: Request, background_tasks: BackgroundTasks):
404
  """Handle HF Hub webhooks"""
405
  webhook_secret = request.headers.get("X-Webhook-Secret")
 
530
 
531
  # Mount Gradio app
532
  gradio_app = create_gradio_app()
533
+ app = gr.mount_gradio_app(my_app, gradio_app, path="/gradio")
534
 
535
 
536
  if __name__ == "__main__":