Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
-
from fastapi import FastAPI, HTTPException
|
|
|
2 |
from pydantic import BaseModel
|
3 |
from typing import Optional
|
4 |
from huggingface_hub import InferenceClient
|
@@ -29,6 +30,13 @@ class Query(BaseModel):
|
|
29 |
async def root():
|
30 |
return {"message": "Welcome to the API"}
|
31 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
# Webhook route
|
33 |
@app.post("/webhook")
|
34 |
async def webhook(query: Query):
|
|
|
1 |
+
from fastapi import FastAPI, HTTPException, Request
|
2 |
+
from fastapi.responses import JSONResponse
|
3 |
from pydantic import BaseModel
|
4 |
from typing import Optional
|
5 |
from huggingface_hub import InferenceClient
|
|
|
30 |
async def root():
|
31 |
return {"message": "Welcome to the API"}
|
32 |
|
33 |
+
@app.options("/webhook")
|
34 |
+
async def webhook_options(request: Request):
|
35 |
+
return JSONResponse(
|
36 |
+
status_code=200,
|
37 |
+
content={"message": "OK"}
|
38 |
+
)
|
39 |
+
|
40 |
# Webhook route
|
41 |
@app.post("/webhook")
|
42 |
async def webhook(query: Query):
|