Update app.py
Browse files
app.py
CHANGED
@@ -89,12 +89,37 @@ def visualizar_grafo():
|
|
89 |
return "graph.png"
|
90 |
|
91 |
inicializar_grafo()
|
|
|
|
|
|
|
|
|
92 |
|
93 |
-
iface = gr.
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
99 |
|
100 |
iface.launch(share=True)
|
|
|
89 |
return "graph.png"
|
90 |
|
91 |
inicializar_grafo()
|
92 |
+
normativas = cargar_normativas()
|
93 |
+
estudiantes = cargar_estudiantes()
|
94 |
+
norm_options = [f"{norm['nombre']} {norm['id']}" for norm in normativas["normativa_peruana_gestion_riesgos"]]
|
95 |
+
student_names = [student["nombre"] for student in estudiantes["estudiantes"]]
|
96 |
|
97 |
+
iface = gr.Blocks()
|
98 |
+
|
99 |
+
with iface:
|
100 |
+
gr.Markdown("# Foro Din谩mico con Visualizaci贸n de Red")
|
101 |
+
|
102 |
+
with gr.Row():
|
103 |
+
gr.Markdown("## Selecciona una Normativa:")
|
104 |
+
normativa_dropdown = gr.Dropdown(choices=norm_options, label="Normativas")
|
105 |
+
normativa_html = gr.HTML()
|
106 |
+
normativa_dropdown.change(fn=mostrar_detalles, inputs=normativa_dropdown, outputs=[normativa_html, None])
|
107 |
+
|
108 |
+
with gr.Row():
|
109 |
+
gr.Markdown("## Red de Aportes:")
|
110 |
+
graph_output = gr.Image(visualizar_grafo(), label="Red de Aportes")
|
111 |
+
|
112 |
+
with gr.Row():
|
113 |
+
nombre = gr.Dropdown(choices=student_names, label="Nombre del Estudiante")
|
114 |
+
enfoque = gr.Radio(["Determinista", "Sist茅mico"], label="Enfoque")
|
115 |
+
|
116 |
+
with gr.Row():
|
117 |
+
norma_field = gr.Textbox(label="Norma", interactive=False) # Read-only
|
118 |
+
texto = gr.Textbox(label="Tu aporte")
|
119 |
+
|
120 |
+
submit_button = gr.Button("Agregar Aporte")
|
121 |
+
|
122 |
+
normativa_dropdown.change(fn=mostrar_detalles, inputs=normativa_dropdown, outputs=[normativa_html, norma_field])
|
123 |
+
submit_button.click(fn=agregar_aporte, inputs=[nombre, enfoque, norma_field, texto], outputs=graph_output)
|
124 |
|
125 |
iface.launch(share=True)
|