Spaces:
Sleeping
Sleeping
zaeemzafar
commited on
Commit
•
e1d047e
1
Parent(s):
6cef653
Update app.py
Browse files
app.py
CHANGED
@@ -10,6 +10,10 @@ model = AutoModelForMaskedLM.from_pretrained(model_name)
|
|
10 |
nlp = pipeline("fill-mask", model=model, tokenizer=tokenizer)
|
11 |
|
12 |
def predict(text):
|
|
|
|
|
|
|
|
|
13 |
# Process the text using the model
|
14 |
result = nlp(text)
|
15 |
return result
|
@@ -23,4 +27,4 @@ iface = gr.Interface(
|
|
23 |
description="Test BlueBERT on biomedical data or general text"
|
24 |
)
|
25 |
|
26 |
-
iface.launch(
|
|
|
10 |
nlp = pipeline("fill-mask", model=model, tokenizer=tokenizer)
|
11 |
|
12 |
def predict(text):
|
13 |
+
# Check if the input text contains the [MASK] token
|
14 |
+
if "[MASK]" not in text:
|
15 |
+
return "Error: Please enter a sentence containing a [MASK] token."
|
16 |
+
|
17 |
# Process the text using the model
|
18 |
result = nlp(text)
|
19 |
return result
|
|
|
27 |
description="Test BlueBERT on biomedical data or general text"
|
28 |
)
|
29 |
|
30 |
+
iface.launch()
|