Spaces:
Sleeping
Sleeping
Sending only text in json
Browse files
app.py
CHANGED
|
@@ -58,7 +58,7 @@ async def extract_text_from_pdf(file: UploadFile = File(...)):
|
|
| 58 |
# --- PyPDF LOGIC END ---
|
| 59 |
|
| 60 |
# Return the extracted text in a JSON response
|
| 61 |
-
return JSONResponse(content={"
|
| 62 |
|
| 63 |
except Exception as e:
|
| 64 |
# Handle potential errors during PDF processing
|
|
@@ -72,5 +72,4 @@ def read_root():
|
|
| 72 |
|
| 73 |
# This part is for local development, Hugging Face Spaces will use its own server.
|
| 74 |
if __name__ == "__main__":
|
| 75 |
-
uvicorn.run(app, host="0.0.0.0", port=8000)
|
| 76 |
-
|
|
|
|
| 58 |
# --- PyPDF LOGIC END ---
|
| 59 |
|
| 60 |
# Return the extracted text in a JSON response
|
| 61 |
+
return JSONResponse(content={"text": final_text})
|
| 62 |
|
| 63 |
except Exception as e:
|
| 64 |
# Handle potential errors during PDF processing
|
|
|
|
| 72 |
|
| 73 |
# This part is for local development, Hugging Face Spaces will use its own server.
|
| 74 |
if __name__ == "__main__":
|
| 75 |
+
uvicorn.run(app, host="0.0.0.0", port=8000)
|
|
|