Update app.py
Browse files
app.py
CHANGED
@@ -116,7 +116,25 @@ def create_disc_plot(percentuais):
|
|
116 |
)
|
117 |
|
118 |
return fig
|
119 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
120 |
import gradio as gr
|
121 |
import plotly.graph_objects as go
|
122 |
from sentence_transformers import SentenceTransformer
|
|
|
116 |
)
|
117 |
|
118 |
return fig
|
119 |
+
|
120 |
+
def gerar_relatorio(percentuais):
|
121 |
+
perfis = dict(sorted(percentuais.items(), key=lambda x: x[1], reverse=True))
|
122 |
+
principal, secundario = list(perfis.keys())[:2]
|
123 |
+
insights_p = "\n".join([f"• {i}" for i in generate_semantic_insights(principal, perfis[principal])])
|
124 |
+
insights_s = "\n".join([f"• {i}" for i in generate_semantic_insights(secundario, perfis[secundario])])
|
125 |
+
return f"""# Análise de Perfil DISC\n\n## Visão Geral\nPerfil principal: {principal} ({perfis[principal]:.1f}% - {get_intensity_level(perfis[principal])})\nPerfil secundário: {secundario} ({perfis[secundario]:.1f}% - {get_intensity_level(perfis[secundario])})\n\n## Insights Principais\n{insights_p}\n\n## Influências Secundárias\n{insights_s}\n\n## Distribuição DISC\n{', '.join([f'{k}: {v:.1f}%' for k, v in perfis.items()])}\n\n## Observação\nEste perfil representa suas tendências comportamentais naturais."""
|
126 |
+
|
127 |
+
def process_results(*answers):
|
128 |
+
if any(a is None for a in answers):
|
129 |
+
gr.Warning("Por favor, responda todas as questões antes de prosseguir.")
|
130 |
+
return None, None
|
131 |
+
|
132 |
+
perfil = calcular_perfil(answers)
|
133 |
+
plot = create_disc_plot(perfil)
|
134 |
+
report = gerar_relatorio(perfil)
|
135 |
+
|
136 |
+
return plot, report
|
137 |
+
|
138 |
import gradio as gr
|
139 |
import plotly.graph_objects as go
|
140 |
from sentence_transformers import SentenceTransformer
|