versae commited on
Commit
e897077
1 Parent(s): adb76f9

Fixes XNLI labels

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -54,9 +54,9 @@ def load_model_pair_classification(text, model_url_pair_classification):
54
  tokenizer = AutoTokenizer.from_pretrained(model_url)
55
  nlp = pipeline("text-classification", model=model, tokenizer=tokenizer)
56
  result = nlp(f"{text}</s>")
57
- if result[0]["label"] == "LABEL_0":
58
  return f"Entailment: {result[0]['score']:02f}"
59
- if result[0]["label"] == "LABEL_1":
60
  return f"Neutral: {result[0]['score']:02f}"
61
  return f"Contradiction: {result[0]['score']:02f}"
62
 
 
54
  tokenizer = AutoTokenizer.from_pretrained(model_url)
55
  nlp = pipeline("text-classification", model=model, tokenizer=tokenizer)
56
  result = nlp(f"{text}</s>")
57
+ if result[0]["label"] == "entailment":
58
  return f"Entailment: {result[0]['score']:02f}"
59
+ if result[0]["label"] == "neutral":
60
  return f"Neutral: {result[0]['score']:02f}"
61
  return f"Contradiction: {result[0]['score']:02f}"
62