Spaces:
Runtime error
Runtime error
Commit
·
cdabe68
1
Parent(s):
b40a668
Update app.py
Browse files
app.py
CHANGED
@@ -1,9 +1,13 @@
|
|
1 |
-
import
|
2 |
from transformers import pipeline
|
3 |
|
4 |
unmasker = pipeline('fill-mask', model='bert-large-uncased')
|
5 |
-
user_input = input("Enter a sentence with a masked word: ")
|
6 |
-
results = unmasker(user_input)
|
7 |
|
8 |
-
|
9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
from transformers import pipeline
|
3 |
|
4 |
unmasker = pipeline('fill-mask', model='bert-large-uncased')
|
|
|
|
|
5 |
|
6 |
+
def fill_mask(sentence):
|
7 |
+
results = unmasker(sentence)
|
8 |
+
return [result['sequence'] for result in results]
|
9 |
+
|
10 |
+
inputs = gr.inputs.Textbox(label="Enter a sentence with a masked word")
|
11 |
+
outputs = gr.outputs.Textbox(label="Predicted sequences")
|
12 |
+
|
13 |
+
gr.Interface(fn=fill_mask, inputs=inputs, outputs=outputs).launch()
|