Spaces:
Runtime error
Runtime error
Edward J. Schwartz
commited on
Commit
·
9953197
1
Parent(s):
80cb7e2
debug
Browse files
app.py
CHANGED
|
@@ -123,10 +123,14 @@ with gr.Blocks() as demo:
|
|
| 123 |
}
|
| 124 |
|
| 125 |
def interpretation_function(text):
|
|
|
|
|
|
|
|
|
|
|
|
|
| 126 |
print(text, file=sys.stderr)
|
| 127 |
-
|
| 128 |
-
print(
|
| 129 |
-
explainer = shap.Explainer(
|
| 130 |
shap_values = explainer([text])
|
| 131 |
|
| 132 |
# Dimensions are (batch size, text size, number of classes)
|
|
|
|
| 123 |
}
|
| 124 |
|
| 125 |
def interpretation_function(text):
|
| 126 |
+
|
| 127 |
+
def model_wrap(input):
|
| 128 |
+
return model.fn(input)['confidences']
|
| 129 |
+
|
| 130 |
print(text, file=sys.stderr)
|
| 131 |
+
out = model_wrap(text)
|
| 132 |
+
print(out, file=sys.stderr)
|
| 133 |
+
explainer = shap.Explainer(model_wrap)
|
| 134 |
shap_values = explainer([text])
|
| 135 |
|
| 136 |
# Dimensions are (batch size, text size, number of classes)
|