Spaces:
Running
Running
Commit
·
fb55ffe
1
Parent(s):
ab1be36
fix:first commit on the ocr
Browse files- app/main.py +6 -7
app/main.py
CHANGED
@@ -21,7 +21,11 @@ import json
|
|
21 |
|
22 |
import uvicorn
|
23 |
|
24 |
-
app = FastAPI(
|
|
|
|
|
|
|
|
|
25 |
|
26 |
@app.post("/process-pdf/")
|
27 |
async def process_pdf(file: UploadFile = File(...)):
|
@@ -34,9 +38,4 @@ async def process_pdf(file: UploadFile = File(...)):
|
|
34 |
if isinstance(result, str):
|
35 |
result = json.loads(result)
|
36 |
|
37 |
-
return JSONResponse(content=result)
|
38 |
-
|
39 |
-
|
40 |
-
if __name__ == "__main__":
|
41 |
-
# IMPORTANT: Hugging Face requires port 7860
|
42 |
-
uvicorn.run("main:app", host="0.0.0.0", port=7860, reload=False)
|
|
|
21 |
|
22 |
import uvicorn
|
23 |
|
24 |
+
app = FastAPI(
|
25 |
+
title="PDF Processor API",
|
26 |
+
description="Upload a PDF and get structured document data",
|
27 |
+
version="1.0.0"
|
28 |
+
)
|
29 |
|
30 |
@app.post("/process-pdf/")
|
31 |
async def process_pdf(file: UploadFile = File(...)):
|
|
|
38 |
if isinstance(result, str):
|
39 |
result = json.loads(result)
|
40 |
|
41 |
+
return JSONResponse(content=result)
|
|
|
|
|
|
|
|
|
|