Download app.py from Sahar7888/Fill_Mask: direct link, hf CLI and curl.
- Browser
- Download file 618 Bytes
-
https://huggingface.co/spaces/Sahar7888/Fill_Mask/resolve/main/app.py
- Command line
-
hf download hf://spaces/Sahar7888/Fill_Mask/app.py
-
curl -L -o app.py https://huggingface.co/spaces/Sahar7888/Fill_Mask/resolve/main/app.py
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() | |