kaushikbar commited on
Commit
0188bfe
1 Parent(s): 4da401e

added explain

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -164,13 +164,14 @@ def sequence_to_classify(sequence, labels):
164
  predicted_labels))
165
 
166
  # Explain word attributes
167
- stop_words = nltk.corpus.stopwords.words('english')
168
  puncts = list(string.punctuation)
169
 
170
  model_expl = ZeroShotClassificationExplainer(classifier.model, classifier.tokenizer)
171
  response_expl = model_expl(sequence, label_clean, hypothesis_template="This example is {}.")
172
 
173
- if len(labels_pred) == 1:
 
174
  response_expl = response_expl[model_expl.predicted_label]
175
 
176
  for key in response_expl:
 
164
  predicted_labels))
165
 
166
  # Explain word attributes
167
+ stop_words = nltk.corpus.stopwords.words('english')
168
  puncts = list(string.punctuation)
169
 
170
  model_expl = ZeroShotClassificationExplainer(classifier.model, classifier.tokenizer)
171
  response_expl = model_expl(sequence, label_clean, hypothesis_template="This example is {}.")
172
 
173
+ print("length of predicted_label", len(model_expl.predicted_label))
174
+ if len(predicted_labels) == 1:
175
  response_expl = response_expl[model_expl.predicted_label]
176
 
177
  for key in response_expl: