Spaces:
Sleeping
Sleeping
apple muncy
commited on
Commit
·
8718425
1
Parent(s):
acf6e94
change app to my_app
Browse filesSigned-off-by: apple muncy <[email protected]>
app.py
CHANGED
@@ -84,13 +84,13 @@ class WebhookEvent(BaseModel):
|
|
84 |
repo: Dict[str, str]
|
85 |
|
86 |
|
87 |
-
|
88 |
|
89 |
-
@
|
90 |
def read_main():
|
91 |
return {"message": "This is your main app"}
|
92 |
|
93 |
-
|
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 |
-
@
|
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(
|
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__":
|