histlearn commited on
Commit
1c2c930
verified
1 Parent(s): 4c6255c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -16
app.py CHANGED
@@ -294,7 +294,8 @@ with gr.Blocks(theme=theme) as interface:
294
 
295
  generate_btn = gr.Button("Gerar Relat贸rio", variant="primary") # Destaque no bot茫o
296
  output_html = gr.HTML()
297
- pdf_output = gr.File(label="Download PDF Report", visible=False, elem_id="pdf_output")
 
298
 
299
  with gr.Row(): # Crie uma nova linha para os bot玫es
300
  download_html_btn = gr.Button("Baixar Relat贸rio HTML")
@@ -307,21 +308,7 @@ with gr.Blocks(theme=theme) as interface:
307
  generate_btn.click(
308
  fn=wrapper,
309
  inputs=[html_file, excel_files],
310
- outputs=[output_html, pdf_output]
311
- )
312
-
313
- download_html_btn.click(
314
- None,
315
- [],
316
- [],
317
- _js="() => {const a = document.createElement('a'); a.href = document.getElementById('html_output').href; a.download = 'relatorio_final.html'; a.click();}"
318
- )
319
-
320
- download_pdf_btn.click(
321
- None,
322
- [],
323
- [],
324
- _js="() => {const a = document.createElement('a'); a.href = document.getElementById('pdf_output').href; a.download = 'relatorio_final.pdf'; a.click();}"
325
  )
326
 
327
  interface.launch()
 
294
 
295
  generate_btn = gr.Button("Gerar Relat贸rio", variant="primary") # Destaque no bot茫o
296
  output_html = gr.HTML()
297
+ download_html = gr.File(label="Download HTML Report")
298
+ download_pdf = gr.File(label="Download PDF Report")
299
 
300
  with gr.Row(): # Crie uma nova linha para os bot玫es
301
  download_html_btn = gr.Button("Baixar Relat贸rio HTML")
 
308
  generate_btn.click(
309
  fn=wrapper,
310
  inputs=[html_file, excel_files],
311
+ outputs=[output_html, download_html, download_pdf]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
312
  )
313
 
314
  interface.launch()