File size: 1,516 Bytes
88bf058 e64350f 44a1248 362be6a 0a69342 869e72a b6e191d 86caf5e 5b7c051 94cdd7d b1cd9e6 86caf5e 1ccf5bf 86caf5e |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 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 44 45 46 47 |
import gradio as gr
import networkx as nx
from utils_gdmk import (
inicializar_grafo, cargar_vocabulario, cargar_nombres, visualizar_grafo,
agregar_aporte, reload_data
)
G = nx.DiGraph()
inicializar_grafo() # Llamar antes de mostrar el grafo
students = cargar_nombres("nombres_postdoc.txt")
VOCABULARY = cargar_vocabulario("vocabulario_postdoc.txt")
def iniciar_interfaz():
iface = gr.Blocks()
with iface:
with gr.Row():
gr.Markdown("# Diagrama de Aportes de Participantes")
with gr.Row():
gr.Markdown("## Red de Aportes:")
graph_output = gr.Image("graph.png", label="Red de Aportes") # Evita llamada prematura
with gr.Row():
nombre = gr.Dropdown(choices=students, label="Nombre del Estudiante")
with gr.Row():
texto = gr.Textbox(label="Comente aspectos que usted considerar铆a en la pol铆tica de IA en su pa铆s con el objetivo de promover la equidad y la calidad de la educaci贸n聽superior")
submit_button = gr.Button("Agregar Aporte")
submit_button.click(
fn=agregar_aporte,
inputs=[nombre, texto],
outputs=[graph_output]
)
reload_button = gr.Button("馃攧 Recargar Diagrama desde Repositorio")
reload_button.click(
fn=reload_data,
inputs=[],
outputs=[graph_output]
)
iface.launch(share=True)
if __name__ == "__main__":
iniciar_interfaz()
|