Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -90,7 +90,8 @@ def generate_podcast(file, url, video_url, research_topic_input, tone, length):
|
|
90 |
try:
|
91 |
if not file.name.lower().endswith('.pdf'):
|
92 |
return None, "Please upload a PDF file."
|
93 |
-
|
|
|
94 |
text = " ".join(page.extract_text() for page in reader.pages if page.extract_text())
|
95 |
except Exception as e:
|
96 |
return None, f"Error reading PDF: {str(e)}"
|
|
|
90 |
try:
|
91 |
if not file.name.lower().endswith('.pdf'):
|
92 |
return None, "Please upload a PDF file."
|
93 |
+
# Use the file-like object directly to read the PDF
|
94 |
+
reader = pypdf.PdfReader(file)
|
95 |
text = " ".join(page.extract_text() for page in reader.pages if page.extract_text())
|
96 |
except Exception as e:
|
97 |
return None, f"Error reading PDF: {str(e)}"
|