Spaces:
Sleeping
Sleeping
update
Browse files- api_server.py +22 -0
api_server.py
CHANGED
|
@@ -113,3 +113,25 @@ async def extract_pdf_text_root(
|
|
| 113 |
) -> JSONResponse:
|
| 114 |
# Alias endpoint to keep compatibility with simple base URL posting.
|
| 115 |
return await extract_pdf_text(file=file, max_pages=max_pages, ocr_lang=ocr_lang, authorization=authorization)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 113 |
) -> JSONResponse:
|
| 114 |
# Alias endpoint to keep compatibility with simple base URL posting.
|
| 115 |
return await extract_pdf_text(file=file, max_pages=max_pages, ocr_lang=ocr_lang, authorization=authorization)
|
| 116 |
+
|
| 117 |
+
|
| 118 |
+
@app.post("/api/extract-pdf-text")
|
| 119 |
+
async def extract_pdf_text_api_alias(
|
| 120 |
+
file: UploadFile = File(...),
|
| 121 |
+
max_pages: int = Form(20),
|
| 122 |
+
ocr_lang: str = Form("ind+eng"),
|
| 123 |
+
authorization: Optional[str] = Header(default=None),
|
| 124 |
+
) -> JSONResponse:
|
| 125 |
+
# Compatibility alias used by Laravel fallback endpoint list.
|
| 126 |
+
return await extract_pdf_text(file=file, max_pages=max_pages, ocr_lang=ocr_lang, authorization=authorization)
|
| 127 |
+
|
| 128 |
+
|
| 129 |
+
@app.post("/extract/pdf-text")
|
| 130 |
+
async def extract_pdf_text_legacy_alias(
|
| 131 |
+
file: UploadFile = File(...),
|
| 132 |
+
max_pages: int = Form(20),
|
| 133 |
+
ocr_lang: str = Form("ind+eng"),
|
| 134 |
+
authorization: Optional[str] = Header(default=None),
|
| 135 |
+
) -> JSONResponse:
|
| 136 |
+
# Legacy compatibility alias used by older clients.
|
| 137 |
+
return await extract_pdf_text(file=file, max_pages=max_pages, ocr_lang=ocr_lang, authorization=authorization)
|