Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -11,14 +11,16 @@ import torch
|
|
| 11 |
# Load documents
|
| 12 |
def extract_text_from_pdf(pdf_path):
|
| 13 |
try:
|
| 14 |
-
with
|
| 15 |
-
text =
|
| 16 |
-
for page in doc:
|
| 17 |
-
text += page.get_text()
|
| 18 |
return text
|
| 19 |
except Exception as e:
|
| 20 |
return f"Error: {e}"
|
| 21 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
# Load documents from the PDF file
|
| 23 |
pdf_path = 't1.pdf' # Path to your PDF file
|
| 24 |
documents = extract_text_from_pdf(pdf_path)
|
|
|
|
| 11 |
# Load documents
|
| 12 |
def extract_text_from_pdf(pdf_path):
|
| 13 |
try:
|
| 14 |
+
with open(pdf_path, 'rb') as f:
|
| 15 |
+
text = f.read()
|
|
|
|
|
|
|
| 16 |
return text
|
| 17 |
except Exception as e:
|
| 18 |
return f"Error: {e}"
|
| 19 |
|
| 20 |
+
# Load documents from the PDF file
|
| 21 |
+
pdf_path = 't1.pdf' # Path to your PDF file
|
| 22 |
+
documents = extract_text_from_pdf(pdf_path)
|
| 23 |
+
|
| 24 |
# Load documents from the PDF file
|
| 25 |
pdf_path = 't1.pdf' # Path to your PDF file
|
| 26 |
documents = extract_text_from_pdf(pdf_path)
|