Rausda6 commited on
Commit
200606d
·
verified ·
1 Parent(s): c18c219

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -3
app.py CHANGED
@@ -222,7 +222,7 @@ class PodcastGenerator:
222
  line = sentence + "." if not sentence.endswith('.') else sentence
223
  podcast_lines.append({
224
  "speaker": speaker,
225
- "line": linepro
226
  })
227
 
228
  result = {
@@ -304,7 +304,8 @@ JSON:"""
304
  return_tensors="pt",
305
  padding=True,
306
  truncation=True,
307
- max_length=1024 # Reduced for stability
 
308
  )
309
 
310
  # Move to correct device
@@ -648,7 +649,11 @@ def generate_podcast_gradio(input_text, input_file, language, speaker1, speaker2
648
  # Create new event loop for this request - CRITICAL FIX
649
  try:
650
  # Try to get existing loop
651
- loop = asyncio.get_event_loop()
 
 
 
 
652
  if loop.is_running():
653
  # If loop is running, we need to run in thread
654
  import concurrent.futures
 
222
  line = sentence + "." if not sentence.endswith('.') else sentence
223
  podcast_lines.append({
224
  "speaker": speaker,
225
+ "line": line
226
  })
227
 
228
  result = {
 
304
  return_tensors="pt",
305
  padding=True,
306
  truncation=True,
307
+ max_length=2048, # Reduced for stability
308
+ return_attention_mask=True
309
  )
310
 
311
  # Move to correct device
 
649
  # Create new event loop for this request - CRITICAL FIX
650
  try:
651
  # Try to get existing loop
652
+ try:
653
+ loop = asyncio.get_running_loop()
654
+ except RuntimeError:
655
+ loop = asyncio.new_event_loop()
656
+ asyncio.set_event_loop(loop)
657
  if loop.is_running():
658
  # If loop is running, we need to run in thread
659
  import concurrent.futures