Spaces:
Runtime error
Runtime error
kaushikbar
commited on
Commit
·
55a71ee
1
Parent(s):
f4a38d2
removed explain
Browse files
app.py
CHANGED
|
@@ -163,17 +163,14 @@ def sequence_to_classify(sequence, labels):
|
|
| 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 |
-
print("Here***")
|
| 172 |
response_expl = model_expl(sequence, label_clean, hypothesis_template="This example is {}.")
|
| 173 |
|
| 174 |
-
print("***Length of predicted_label", len(model_expl.predicted_label))
|
| 175 |
-
print(response_expl)
|
| 176 |
-
|
| 177 |
if len(predicted_labels) == 1:
|
| 178 |
response_expl = response_expl[model_expl.predicted_label]
|
| 179 |
|
|
@@ -183,6 +180,7 @@ def sequence_to_classify(sequence, labels):
|
|
| 183 |
del response_expl[key][idx]
|
| 184 |
|
| 185 |
print(response_expl)
|
|
|
|
| 186 |
|
| 187 |
return clean_output
|
| 188 |
|
|
|
|
| 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, label_clean, hypothesis_template="This example is {}.")
|
| 173 |
|
|
|
|
|
|
|
|
|
|
| 174 |
if len(predicted_labels) == 1:
|
| 175 |
response_expl = response_expl[model_expl.predicted_label]
|
| 176 |
|
|
|
|
| 180 |
del response_expl[key][idx]
|
| 181 |
|
| 182 |
print(response_expl)
|
| 183 |
+
'''
|
| 184 |
|
| 185 |
return clean_output
|
| 186 |
|