CesarLeblanc commited on
Commit
fc3586c
1 Parent(s): 299be87

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
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 += ', [MASK] [MASK]'
56
- pred = model(text, top_k=1)
57
- text = pred["sequence"]
58
- #text = pred[0]["sequence"]
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