CoolFace
Apppublic

Sahar7888/Fill_Mask

sourceHugging Faceapache-2.0updated 2y agoView on Hugging Face
0likes
app.py21 linesDownload Raw Back to root
1import torch2import gradio as gr3from transformers import pipeline4 5pipe = pipeline("fill-mask")6 7def filling(text):8   result = pipe(text)[0]['sequence']9   return result10 11examples = [12    "The capital of France is <mask>.",13    "The largest planet in our solar system is <mask>.",14    "The chemical symbol for water is <mask>.",15    "The president of the United States is <mask>."16]17title= "Fill-in-the-blank"18description = "This model fills the missing word in the sentence"19iface = gr.Interface(fn=filling, inputs="text", outputs="text", examples=examples, title = title, description = description)20iface.launch()21