Update app.py
Browse files
app.py
CHANGED
@@ -379,11 +379,7 @@ def exportar_word(df, informe_md):
|
|
379 |
|
380 |
filename = exportar_informe_word(df_valid, informe_md)
|
381 |
|
382 |
-
#
|
383 |
-
with open(filename, 'rb') as f:
|
384 |
-
content = f.read()
|
385 |
-
|
386 |
-
return gr.File.update(value=(filename, content))
|
387 |
|
388 |
def exportar_latex(df, informe_md):
|
389 |
df_valid = df.copy()
|
@@ -401,11 +397,7 @@ def exportar_latex(df, informe_md):
|
|
401 |
|
402 |
filename = exportar_informe_latex(df_valid, informe_md)
|
403 |
|
404 |
-
#
|
405 |
-
with open(filename, 'rb') as f:
|
406 |
-
content = f.read()
|
407 |
-
|
408 |
-
return gr.File.update(value=(filename, content))
|
409 |
|
410 |
# Interfaz Gradio
|
411 |
with gr.Blocks(theme=gr.themes.Soft()) as interfaz:
|
@@ -441,7 +433,7 @@ with gr.Blocks(theme=gr.themes.Soft()) as interfaz:
|
|
441 |
with gr.Row():
|
442 |
ejemplo_ufc_btn = gr.Button("馃搵 Cargar Ejemplo UFC", variant="secondary")
|
443 |
ejemplo_od_btn = gr.Button("馃搵 Cargar Ejemplo OD", variant="secondary")
|
444 |
-
sinteticos_btn = gr.Button("馃И Generar Datos Sint茅ticos", variant="secondary")
|
445 |
|
446 |
tabla_output = gr.DataFrame(
|
447 |
row_count=(1, "dynamic"),
|
@@ -463,9 +455,9 @@ with gr.Blocks(theme=gr.themes.Soft()) as interfaz:
|
|
463 |
exportar_word_btn = gr.Button("馃捑 Exportar Informe Word", variant="primary")
|
464 |
exportar_latex_btn = gr.Button("馃捑 Exportar Informe LaTeX", variant="primary")
|
465 |
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
|
470 |
# Eventos
|
471 |
input_components = [tabla_output]
|
@@ -522,14 +514,14 @@ with gr.Blocks(theme=gr.themes.Soft()) as interfaz:
|
|
522 |
outputs=tabla_output
|
523 |
)
|
524 |
|
525 |
-
# Evento de copiar informe
|
526 |
copiar_btn.click(
|
527 |
fn=copiar_informe,
|
528 |
inputs=[informe_output],
|
529 |
outputs=[]
|
530 |
)
|
531 |
|
532 |
-
# Eventos de exportar informes
|
533 |
exportar_word_btn.click(
|
534 |
fn=exportar_word,
|
535 |
inputs=[tabla_output, informe_output],
|
|
|
379 |
|
380 |
filename = exportar_informe_word(df_valid, informe_md)
|
381 |
|
382 |
+
return filename # Retornamos el nombre del archivo
|
|
|
|
|
|
|
|
|
383 |
|
384 |
def exportar_latex(df, informe_md):
|
385 |
df_valid = df.copy()
|
|
|
397 |
|
398 |
filename = exportar_informe_latex(df_valid, informe_md)
|
399 |
|
400 |
+
return filename # Retornamos el nombre del archivo
|
|
|
|
|
|
|
|
|
401 |
|
402 |
# Interfaz Gradio
|
403 |
with gr.Blocks(theme=gr.themes.Soft()) as interfaz:
|
|
|
433 |
with gr.Row():
|
434 |
ejemplo_ufc_btn = gr.Button("馃搵 Cargar Ejemplo UFC", variant="secondary")
|
435 |
ejemplo_od_btn = gr.Button("馃搵 Cargar Ejemplo OD", variant="secondary")
|
436 |
+
sinteticos_btn = gr.Button("馃И Generar Datos Sint茅ticos", variant="secondary")
|
437 |
|
438 |
tabla_output = gr.DataFrame(
|
439 |
row_count=(1, "dynamic"),
|
|
|
455 |
exportar_word_btn = gr.Button("馃捑 Exportar Informe Word", variant="primary")
|
456 |
exportar_latex_btn = gr.Button("馃捑 Exportar Informe LaTeX", variant="primary")
|
457 |
|
458 |
+
# Agregar componentes gr.File para los archivos exportados
|
459 |
+
exportar_word_file = gr.File(label="Informe en Word")
|
460 |
+
exportar_latex_file = gr.File(label="Informe en LaTeX")
|
461 |
|
462 |
# Eventos
|
463 |
input_components = [tabla_output]
|
|
|
514 |
outputs=tabla_output
|
515 |
)
|
516 |
|
517 |
+
# Evento de copiar informe
|
518 |
copiar_btn.click(
|
519 |
fn=copiar_informe,
|
520 |
inputs=[informe_output],
|
521 |
outputs=[]
|
522 |
)
|
523 |
|
524 |
+
# Eventos de exportar informes
|
525 |
exportar_word_btn.click(
|
526 |
fn=exportar_word,
|
527 |
inputs=[tabla_output, informe_output],
|