Update app.py
Browse files
app.py
CHANGED
|
@@ -239,7 +239,7 @@ with gr.Blocks() as demo:
|
|
| 239 |
pitch_slider = gr.Slider(minimum=-20, maximum=20, value=0, label="Pitch Adjustment (Hz)", step=1)
|
| 240 |
|
| 241 |
with gr.Column():
|
| 242 |
-
output_video = gr.
|
| 243 |
|
| 244 |
btn = gr.Button("Generate Video")
|
| 245 |
btn.click(
|
|
@@ -248,6 +248,16 @@ with gr.Blocks() as demo:
|
|
| 248 |
outputs=output_video
|
| 249 |
)
|
| 250 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 251 |
# Leer el puerto asignado por Hugging Face
|
| 252 |
port = int(os.getenv("PORT", 7860))
|
| 253 |
|
|
|
|
| 239 |
pitch_slider = gr.Slider(minimum=-20, maximum=20, value=0, label="Pitch Adjustment (Hz)", step=1)
|
| 240 |
|
| 241 |
with gr.Column():
|
| 242 |
+
output_video = gr.HTML(value="<p></p>") # Usamos HTML para mostrar el bot贸n
|
| 243 |
|
| 244 |
btn = gr.Button("Generate Video")
|
| 245 |
btn.click(
|
|
|
|
| 248 |
outputs=output_video
|
| 249 |
)
|
| 250 |
|
| 251 |
+
# Funci贸n para actualizar el HTML con el bot贸n de descarga
|
| 252 |
+
def update_html(download_link):
|
| 253 |
+
if "Error" in download_link:
|
| 254 |
+
return gr.HTML.update(value=f"<p>{download_link}</p>")
|
| 255 |
+
return gr.HTML.update(value=f'<a href="{download_link}" target="_blank"><button>Descargar</button></a>')
|
| 256 |
+
|
| 257 |
+
btn.click(process_input, inputs=[text_input, txt_file_input, mp3_file_input, voice_dropdown, rate_slider, pitch_slider, keyword_input], outputs=output_video).then(
|
| 258 |
+
update_html, inputs=output_video, outputs=output_video
|
| 259 |
+
)
|
| 260 |
+
|
| 261 |
# Leer el puerto asignado por Hugging Face
|
| 262 |
port = int(os.getenv("PORT", 7860))
|
| 263 |
|