Upload app.py with huggingface_hub
Browse files
app.py
CHANGED
|
@@ -239,7 +239,6 @@ class ConvertRequest(BaseModel):
|
|
| 239 |
|
| 240 |
|
| 241 |
server = Server(title="PASITA API", version="1.0.0", description=API_DESCRIPTION)
|
| 242 |
-
server.add_middleware(_LegacyConvertBodyMiddleware)
|
| 243 |
|
| 244 |
|
| 245 |
_V2_CONVERT_PATHS = frozenset({"/gradio_api/call/v2/convert", "/gradio_api/call/v2/convert/"})
|
|
@@ -284,6 +283,9 @@ class _LegacyConvertBodyMiddleware:
|
|
| 284 |
await self.app(scope, receive_once, send)
|
| 285 |
|
| 286 |
|
|
|
|
|
|
|
|
|
|
| 287 |
@server.exception_handler(fastapi.exceptions.RequestValidationError)
|
| 288 |
async def validation_error_handler(request: fastapi.Request, exc: fastapi.exceptions.RequestValidationError):
|
| 289 |
issues = "; ".join(f"{'.'.join(str(l) for l in e.get('loc', []))}: {e.get('msg', '')}" for e in exc.errors()[:3])
|
|
|
|
| 239 |
|
| 240 |
|
| 241 |
server = Server(title="PASITA API", version="1.0.0", description=API_DESCRIPTION)
|
|
|
|
| 242 |
|
| 243 |
|
| 244 |
_V2_CONVERT_PATHS = frozenset({"/gradio_api/call/v2/convert", "/gradio_api/call/v2/convert/"})
|
|
|
|
| 283 |
await self.app(scope, receive_once, send)
|
| 284 |
|
| 285 |
|
| 286 |
+
server.add_middleware(_LegacyConvertBodyMiddleware)
|
| 287 |
+
|
| 288 |
+
|
| 289 |
@server.exception_handler(fastapi.exceptions.RequestValidationError)
|
| 290 |
async def validation_error_handler(request: fastapi.Request, exc: fastapi.exceptions.RequestValidationError):
|
| 291 |
issues = "; ".join(f"{'.'.join(str(l) for l in e.get('loc', []))}: {e.get('msg', '')}" for e in exc.errors()[:3])
|