Upload folder using huggingface_hub
Browse files
app.py
CHANGED
|
@@ -975,7 +975,13 @@ def classify(payload: dict[str, Any]) -> dict[str, Any]:
|
|
| 975 |
|
| 976 |
|
| 977 |
@app.post("/v1/compress")
|
| 978 |
-
def compress(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 979 |
payload = _correlation_payload(
|
| 980 |
payload,
|
| 981 |
request_id=getattr(request.state, "request_id", None),
|
|
|
|
| 975 |
|
| 976 |
|
| 977 |
@app.post("/v1/compress")
|
| 978 |
+
async def compress(request: Request) -> dict[str, Any]:
|
| 979 |
+
try:
|
| 980 |
+
payload = await request.json()
|
| 981 |
+
except Exception as exc:
|
| 982 |
+
raise HTTPException(status_code=400, detail="invalid JSON body") from exc
|
| 983 |
+
if not isinstance(payload, dict):
|
| 984 |
+
raise HTTPException(status_code=400, detail="request body must be a JSON object")
|
| 985 |
payload = _correlation_payload(
|
| 986 |
payload,
|
| 987 |
request_id=getattr(request.state, "request_id", None),
|