Jaward commited on
Commit
bd67bd2
·
verified ·
1 Parent(s): d76ce22

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -17
app.py CHANGED
@@ -31,7 +31,9 @@ logging.basicConfig(
31
  ]
32
  )
33
  logger = logging.getLogger(__name__)
34
-
 
 
35
  # Set up environment
36
  if os.path.exists("/tmp"):
37
  OUTPUT_DIR = "/tmp/outputs" # Use /tmp for Huggingface Spaces
@@ -339,22 +341,6 @@ async def on_generate(api_service, api_key, serpapi_key, title, topic, instructi
339
  """
340
  return
341
 
342
- tts = None
343
- try:
344
- device = "cuda" if torch.cuda.is_available() else "cpu"
345
- tts = TTS("tts_models/multilingual/multi-dataset/xtts_v2").to(device)
346
- logger.info("TTS model initialized on %s", device)
347
- except Exception as e:
348
- logger.error("Failed to initialize TTS model: %s", str(e))
349
- yield f"""
350
- <div style="display: flex; flex-direction: column; justify-content: center; align-items: center; height: 100%; min-height: 700px; padding: 20px; text-align: center; border: 1px solid #ddd; border-radius: 8px;">
351
- <h2 style="color: #d9534f;">TTS model initialization failed</h2>
352
- <p style="margin-top: 20px;">Error: {str(e)}</p>
353
- <p>Please ensure the Coqui TTS model is properly installed and try again.</p>
354
- </div>
355
- """
356
- return
357
-
358
  model_client = get_model_client(api_service, api_key)
359
 
360
  total_slides = num_slides # Use exactly the number of slides from input
 
31
  ]
32
  )
33
  logger = logging.getLogger(__name__)
34
+ device = "cuda" if torch.cuda.is_available() else "cpu"
35
+ tts = TTS("tts_models/multilingual/multi-dataset/xtts_v2").to(device)
36
+ logger.info("TTS model initialized on %s", device)
37
  # Set up environment
38
  if os.path.exists("/tmp"):
39
  OUTPUT_DIR = "/tmp/outputs" # Use /tmp for Huggingface Spaces
 
341
  """
342
  return
343
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
344
  model_client = get_model_client(api_service, api_key)
345
 
346
  total_slides = num_slides # Use exactly the number of slides from input