import gradio as gr from models import MODELS, PIPELINES def predict(text: str, model_name: str) -> str: return PIPELINES[model_name](text) with gr.Blocks(title="CLARIN-PL Dialogue System Modules") as demo: gr.Markdown("Dialogue State Tracking Modules") for model_name in MODELS: with gr.Row(): gr.Markdown(f"## {model_name}") model_name_component = gr.Textbox(value=model_name, visible=False) with gr.Row(): text_input = gr.Textbox(label="Input Text", value=MODELS[model_name]["default_input"]) output = gr.Textbox(label="Slot Value", value="") with gr.Row(): predict_button = gr.Button("Predict") predict_button.click(fn=predict, inputs=[text_input, model_name_component], outputs=output) demo.queue(concurrency_count=3) demo.launch()