udayl commited on
Commit
4a3d440
·
1 Parent(s): 7c4326e

fix: using tmp directory

Browse files
Files changed (1) hide show
  1. notebook_lm_kokoro.py +5 -4
notebook_lm_kokoro.py CHANGED
@@ -292,15 +292,16 @@ def generate_podcast_script(
292
  Set provider="openrouter" to use OpenRouter, otherwise uses OpenAI.
293
  """
294
  pdf_basename = os.path.splitext(os.path.basename(pdf_path))[0]
295
- folder = os.path.join(os.getcwd(), pdf_basename)
296
  os.makedirs(folder, exist_ok=True)
297
 
298
  destination_pdf = os.path.join(folder, os.path.basename(pdf_path))
299
- if not os.path.exists(destination_pdf):
300
  shutil.copy(pdf_path, destination_pdf)
301
  print(f"Copied {pdf_path} to {destination_pdf}")
302
- else:
303
- print(f"PDF already copied at {destination_pdf}")
 
304
 
305
  transcript_path = os.path.join(folder, output_file)
306
  # If transcript exists, load and return it without calling the API.
 
292
  Set provider="openrouter" to use OpenRouter, otherwise uses OpenAI.
293
  """
294
  pdf_basename = os.path.splitext(os.path.basename(pdf_path))[0]
295
+ folder = os.path.join("/tmp", pdf_basename)
296
  os.makedirs(folder, exist_ok=True)
297
 
298
  destination_pdf = os.path.join(folder, os.path.basename(pdf_path))
299
+ try:
300
  shutil.copy(pdf_path, destination_pdf)
301
  print(f"Copied {pdf_path} to {destination_pdf}")
302
+ except PermissionError:
303
+ print(f"[WARNING] Cannot copy PDF to {destination_pdf}, using original path.")
304
+ destination_pdf = pdf_path # fallback
305
 
306
  transcript_path = os.path.join(folder, output_file)
307
  # If transcript exists, load and return it without calling the API.