Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -105,19 +105,21 @@ def read_pdf_online(url):
|
|
105 |
uid=uuid.uuid4()
|
106 |
print(f"reading {url}")
|
107 |
response = requests.get(url, stream=True)
|
|
|
108 |
text=""
|
109 |
#################
|
110 |
|
111 |
#####################
|
112 |
try:
|
113 |
if response.status_code == 200:
|
114 |
-
with open(
|
115 |
f.write(response.content)
|
116 |
#f.close()
|
117 |
#out = Path("./data.pdf")
|
118 |
#print (out)
|
119 |
-
reader = PdfReader(
|
120 |
number_of_pages = len(reader.pages)
|
|
|
121 |
for i in range(number_of_pages-1):
|
122 |
page = reader.pages[i]
|
123 |
text = f'{text}\n{page.extract_text()}'
|
|
|
105 |
uid=uuid.uuid4()
|
106 |
print(f"reading {url}")
|
107 |
response = requests.get(url, stream=True)
|
108 |
+
print(response.status_code)
|
109 |
text=""
|
110 |
#################
|
111 |
|
112 |
#####################
|
113 |
try:
|
114 |
if response.status_code == 200:
|
115 |
+
with open("test.pdf", "wb") as f:
|
116 |
f.write(response.content)
|
117 |
#f.close()
|
118 |
#out = Path("./data.pdf")
|
119 |
#print (out)
|
120 |
+
reader = PdfReader("test.pdf")
|
121 |
number_of_pages = len(reader.pages)
|
122 |
+
print(number_of_pages)
|
123 |
for i in range(number_of_pages-1):
|
124 |
page = reader.pages[i]
|
125 |
text = f'{text}\n{page.extract_text()}'
|