soarhigh commited on
Commit
af40275
·
1 Parent(s): e1e2421

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -1
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
- return [token, shap for token, shap in list(zip(tokens, shaps))]
 
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
  [