Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -951,7 +951,7 @@ def tab_inicio_mass(df_ods=None, df_metas=None, df_indicador=None):
|
|
| 951 |
<div style="display: flex; flex-direction: column; align-items: center; text-align: center; flex: 1; min-width: 150px;">
|
| 952 |
<img src="{dict_logos[row['logo_id']]}"
|
| 953 |
alt="ODS {row['ODS_ID']}"
|
| 954 |
-
width="{int(100*(row['score']**
|
| 955 |
style="margin: 0 auto; display: block;" />
|
| 956 |
<p style="margin: 10px 0 5px 0; color: #333; font-size: 12px;"><strong color="#333">Meta:</strong> {row['META_ID']}</p>
|
| 957 |
|
|
@@ -2453,6 +2453,35 @@ def crear_app():
|
|
| 2453 |
|
| 2454 |
|
| 2455 |
with gr.Row():
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2456 |
with gr.Column(scale=3):
|
| 2457 |
with gr.Tab("TOP ODS"):
|
| 2458 |
html_inicio_mass = gr.HTML(label="Resultados del análisis masivo - vista inicial")
|
|
@@ -2472,7 +2501,7 @@ def crear_app():
|
|
| 2472 |
plot_mass_ods = gr.Plot(label="Ranking Global ODS")
|
| 2473 |
with gr.Column(scale=1):
|
| 2474 |
exp_mass_ods = gr.Markdown()
|
| 2475 |
-
with gr.Tab("📊 Priorización con Pareto"):
|
| 2476 |
gr.HTML("""
|
| 2477 |
<div style="background-color: #009EDB; padding: 20px; border-radius: 10px; margin: 20px 0;">
|
| 2478 |
<h3 style="color: #F0F0F0;">📊 Diagrama de Pareto (Regla 80/20)</h3>
|
|
@@ -2523,7 +2552,8 @@ def crear_app():
|
|
| 2523 |
expMetas_mass = gr.Markdown()
|
| 2524 |
with gr.Tab('Tabla score METAS'):
|
| 2525 |
output_meta_mass_mix = gr.Dataframe(label="Resultados del análisis masivo METAS")
|
| 2526 |
-
|
|
|
|
| 2527 |
with gr.Tab("🏆 Ranking Masivo INDICADORES"):
|
| 2528 |
with gr.Row():
|
| 2529 |
with gr.Column(scale=2):
|
|
@@ -2553,34 +2583,7 @@ def crear_app():
|
|
| 2553 |
with gr.Tab('Tabla score INDICADORES'):
|
| 2554 |
output_indicadores_mass_mix = gr.Dataframe(label="Resultados del análisis masivo INDICADORES")
|
| 2555 |
|
| 2556 |
-
|
| 2557 |
-
def update_choices(listado):
|
| 2558 |
-
return gr.update(choices=listado)
|
| 2559 |
-
|
| 2560 |
-
categorias_mass_state = gr.State(value=[]) # Estado para almacenar categorías disponibles
|
| 2561 |
-
categorias_mass = gr.Dropdown(
|
| 2562 |
-
choices=categorias_mass_state.value, multiselect=False, label="Categorías"#, info="Selecciona una categoria para aplicar el filtro."
|
| 2563 |
-
)
|
| 2564 |
-
categorias_mass_state.change(fn=update_choices, inputs=[categorias_mass_state], outputs=[categorias_mass])
|
| 2565 |
-
|
| 2566 |
-
def listar_elementos_categoria(file, categoria):
|
| 2567 |
-
if file is None: # or categoria not in file.columns:
|
| 2568 |
-
return "No hay datos disponibles"
|
| 2569 |
-
df = pd.read_excel(file)
|
| 2570 |
-
if categoria not in df.columns:
|
| 2571 |
-
return f"No se encontró la categoría '{categoria}' en el archivo"
|
| 2572 |
-
elementos = df[categoria].dropna().unique().tolist()
|
| 2573 |
-
# return ", ".join(elementos)
|
| 2574 |
-
return gr.update(choices=elementos)
|
| 2575 |
-
|
| 2576 |
-
# filtro_categoria_state = gr.State(value=[]) # Estado para almacenar categorías seleccionadas para filtro
|
| 2577 |
-
filtro_categoria= gr.Dropdown(
|
| 2578 |
-
choices=[], multiselect=True, interactive=True, label="Elementos de categoría", info="Selecciona una o varias opciones para aplicar el análisis."
|
| 2579 |
-
)
|
| 2580 |
-
|
| 2581 |
-
bttn_filtro_categoria = gr.Button("Aplicar filtro por categoría", variant="secondary")
|
| 2582 |
-
|
| 2583 |
-
categorias_mass.change(fn=listar_elementos_categoria, inputs=[file_output, categorias_mass], outputs=[filtro_categoria])
|
| 2584 |
|
| 2585 |
|
| 2586 |
|
|
|
|
| 951 |
<div style="display: flex; flex-direction: column; align-items: center; text-align: center; flex: 1; min-width: 150px;">
|
| 952 |
<img src="{dict_logos[row['logo_id']]}"
|
| 953 |
alt="ODS {row['ODS_ID']}"
|
| 954 |
+
width="{int(100*(row['score']**1))}"
|
| 955 |
style="margin: 0 auto; display: block;" />
|
| 956 |
<p style="margin: 10px 0 5px 0; color: #333; font-size: 12px;"><strong color="#333">Meta:</strong> {row['META_ID']}</p>
|
| 957 |
|
|
|
|
| 2453 |
|
| 2454 |
|
| 2455 |
with gr.Row():
|
| 2456 |
+
with gr.Row():
|
| 2457 |
+
def update_choices(listado):
|
| 2458 |
+
return gr.update(choices=listado)
|
| 2459 |
+
|
| 2460 |
+
categorias_mass_state = gr.State(value=[]) # Estado para almacenar categorías disponibles
|
| 2461 |
+
categorias_mass = gr.Dropdown(
|
| 2462 |
+
choices=categorias_mass_state.value, multiselect=False, label="Categorías"#, info="Selecciona una categoria para aplicar el filtro."
|
| 2463 |
+
)
|
| 2464 |
+
categorias_mass_state.change(fn=update_choices, inputs=[categorias_mass_state], outputs=[categorias_mass])
|
| 2465 |
+
|
| 2466 |
+
def listar_elementos_categoria(file, categoria):
|
| 2467 |
+
if file is None: # or categoria not in file.columns:
|
| 2468 |
+
return "No hay datos disponibles"
|
| 2469 |
+
df = pd.read_excel(file)
|
| 2470 |
+
if categoria not in df.columns:
|
| 2471 |
+
return f"No se encontró la categoría '{categoria}' en el archivo"
|
| 2472 |
+
elementos = df[categoria].dropna().unique().tolist()
|
| 2473 |
+
# return ", ".join(elementos)
|
| 2474 |
+
return gr.update(choices=elementos)
|
| 2475 |
+
|
| 2476 |
+
# filtro_categoria_state = gr.State(value=[]) # Estado para almacenar categorías seleccionadas para filtro
|
| 2477 |
+
filtro_categoria= gr.Dropdown(
|
| 2478 |
+
choices=[], multiselect=True, interactive=True, label="Elementos de categoría", info="Selecciona una o varias opciones para aplicar el análisis."
|
| 2479 |
+
)
|
| 2480 |
+
|
| 2481 |
+
bttn_filtro_categoria = gr.Button("Aplicar filtro por categoría", variant="secondary")
|
| 2482 |
+
|
| 2483 |
+
categorias_mass.change(fn=listar_elementos_categoria, inputs=[file_output, categorias_mass], outputs=[filtro_categoria])
|
| 2484 |
+
|
| 2485 |
with gr.Column(scale=3):
|
| 2486 |
with gr.Tab("TOP ODS"):
|
| 2487 |
html_inicio_mass = gr.HTML(label="Resultados del análisis masivo - vista inicial")
|
|
|
|
| 2501 |
plot_mass_ods = gr.Plot(label="Ranking Global ODS")
|
| 2502 |
with gr.Column(scale=1):
|
| 2503 |
exp_mass_ods = gr.Markdown()
|
| 2504 |
+
with gr.Tab("📊 Priorización con Pareto", visible=False):
|
| 2505 |
gr.HTML("""
|
| 2506 |
<div style="background-color: #009EDB; padding: 20px; border-radius: 10px; margin: 20px 0;">
|
| 2507 |
<h3 style="color: #F0F0F0;">📊 Diagrama de Pareto (Regla 80/20)</h3>
|
|
|
|
| 2552 |
expMetas_mass = gr.Markdown()
|
| 2553 |
with gr.Tab('Tabla score METAS'):
|
| 2554 |
output_meta_mass_mix = gr.Dataframe(label="Resultados del análisis masivo METAS")
|
| 2555 |
+
|
| 2556 |
+
with gr.Row(visible=False):
|
| 2557 |
with gr.Tab("🏆 Ranking Masivo INDICADORES"):
|
| 2558 |
with gr.Row():
|
| 2559 |
with gr.Column(scale=2):
|
|
|
|
| 2583 |
with gr.Tab('Tabla score INDICADORES'):
|
| 2584 |
output_indicadores_mass_mix = gr.Dataframe(label="Resultados del análisis masivo INDICADORES")
|
| 2585 |
|
| 2586 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2587 |
|
| 2588 |
|
| 2589 |
|