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

added explain

Browse files
Files changed (1) hide show
  1. app.py +1 -3
app.py CHANGED
@@ -163,13 +163,12 @@ def sequence_to_classify(sequence, labels):
163
  sequence,
164
  predicted_labels))
165
 
166
- '''
167
  # Explain word attributes
168
  stop_words = nltk.corpus.stopwords.words('english')
169
  puncts = list(string.punctuation)
170
 
171
  model_expl = ZeroShotClassificationExplainer(classifier.model, classifier.tokenizer)
172
- response_expl = model_expl(sequence, labels, hypothesis_template="This example is {}.")
173
 
174
  if len(labels_pred) == 1:
175
  response_expl = response_expl[model_expl.predicted_label]
@@ -180,7 +179,6 @@ def sequence_to_classify(sequence, labels):
180
  del response_expl[key][idx]
181
 
182
  print(response_expl)
183
- '''
184
 
185
  return clean_output
186
 
 
163
  sequence,
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]
 
179
  del response_expl[key][idx]
180
 
181
  print(response_expl)
 
182
 
183
  return clean_output
184