|
|
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() |
|
|
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") |
|
|
|
|
|
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() |
|
|
|