Spaces:
Runtime error
Runtime error
| 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() | |