paragon-analytics commited on
Commit
0fe615b
1 Parent(s): 88751d6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -3
app.py CHANGED
@@ -4,7 +4,6 @@ import shap
4
  import numpy as np
5
  import scipy as sp
6
  import torch
7
- import tensorflow as tf
8
  import transformers
9
  from transformers import pipeline
10
  from transformers import RobertaTokenizer, RobertaModel
@@ -51,8 +50,8 @@ ner_pipe = pipeline("ner", model=ner_model, tokenizer=ner_tokenizer, aggregation
51
  def adr_predict(x):
52
  encoded_input = tokenizer(x, return_tensors='pt')
53
  output = model(**encoded_input)
54
- scores = output[0][0].detach().numpy()
55
- scores = tf.nn.softmax(scores)
56
 
57
  shap_values = explainer([str(x).lower()])
58
  # # Find the index of the class you want as the default reference (e.g., 'label_1')
 
4
  import numpy as np
5
  import scipy as sp
6
  import torch
 
7
  import transformers
8
  from transformers import pipeline
9
  from transformers import RobertaTokenizer, RobertaModel
 
50
  def adr_predict(x):
51
  encoded_input = tokenizer(x, return_tensors='pt')
52
  output = model(**encoded_input)
53
+ scores = output[0][0].detach()
54
+ scores = torch.nn.functional.softmax(scores)
55
 
56
  shap_values = explainer([str(x).lower()])
57
  # # Find the index of the class you want as the default reference (e.g., 'label_1')