Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -1656,22 +1656,21 @@ def tab_viz21(df, nivel, umbral_pareto=0.8, metodo='mixto', sim_prop=0.75, rank_
|
|
| 1656 |
Resultado de aplicar **estrategia mixta ponderada** a iniciativas prioritarias.
|
| 1657 |
|
| 1658 |
### Componentes del Score:
|
| 1659 |
-
- Similaridad promedio
|
| 1660 |
- Ranking promedio (posición)
|
| 1661 |
- Frecuencia de aparición
|
| 1662 |
|
| 1663 |
### Interpretación:
|
| 1664 |
-
- **Barras largas**:
|
| 1665 |
- **Color verde**: Scores más altos
|
| 1666 |
- **Color azul**: Scores intermedios
|
| 1667 |
-
- **Círculos grandes**:
|
| 1668 |
|
| 1669 |
### Top 3 ODS:
|
| 1670 |
-
{chr(10).join([f'- **
|
| 1671 |
for _, row in resultado.head(3).iterrows()] if len(resultado) > 0 else ['Sin datos'])}
|
| 1672 |
|
| 1673 |
### 💡 Uso:
|
| 1674 |
-
|
| 1675 |
relevancia, posición y prevalencia en el grupo de textos analizados.
|
| 1676 |
"""
|
| 1677 |
|
|
@@ -2103,6 +2102,63 @@ def crear_app():
|
|
| 2103 |
# Pasar como lista con un único elemento
|
| 2104 |
return procesar_lote_llm([query_text.strip()])
|
| 2105 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2106 |
btn_prt.click(procesar_consulta, query_in_prt, [ods_prt,meta_prt,indicador_prt], show_progress=True)
|
| 2107 |
|
| 2108 |
|
|
@@ -2741,6 +2797,8 @@ def crear_app():
|
|
| 2741 |
return gr.update(value=None)
|
| 2742 |
df = pd.read_excel(file_input)
|
| 2743 |
return gr.update(value=df[['id_unico','iniciativa']])
|
|
|
|
|
|
|
| 2744 |
|
| 2745 |
|
| 2746 |
with gr.Tab("MASIVA"):
|
|
@@ -3077,7 +3135,7 @@ def crear_app():
|
|
| 3077 |
# PESTAÑA 23: NUBE DE PALABRAS - PALOMA
|
| 3078 |
# with gr.Tab("23. Nube Palabras"):
|
| 3079 |
# file_output = gr.File()
|
| 3080 |
-
|
| 3081 |
|
| 3082 |
file_output.change(leer_tabla,
|
| 3083 |
file_output,
|
|
|
|
| 1656 |
Resultado de aplicar **estrategia mixta ponderada** a iniciativas prioritarias.
|
| 1657 |
|
| 1658 |
### Componentes del Score:
|
|
|
|
| 1659 |
- Ranking promedio (posición)
|
| 1660 |
- Frecuencia de aparición
|
| 1661 |
|
| 1662 |
### Interpretación:
|
| 1663 |
+
- **Barras largas**: {nivel} con mayor score global
|
| 1664 |
- **Color verde**: Scores más altos
|
| 1665 |
- **Color azul**: Scores intermedios
|
| 1666 |
+
- **Círculos grandes**: {nivel} que aparecen en más iniciativas
|
| 1667 |
|
| 1668 |
### Top 3 ODS:
|
| 1669 |
+
{chr(10).join([f'- **{nivel} {int(row["ODS_ID"])}**: Score {row["score"]:.4f} ({int(row["frecuencia"])} iniciativas)'
|
| 1670 |
for _, row in resultado.head(3).iterrows()] if len(resultado) > 0 else ['Sin datos'])}
|
| 1671 |
|
| 1672 |
### 💡 Uso:
|
| 1673 |
+
Est@s {nivel} son los **prioritarios a nivel agregado** considerando
|
| 1674 |
relevancia, posición y prevalencia en el grupo de textos analizados.
|
| 1675 |
"""
|
| 1676 |
|
|
|
|
| 2102 |
# Pasar como lista con un único elemento
|
| 2103 |
return procesar_lote_llm([query_text.strip()])
|
| 2104 |
|
| 2105 |
+
with gr.Tab("Resultados por ODS - Metas"):
|
| 2106 |
+
with gr.Row():
|
| 2107 |
+
with gr.Tab("🏆 Ranking Masivo ODS"):
|
| 2108 |
+
with gr.Row():
|
| 2109 |
+
with gr.Column(scale=2):
|
| 2110 |
+
plot_mass_ods_ind = gr.Plot(label="Ranking Global ODS")
|
| 2111 |
+
with gr.Column(scale=1):
|
| 2112 |
+
exp_mass_ods_ind = gr.Markdown()
|
| 2113 |
+
|
| 2114 |
+
with gr.Tab('Tabla score ODS'):
|
| 2115 |
+
output_ods_mass_mix_ind = gr.Dataframe(label="Resultados del análisis masivo ODS")
|
| 2116 |
+
|
| 2117 |
+
with gr.Row():
|
| 2118 |
+
with gr.Tab("🏆 Ranking Masivo METAS"):
|
| 2119 |
+
with gr.Row():
|
| 2120 |
+
with gr.Column(scale=2):
|
| 2121 |
+
plot_mass_metas_ind = gr.Plot(label="Ranking Global METAS")
|
| 2122 |
+
with gr.Column(scale=1):
|
| 2123 |
+
exp_mass_metas_ind = gr.Markdown()
|
| 2124 |
+
|
| 2125 |
+
|
| 2126 |
+
with gr.Tab('Tabla score METAS'):
|
| 2127 |
+
output_meta_mass_mix_ind = gr.Dataframe(label="Resultados del análisis masivo METAS")
|
| 2128 |
+
|
| 2129 |
+
|
| 2130 |
+
with gr.Row(visible=False):
|
| 2131 |
+
with gr.Tab("🏆 Ranking Masivo INDICADORES"):
|
| 2132 |
+
with gr.Row():
|
| 2133 |
+
with gr.Column(scale=2):
|
| 2134 |
+
plot_mass_indicadores_ind = gr.Plot(label="Ranking Global INDICADORES")
|
| 2135 |
+
with gr.Column(scale=1):
|
| 2136 |
+
exp_mass_indicadores = gr.Markdown()
|
| 2137 |
+
with gr.Tab('Tabla score INDICADORES'):
|
| 2138 |
+
output_indicadores_mass_mix_ind = gr.Dataframe(label="Resultados del análisis masivo INDICADORES")
|
| 2139 |
+
|
| 2140 |
+
## logicas de actualizaciones
|
| 2141 |
+
with gr.Row(visible=False):
|
| 2142 |
+
ods_prt.change(
|
| 2143 |
+
fn=tab_viz21,
|
| 2144 |
+
inputs=[ods_prt, gr.State('ods')],
|
| 2145 |
+
outputs=[plot_mass_ods_ind, exp_mass_ods_ind]
|
| 2146 |
+
)
|
| 2147 |
+
|
| 2148 |
+
meta_prt.change(
|
| 2149 |
+
fn=tab_viz21,
|
| 2150 |
+
inputs=[meta_prt, gr.State('meta')],
|
| 2151 |
+
outputs=[plot_mass_ods_ind, exp_mass_metas_ind]
|
| 2152 |
+
)
|
| 2153 |
+
|
| 2154 |
+
indicador_prt.change(
|
| 2155 |
+
fn=tab_viz21,
|
| 2156 |
+
inputs=[indicador_prt, gr.State('indicador')],
|
| 2157 |
+
outputs=[plot_mass_ods_ind, exp_mass_indicadores]
|
| 2158 |
+
)
|
| 2159 |
+
|
| 2160 |
+
|
| 2161 |
+
|
| 2162 |
btn_prt.click(procesar_consulta, query_in_prt, [ods_prt,meta_prt,indicador_prt], show_progress=True)
|
| 2163 |
|
| 2164 |
|
|
|
|
| 2797 |
return gr.update(value=None)
|
| 2798 |
df = pd.read_excel(file_input)
|
| 2799 |
return gr.update(value=df[['id_unico','iniciativa']])
|
| 2800 |
+
|
| 2801 |
+
df_tx_iniciativas = gr.Dataframe(label="Vista previa de las primeras 10 filas del archivo cargado", visible=False)
|
| 2802 |
|
| 2803 |
|
| 2804 |
with gr.Tab("MASIVA"):
|
|
|
|
| 3135 |
# PESTAÑA 23: NUBE DE PALABRAS - PALOMA
|
| 3136 |
# with gr.Tab("23. Nube Palabras"):
|
| 3137 |
# file_output = gr.File()
|
| 3138 |
+
|
| 3139 |
|
| 3140 |
file_output.change(leer_tabla,
|
| 3141 |
file_output,
|