Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -148,12 +148,11 @@ def main():
|
|
148 |
file_extension = os.path.splitext(uploaded_file.name)[1].lower()
|
149 |
|
150 |
if file_extension == ".pdf":
|
151 |
-
|
152 |
-
|
153 |
-
for page in pdf_reader.pages:
|
154 |
-
text += page.extract_text()
|
155 |
else: # .txt file
|
156 |
-
|
|
|
157 |
|
158 |
converted_text = convert(text)
|
159 |
|
|
|
148 |
file_extension = os.path.splitext(uploaded_file.name)[1].lower()
|
149 |
|
150 |
if file_extension == ".pdf":
|
151 |
+
text = extract_text_from_pdf(io.BytesIO(uploaded_file.read()))
|
152 |
+
|
|
|
|
|
153 |
else: # .txt file
|
154 |
+
with open(inputfile, "r") as fp:
|
155 |
+
text = fp.read()
|
156 |
|
157 |
converted_text = convert(text)
|
158 |
|