histlearn commited on
Commit
47e7d63
verified
1 Parent(s): 6232e4c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -14
app.py CHANGED
@@ -284,16 +284,6 @@ theme = gr.themes.Default(
284
  # --- Interface Gradio ---
285
  with gr.Blocks(theme=theme) as interface:
286
  gr.Markdown("# Processamento de Relat贸rios de Tarefas")
287
- with gr.Row():
288
- with gr.Column():
289
- gr.Markdown("## Arquivo HTML (alunos.htm)")
290
- html_file = gr.File(label="Arraste o arquivo .htm aqui", type="binary")
291
- with gr.Column():
292
- gr.Markdown("## Arquivos Excel (Relat贸rios de Tarefas)")
293
- excel_files = gr.Files(label="Arraste os arquivos .xlsx aqui", type="binary", file_count="multiple")
294
-
295
- generate_btn = gr.Button("Gerar Relat贸rio", variant="primary") # Destaque no bot茫o
296
- output_html = gr.HTML(elem_id="html_output") # Adiciona um ID para refer锚ncia no JavaScript
297
  with gr.Row(): # Crie uma nova linha para os bot玫es
298
  download_html_btn = gr.Button("Baixar Relat贸rio HTML")
299
  download_pdf_btn = gr.Button("Baixar Relat贸rio PDF")
@@ -311,16 +301,19 @@ with gr.Blocks(theme=theme) as interface:
311
  inputs=[html_file, excel_files],
312
  outputs=[output_html, pdf_output]
313
  )
 
314
  download_html_btn.click(
315
- None,
316
  [],
317
  [],
318
- _js="() => { window.open(document.getElementById('html_output').getAttribute('href'), '_blank'); }"
319
  )
 
320
  download_pdf_btn.click(
321
  None,
322
  [],
323
  [],
324
- _js="() => { window.open(document.getElementById('pdf_output').getAttribute('href'), '_blank'); }"
325
  )
326
- interface.launch()
 
 
284
  # --- Interface Gradio ---
285
  with gr.Blocks(theme=theme) as interface:
286
  gr.Markdown("# Processamento de Relat贸rios de Tarefas")
 
 
 
 
 
 
 
 
 
 
287
  with gr.Row(): # Crie uma nova linha para os bot玫es
288
  download_html_btn = gr.Button("Baixar Relat贸rio HTML")
289
  download_pdf_btn = gr.Button("Baixar Relat贸rio PDF")
 
301
  inputs=[html_file, excel_files],
302
  outputs=[output_html, pdf_output]
303
  )
304
+
305
  download_html_btn.click(
306
+ None,
307
  [],
308
  [],
309
+ _js="() => {const a = document.createElement('a'); a.href = document.getElementById('html_output').href; a.download = 'relatorio_final.html'; a.click();}"
310
  )
311
+
312
  download_pdf_btn.click(
313
  None,
314
  [],
315
  [],
316
+ _js="() => {const a = document.createElement('a'); a.href = document.getElementById('pdf_output').href; a.download = 'relatorio_final.pdf'; a.click();}"
317
  )
318
+
319
+ interface.launch()