poltextlab commited on
Commit
693f15c
1 Parent(s): 7ec1f1b

fix id labeling

Browse files
Files changed (1) hide show
  1. interfaces/sentiment.py +1 -1
interfaces/sentiment.py CHANGED
@@ -43,7 +43,7 @@ def predict(text, model_id, tokenizer_id):
43
  predicted_class_id = {4: 2, 5: 1}.get(predicted_class_id, 0)
44
 
45
 
46
- output_pred = {model.config.id2label[i]: predicted_class_id[i] for i in np.argsort(predicted_class_id)[::-1]}
47
 
48
 
49
  output_info = f'<p style="text-align: center; display: block">Prediction was made using the <a href="https://huggingface.co/{model_id}">{model_id}</a> model.</p>'
 
43
  predicted_class_id = {4: 2, 5: 1}.get(predicted_class_id, 0)
44
 
45
 
46
+ output_pred = model.config.id2label[predicted_class_id]
47
 
48
 
49
  output_info = f'<p style="text-align: center; display: block">Prediction was made using the <a href="https://huggingface.co/{model_id}">{model_id}</a> model.</p>'