Update app.py
Browse files
app.py
CHANGED
@@ -6,38 +6,41 @@ from utils_gdmk import (
|
|
6 |
)
|
7 |
|
8 |
G = nx.DiGraph()
|
9 |
-
inicializar_grafo() #
|
10 |
students = cargar_nombres("nombres.txt")
|
11 |
VOCABULARY = cargar_vocabulario("vocabulario_postdoc.txt")
|
12 |
|
13 |
-
|
14 |
-
|
15 |
-
with iface:
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
iface.launch(share=True)
|
|
|
|
|
|
|
|
6 |
)
|
7 |
|
8 |
G = nx.DiGraph()
|
9 |
+
inicializar_grafo() # Llamar antes de mostrar el grafo
|
10 |
students = cargar_nombres("nombres.txt")
|
11 |
VOCABULARY = cargar_vocabulario("vocabulario_postdoc.txt")
|
12 |
|
13 |
+
def iniciar_interfaz():
|
14 |
+
iface = gr.Blocks()
|
15 |
+
with iface:
|
16 |
+
with gr.Row():
|
17 |
+
gr.Markdown("# Diagrama de Aportes de Participantes")
|
18 |
+
|
19 |
+
with gr.Row():
|
20 |
+
gr.Markdown("## Red de Aportes:")
|
21 |
+
graph_output = gr.Image("graph.png", label="Red de Aportes") # Evita llamada prematura
|
22 |
+
|
23 |
+
with gr.Row():
|
24 |
+
nombre = gr.Dropdown(choices=students, label="Nombre del Estudiante")
|
25 |
+
|
26 |
+
with gr.Row():
|
27 |
+
texto = gr.Textbox(label="Tu aporte")
|
28 |
+
|
29 |
+
submit_button = gr.Button("Agregar Aporte")
|
30 |
+
submit_button.click(
|
31 |
+
fn=agregar_aporte,
|
32 |
+
inputs=[nombre, texto],
|
33 |
+
outputs=[graph_output]
|
34 |
+
)
|
35 |
+
|
36 |
+
reload_button = gr.Button("🔄 Recargar Diagrama desde Repositorio")
|
37 |
+
reload_button.click(
|
38 |
+
fn=reload_data,
|
39 |
+
inputs=[],
|
40 |
+
outputs=[graph_output]
|
41 |
+
)
|
42 |
+
|
43 |
+
iface.launch(share=True)
|
44 |
+
|
45 |
+
if __name__ == "__main__":
|
46 |
+
iniciar_interfaz()
|