File size: 561 Bytes
efd9310
cb7384e
efd9310
cb7384e
6f75e95
df8416a
 
6f75e95
82e64f5
dd46dba
0b5e516
100da0b
 
a9b0b23
 
100da0b
a9b0b23
 
0b5e516
100da0b
6f75e95
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import gradio as gr
from transformers import pipeline

def mask(text):
    mask_model = pipeline("fill-mask", model="google-bert/bert-base-uncased")
    output = mask_model(text)
    return output[0]['sequence']


# Gradio UI
examples=[['Today I went to [MASK] after I got out of bed.']]
ui = gr.Interface(
    fn=mask,
    inputs="textbox",
    outputs="textbox",
    submit_btn="Predict",
    title="BERT Test - Zircon.tech",
    description="Enter some text with [MASK] to let BERT guess the missing word!",
    examples=examples
    )
ui.launch(debug=True)