Spaces:
Runtime error
Runtime error
Commit
·
a100b48
1
Parent(s):
5ae3e72
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,7 +4,8 @@ from transformers import pipeline
|
|
| 4 |
unmasker = pipeline('fill-mask', model='bert-large-uncased')
|
| 5 |
|
| 6 |
def fill_mask(sentence):
|
| 7 |
-
|
|
|
|
| 8 |
return [result['sequence'] for result in results]
|
| 9 |
|
| 10 |
inputs = gr.inputs.Textbox(label="Enter a sentence with a masked word")
|
|
|
|
| 4 |
unmasker = pipeline('fill-mask', model='bert-large-uncased')
|
| 5 |
|
| 6 |
def fill_mask(sentence):
|
| 7 |
+
masked_sentence = sentence.replace("[MASK]", unmasker.tokenizer.mask_token)
|
| 8 |
+
results = unmasker(masked_sentence)
|
| 9 |
return [result['sequence'] for result in results]
|
| 10 |
|
| 11 |
inputs = gr.inputs.Textbox(label="Enter a sentence with a masked word")
|