Update app.py
Browse files
app.py
CHANGED
@@ -25,7 +25,8 @@ def shap(txt, tok_level):
|
|
25 |
y_pred = model(txt)
|
26 |
y_offs = model(batch)
|
27 |
shaps = (y_offs - y_pred).tolist()[0] # convert to list and make tuple to be returned
|
28 |
-
|
|
|
29 |
|
30 |
demo = gr.Interface(shap,
|
31 |
[
|
|
|
25 |
y_pred = model(txt)
|
26 |
y_offs = model(batch)
|
27 |
shaps = (y_offs - y_pred).tolist()[0] # convert to list and make tuple to be returned
|
28 |
+
labels = ["+" if s < 0 else "-" for s in shaps]
|
29 |
+
return list(zip(tokens, labels))
|
30 |
|
31 |
demo = gr.Interface(shap,
|
32 |
[
|