siddhartharyaai commited on
Commit
41ed169
·
verified ·
1 Parent(s): 384337a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -1
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
- reader = pypdf.PdfReader(file.name)
 
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)}"