Spaces:
Runtime error
Runtime error
CesarLeblanc
commited on
Commit
•
fc3586c
1
Parent(s):
299be87
Update app.py
Browse files
app.py
CHANGED
@@ -52,10 +52,10 @@ def classification(text, typology, confidence, task):
|
|
52 |
|
53 |
def masking(text, task):
|
54 |
model = return_model(task)
|
55 |
-
text
|
56 |
-
pred = model(
|
57 |
-
|
58 |
-
|
59 |
image = gr.Image(value="https://www.salonlfc.com/wp-content/uploads/2018/01/image-not-found-scaled-1150x647.png")
|
60 |
return text, image
|
61 |
|
|
|
52 |
|
53 |
def masking(text, task):
|
54 |
model = return_model(task)
|
55 |
+
masked_text = text + ', [MASK] [MASK]'
|
56 |
+
pred = model(masked_text, top_k=1)
|
57 |
+
new_species = [pred[i][0]['token_str'] for i in range(len(pred))]
|
58 |
+
text = text + ', ' + ' '.join(new_species)
|
59 |
image = gr.Image(value="https://www.salonlfc.com/wp-content/uploads/2018/01/image-not-found-scaled-1150x647.png")
|
60 |
return text, image
|
61 |
|