Spaces:
Sleeping
Sleeping
Commit
·
96cc1ef
1
Parent(s):
9e8393f
fix:isssues with visisblity
Browse files- app/__pycache__/main.cpython-312.pyc +0 -0
- app/__pycache__/main.cpython-313.pyc +0 -0
- app/main.py +11 -6
app/__pycache__/main.cpython-312.pyc
CHANGED
Binary files a/app/__pycache__/main.cpython-312.pyc and b/app/__pycache__/main.cpython-312.pyc differ
|
|
app/__pycache__/main.cpython-313.pyc
CHANGED
Binary files a/app/__pycache__/main.cpython-313.pyc and b/app/__pycache__/main.cpython-313.pyc differ
|
|
app/main.py
CHANGED
@@ -10,6 +10,8 @@ if parent_dir not in sys.path:
|
|
10 |
sys.path.insert(1, ".")
|
11 |
|
12 |
|
|
|
|
|
13 |
from fastapi import FastAPI, UploadFile, File
|
14 |
from extraction import process_document
|
15 |
from fastapi.responses import JSONResponse
|
@@ -17,9 +19,11 @@ from app.config import *
|
|
17 |
import tempfile
|
18 |
import shutil
|
19 |
import json
|
|
|
|
|
|
|
20 |
|
21 |
|
22 |
-
import uvicorn
|
23 |
|
24 |
app = FastAPI(
|
25 |
title="PDF Processor API",
|
@@ -28,18 +32,19 @@ app = FastAPI(
|
|
28 |
docs_url="/docs",
|
29 |
redoc_url="/redoc",
|
30 |
openapi_url="/openapi.json",
|
31 |
-
root_path=
|
32 |
)
|
33 |
|
34 |
|
35 |
|
36 |
-
|
37 |
-
|
38 |
-
|
|
|
39 |
|
40 |
|
41 |
|
42 |
-
@app.post("/
|
43 |
async def process_pdf(file: UploadFile = File(...)):
|
44 |
with tempfile.NamedTemporaryFile(delete=False, suffix=".pdf") as tmp:
|
45 |
shutil.copyfileobj(file.file, tmp)
|
|
|
10 |
sys.path.insert(1, ".")
|
11 |
|
12 |
|
13 |
+
|
14 |
+
|
15 |
from fastapi import FastAPI, UploadFile, File
|
16 |
from extraction import process_document
|
17 |
from fastapi.responses import JSONResponse
|
|
|
19 |
import tempfile
|
20 |
import shutil
|
21 |
import json
|
22 |
+
import uvicorn
|
23 |
+
|
24 |
+
|
25 |
|
26 |
|
|
|
27 |
|
28 |
app = FastAPI(
|
29 |
title="PDF Processor API",
|
|
|
32 |
docs_url="/docs",
|
33 |
redoc_url="/redoc",
|
34 |
openapi_url="/openapi.json",
|
35 |
+
root_path="/spaces/mussie1212/melhiq_ocr"
|
36 |
)
|
37 |
|
38 |
|
39 |
|
40 |
+
|
41 |
+
# @app.get("/")
|
42 |
+
# def root():
|
43 |
+
# return {"status": "ok", "routes": [str(r.path) for r in app.routes]}
|
44 |
|
45 |
|
46 |
|
47 |
+
@app.post("/")
|
48 |
async def process_pdf(file: UploadFile = File(...)):
|
49 |
with tempfile.NamedTemporaryFile(delete=False, suffix=".pdf") as tmp:
|
50 |
shutil.copyfileobj(file.file, tmp)
|