Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -114,11 +114,12 @@ def create_news_video_app(news_text_input, image_files, video_ratio, input_audio
|
|
114 |
|
115 |
try:
|
116 |
if not image_files: raise ValueError("Por favor, sube al menos una imagen.")
|
117 |
-
|
118 |
-
|
119 |
-
if input_audio_file and os.path.exists(input_audio_file) and os.path.getsize(input_audio_file) > 0:
|
120 |
shutil.copy(input_audio_file, temp_audio_file)
|
121 |
else:
|
|
|
|
|
122 |
text_to_speech(news_text_input, temp_audio_file)
|
123 |
|
124 |
audio_duration = get_audio_duration(temp_audio_file)
|
@@ -143,7 +144,7 @@ def create_news_video_app(news_text_input, image_files, video_ratio, input_audio
|
|
143 |
if os.path.exists("audio_temp_preview.mp3"): os.remove("audio_temp_preview.mp3")
|
144 |
|
145 |
with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
146 |
-
gr.Markdown("#
|
147 |
with gr.Row():
|
148 |
with gr.Column(scale=2):
|
149 |
news_input = gr.Textbox(label="1. Escribe tu noticia aquí", lines=5)
|
@@ -169,4 +170,4 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
|
169 |
outputs=[output_message, video_output]
|
170 |
)
|
171 |
|
172 |
-
demo.launch()
|
|
|
114 |
|
115 |
try:
|
116 |
if not image_files: raise ValueError("Por favor, sube al menos una imagen.")
|
117 |
+
|
118 |
+
if isinstance(input_audio_file, str) and os.path.exists(input_audio_file) and os.path.getsize(input_audio_file) > 0:
|
|
|
119 |
shutil.copy(input_audio_file, temp_audio_file)
|
120 |
else:
|
121 |
+
if not news_text_input:
|
122 |
+
raise ValueError("Escribe una noticia para generar el audio, ya que no se proporcionó una vista previa válida.")
|
123 |
text_to_speech(news_text_input, temp_audio_file)
|
124 |
|
125 |
audio_duration = get_audio_duration(temp_audio_file)
|
|
|
144 |
if os.path.exists("audio_temp_preview.mp3"): os.remove("audio_temp_preview.mp3")
|
145 |
|
146 |
with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
147 |
+
gr.Markdown("# � Creador de Videos de Noticias")
|
148 |
with gr.Row():
|
149 |
with gr.Column(scale=2):
|
150 |
news_input = gr.Textbox(label="1. Escribe tu noticia aquí", lines=5)
|
|
|
170 |
outputs=[output_message, video_output]
|
171 |
)
|
172 |
|
173 |
+
demo.launch()
|