aursalan commited on
Commit
a0eb5ea
·
1 Parent(s): 98727d2

Sending only text in json

Browse files
Files changed (1) hide show
  1. app.py +2 -3
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={"filename": file.filename, "text": final_text})
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)