Fill_Mask / app.py
Sahar7888's picture
Upload app.py
c99725e verified
raw
history blame contribute delete
618 Bytes
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()