Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -302,65 +302,39 @@ def generar_noticia(instrucciones, hechos, tamaño, tono, *args):
|
|
302 |
|
303 |
|
304 |
with gr.Blocks() as demo:
|
305 |
-
|
306 |
gr.Markdown("## Chatbot de noticias")
|
307 |
-
|
308 |
with gr.Row():
|
309 |
-
|
310 |
with gr.Column(scale=2):
|
311 |
-
|
312 |
instrucciones = gr.Textbox(label="Instrucciones para la noticia", lines=2)
|
313 |
-
|
314 |
hechos = gr.Textbox(label="Describe los hechos de la noticia", lines=4)
|
315 |
-
|
316 |
tamaño = gr.Number(label="Tamaño del cuerpo de la noticia (en palabras)", value=100)
|
317 |
-
|
318 |
tono = gr.Dropdown(label="Tono de la noticia", choices=["serio", "neutral", "divertido"], value="neutral")
|
319 |
-
|
320 |
with gr.Column(scale=3):
|
321 |
-
|
322 |
inputs_list = [instrucciones, hechos, tamaño, tono]
|
323 |
-
|
324 |
with gr.Tabs():
|
325 |
-
|
326 |
for i in range(1, 6):
|
327 |
-
|
328 |
with gr.TabItem(f"Audio {i}"):
|
329 |
-
|
330 |
audio = gr.Audio(type="filepath", label=f"Audio {i}")
|
331 |
-
|
332 |
nombre = gr.Textbox(label="Nombre", scale=1)
|
333 |
-
|
334 |
cargo = gr.Textbox(label="Cargo", scale=1)
|
335 |
-
|
336 |
inputs_list.extend([audio, nombre, cargo])
|
337 |
-
|
338 |
for i in range(1, 6):
|
339 |
-
|
340 |
with gr.TabItem(f"Documento {i}"):
|
341 |
-
|
342 |
documento = gr.File(label=f"Documento {i}", type="filepath", file_count="single")
|
343 |
-
|
344 |
inputs_list.append(documento)
|
345 |
|
346 |
-
|
347 |
|
348 |
with gr.Row():
|
|
|
349 |
|
350 |
-
|
351 |
|
352 |
with gr.Row():
|
353 |
-
|
354 |
-
noticia_output = gr.Textbox(label="Noticia generada", lines=20)
|
355 |
-
|
356 |
with gr.Row():
|
357 |
-
|
358 |
-
transcripciones_output = gr.Textbox(label="Transcripciones brutas de los audios", lines=10)
|
359 |
-
|
360 |
-
|
361 |
|
362 |
generar.click(fn=generar_noticia, inputs=inputs_list, outputs=[noticia_output, transcripciones_output])
|
363 |
|
364 |
-
|
365 |
-
|
366 |
demo.launch(share=True)
|
|
|
302 |
|
303 |
|
304 |
with gr.Blocks() as demo:
|
|
|
305 |
gr.Markdown("## Chatbot de noticias")
|
|
|
306 |
with gr.Row():
|
|
|
307 |
with gr.Column(scale=2):
|
|
|
308 |
instrucciones = gr.Textbox(label="Instrucciones para la noticia", lines=2)
|
|
|
309 |
hechos = gr.Textbox(label="Describe los hechos de la noticia", lines=4)
|
|
|
310 |
tamaño = gr.Number(label="Tamaño del cuerpo de la noticia (en palabras)", value=100)
|
|
|
311 |
tono = gr.Dropdown(label="Tono de la noticia", choices=["serio", "neutral", "divertido"], value="neutral")
|
|
|
312 |
with gr.Column(scale=3):
|
|
|
313 |
inputs_list = [instrucciones, hechos, tamaño, tono]
|
|
|
314 |
with gr.Tabs():
|
|
|
315 |
for i in range(1, 6):
|
|
|
316 |
with gr.TabItem(f"Audio {i}"):
|
|
|
317 |
audio = gr.Audio(type="filepath", label=f"Audio {i}")
|
|
|
318 |
nombre = gr.Textbox(label="Nombre", scale=1)
|
|
|
319 |
cargo = gr.Textbox(label="Cargo", scale=1)
|
|
|
320 |
inputs_list.extend([audio, nombre, cargo])
|
|
|
321 |
for i in range(1, 6):
|
|
|
322 |
with gr.TabItem(f"Documento {i}"):
|
|
|
323 |
documento = gr.File(label=f"Documento {i}", type="filepath", file_count="single")
|
|
|
324 |
inputs_list.append(documento)
|
325 |
|
326 |
+
gr.Markdown("---") # Separador visual
|
327 |
|
328 |
with gr.Row():
|
329 |
+
transcripciones_output = gr.Textbox(label="Transcripciones brutas de los audios", lines=10)
|
330 |
|
331 |
+
gr.Markdown("---") # Separador visual
|
332 |
|
333 |
with gr.Row():
|
334 |
+
generar = gr.Button("Generar noticia")
|
|
|
|
|
335 |
with gr.Row():
|
336 |
+
noticia_output = gr.Textbox(label="Noticia generada", lines=20)
|
|
|
|
|
|
|
337 |
|
338 |
generar.click(fn=generar_noticia, inputs=inputs_list, outputs=[noticia_output, transcripciones_output])
|
339 |
|
|
|
|
|
340 |
demo.launch(share=True)
|