import torch import gradio as gr from transformers import pipeline pipe = pipeline("fill-mask") def filling(text): result = pipe(text)[0]['sequence'] return result examples = [ "The capital of France is .", "The largest planet in our solar system is .", "The chemical symbol for water is .", "The president of the United States is ." ] title= "Fill-in-the-blank" description = "This model fills the missing word in the sentence" iface = gr.Interface(fn=filling, inputs="text", outputs="text", examples=examples, title = title, description = description) iface.launch()