Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -639,80 +639,80 @@ class ReportGenerator:
|
|
639 |
logging.error(f"Erro no processamento: {str(e)}")
|
640 |
raise
|
641 |
|
642 |
-
def create_interface():
|
643 |
-
|
644 |
-
|
645 |
-
|
646 |
-
|
647 |
-
|
648 |
-
|
649 |
-
|
650 |
-
|
651 |
-
|
652 |
-
|
653 |
-
|
654 |
|
655 |
-
|
656 |
-
|
657 |
-
|
658 |
-
|
659 |
-
|
660 |
|
661 |
-
|
662 |
-
|
663 |
-
|
664 |
-
|
665 |
-
|
666 |
-
|
667 |
-
|
668 |
-
|
669 |
|
670 |
-
|
671 |
-
|
672 |
-
|
673 |
-
|
674 |
-
|
675 |
-
|
676 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
677 |
)
|
678 |
-
|
679 |
-
with gr.Row():
|
680 |
-
generate_btn = gr.Button(
|
681 |
-
"Gerar Relatório",
|
682 |
-
variant="primary",
|
683 |
-
size="lg"
|
684 |
-
)
|
685 |
|
686 |
-
|
687 |
-
|
688 |
|
689 |
-
|
690 |
-
|
691 |
-
|
692 |
-
|
693 |
-
|
694 |
-
|
695 |
-
|
696 |
-
|
697 |
-
|
698 |
-
|
699 |
-
|
700 |
-
|
701 |
-
|
702 |
-
|
703 |
-
|
704 |
-
|
705 |
-
|
706 |
-
|
707 |
-
|
708 |
|
709 |
-
|
710 |
|
711 |
-
if __name__ == "__main__":
|
712 |
-
|
713 |
-
|
714 |
-
|
715 |
-
|
716 |
-
|
717 |
-
|
718 |
-
|
|
|
639 |
logging.error(f"Erro no processamento: {str(e)}")
|
640 |
raise
|
641 |
|
642 |
+
def create_interface():
|
643 |
+
"""Cria a interface Gradio."""
|
644 |
+
theme = gr.themes.Default(
|
645 |
+
primary_hue="blue",
|
646 |
+
secondary_hue="gray",
|
647 |
+
font=["Arial", "sans-serif"],
|
648 |
+
font_mono=["Courier New", "monospace"],
|
649 |
+
)
|
650 |
+
|
651 |
+
with gr.Blocks(theme=theme) as interface:
|
652 |
+
gr.Markdown("""
|
653 |
+
# Sistema de Análise de Desempenho Acadêmico
|
654 |
|
655 |
+
Este sistema analisa o desempenho dos alunos e gera um relatório detalhado com:
|
656 |
+
- Análise estatística completa
|
657 |
+
- Visualizações gráficas
|
658 |
+
- Recomendações personalizadas
|
659 |
+
""")
|
660 |
|
661 |
+
with gr.Row():
|
662 |
+
with gr.Column():
|
663 |
+
gr.Markdown("## Lista de Alunos")
|
664 |
+
html_file = gr.File(
|
665 |
+
label="Arquivo HTML com lista de alunos (.htm)",
|
666 |
+
type="binary",
|
667 |
+
file_types=[".htm", ".html"]
|
668 |
+
)
|
669 |
|
670 |
+
with gr.Column():
|
671 |
+
gr.Markdown("## Relatórios de Tarefas")
|
672 |
+
excel_files = gr.Files(
|
673 |
+
label="Arquivos Excel com dados das tarefas (.xlsx)",
|
674 |
+
type="binary",
|
675 |
+
file_count="multiple",
|
676 |
+
file_types=[".xlsx"]
|
677 |
+
)
|
678 |
+
|
679 |
+
with gr.Row():
|
680 |
+
generate_btn = gr.Button(
|
681 |
+
"Gerar Relatório",
|
682 |
+
variant="primary",
|
683 |
+
size="lg"
|
684 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
685 |
|
686 |
+
with gr.Row():
|
687 |
+
output_html = gr.HTML()
|
688 |
|
689 |
+
with gr.Row():
|
690 |
+
with gr.Column():
|
691 |
+
download_html_btn = gr.File(
|
692 |
+
label="Download Relatório HTML",
|
693 |
+
type="filepath",
|
694 |
+
interactive=False
|
695 |
+
)
|
696 |
+
with gr.Column():
|
697 |
+
download_pdf_btn = gr.File(
|
698 |
+
label="Download Relatório PDF",
|
699 |
+
type="filepath",
|
700 |
+
interactive=False
|
701 |
+
)
|
702 |
+
|
703 |
+
generate_btn.click(
|
704 |
+
fn=process_files,
|
705 |
+
inputs=[html_file, excel_files],
|
706 |
+
outputs=[output_html, download_html_btn, download_pdf_btn]
|
707 |
+
)
|
708 |
|
709 |
+
return interface
|
710 |
|
711 |
+
if __name__ == "__main__":
|
712 |
+
interface = create_interface()
|
713 |
+
interface.launch(
|
714 |
+
share=False,
|
715 |
+
server_name="0.0.0.0",
|
716 |
+
server_port=7860,
|
717 |
+
show_error=True
|
718 |
+
)
|