import gradio as gr from transformers import pipeline unmasker = pipeline('fill-mask', model="CenIA/distillbert-base-spanish-uncased") def fill_mask(text): text += " [MASK]" unmasked = unmasker(text, top_k=8) output = {} for unmask in unmasked: output[unmask["token_str"]] = unmask["score"] return output examples = [["quiero comer "], ["me gustarĂ­a ir a"]] demo = gr.Interface(fn=fill_mask, inputs=gr.Textbox(lines=1, label="Input"), outputs=gr.Label(label="Output"), examples=examples) demo.launch()