Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -22,8 +22,9 @@ app = FastAPI()
|
|
22 |
# Document Extraction Utils
|
23 |
# -------------------------
|
24 |
def extract_text_from_pdf(file):
|
25 |
-
|
26 |
with fitz.open(stream=file.read(), filetype="pdf") as doc:
|
|
|
27 |
for page in doc:
|
28 |
text += page.get_text()
|
29 |
return text
|
|
|
22 |
# Document Extraction Utils
|
23 |
# -------------------------
|
24 |
def extract_text_from_pdf(file):
|
25 |
+
file.seek(0) # Reset stream position to beginning
|
26 |
with fitz.open(stream=file.read(), filetype="pdf") as doc:
|
27 |
+
text = ""
|
28 |
for page in doc:
|
29 |
text += page.get_text()
|
30 |
return text
|