Spaces:
Sleeping
Sleeping
Commit
·
4197760
1
Parent(s):
96cc1ef
fix api availablity issues
Browse files- app/main.py +4 -6
app/main.py
CHANGED
@@ -10,8 +10,6 @@ if parent_dir not in sys.path:
|
|
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
|
@@ -38,13 +36,13 @@ app = FastAPI(
|
|
38 |
|
39 |
|
40 |
|
41 |
-
|
42 |
-
|
43 |
-
|
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)
|
|
|
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
|
|
|
36 |
|
37 |
|
38 |
|
39 |
+
@app.get("/")
|
40 |
+
def root():
|
41 |
+
return {"status": "ok", "routes": [str(r.path) for r in app.routes]}
|
42 |
|
43 |
|
44 |
|
45 |
+
@app.post("/ocr")
|
46 |
async def process_pdf(file: UploadFile = File(...)):
|
47 |
with tempfile.NamedTemporaryFile(delete=False, suffix=".pdf") as tmp:
|
48 |
shutil.copyfileobj(file.file, tmp)
|