Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -9,7 +9,6 @@ import torch
|
|
9 |
from transformers import GPT2Tokenizer, GPT2LMHeadModel
|
10 |
from keybert import KeyBERT
|
11 |
from TTS.api import TTS
|
12 |
-
import edge_tts # <-- A脩ADIR ESTA L脥NEA
|
13 |
# Importaci贸n correcta: Solo 'concatenate_videoclips'
|
14 |
from moviepy.editor import VideoFileClip, concatenate_videoclips, AudioFileClip, CompositeAudioClip, concatenate_audioclips, AudioClip
|
15 |
import re
|
@@ -19,7 +18,7 @@ import json
|
|
19 |
from collections import Counter
|
20 |
|
21 |
# Variable global para TTS
|
22 |
-
tts_model = None
|
23 |
|
24 |
# Configuraci贸n de logging
|
25 |
logging.basicConfig(
|
@@ -210,23 +209,7 @@ async def text_to_speech(text, output_path, voice):
|
|
210 |
|
211 |
except Exception as e:
|
212 |
logger.error(f"Error en TTS con Coqui: {str(e)}", exc_info=True)
|
213 |
-
|
214 |
-
# Si falla Coqui TTS, intentar con Edge TTS como 煤ltimo recurso
|
215 |
-
logger.warning("Intentando con Edge TTS como respaldo...")
|
216 |
-
try:
|
217 |
-
import edge_tts
|
218 |
-
communicate = edge_tts.Communicate(text, voice)
|
219 |
-
await communicate.save(output_path)
|
220 |
-
|
221 |
-
if os.path.exists(output_path) and os.path.getsize(output_path) > 100:
|
222 |
-
logger.info(f"Audio guardado exitosamente con Edge TTS: {output_path}")
|
223 |
-
return True
|
224 |
-
else:
|
225 |
-
logger.error(f"Edge TTS guard贸 un archivo peque帽o o vac铆o: {output_path}")
|
226 |
-
return False
|
227 |
-
except Exception as e2:
|
228 |
-
logger.error(f"Error en TTS con Edge TTS: {str(e2)}")
|
229 |
-
return False
|
230 |
|
231 |
def download_video_file(url, temp_dir):
|
232 |
if not url:
|
|
|
9 |
from transformers import GPT2Tokenizer, GPT2LMHeadModel
|
10 |
from keybert import KeyBERT
|
11 |
from TTS.api import TTS
|
|
|
12 |
# Importaci贸n correcta: Solo 'concatenate_videoclips'
|
13 |
from moviepy.editor import VideoFileClip, concatenate_videoclips, AudioFileClip, CompositeAudioClip, concatenate_audioclips, AudioClip
|
14 |
import re
|
|
|
18 |
from collections import Counter
|
19 |
|
20 |
# Variable global para TTS
|
21 |
+
tts_model = None
|
22 |
|
23 |
# Configuraci贸n de logging
|
24 |
logging.basicConfig(
|
|
|
209 |
|
210 |
except Exception as e:
|
211 |
logger.error(f"Error en TTS con Coqui: {str(e)}", exc_info=True)
|
212 |
+
return False
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
213 |
|
214 |
def download_video_file(url, temp_dir):
|
215 |
if not url:
|