File size: 801 Bytes
00a31fe
 
dc7ce01
00a31fe
 
 
55ec42e
00a31fe
 
dc7ce01
6ef6e5f
00a31fe
 
 
 
6ef6e5f
55ec42e
 
 
 
00a31fe
6ef6e5f
00a31fe
 
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
import gradio as gr

from models import DST_MODELS, PIPELINES


def predict(text: str, model_name: str) -> str:
    return PIPELINES[model_name](text)


with gr.Blocks(title="CLARIN-PL DST Modules") as demo:
    for model_name in DST_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=DST_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()