File size: 618 Bytes
c99725e | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | 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 <mask>.",
"The largest planet in our solar system is <mask>.",
"The chemical symbol for water is <mask>.",
"The president of the United States is <mask>."
]
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()
|