istassiy commited on
Commit
4915257
·
1 Parent(s): 9ce6d53

commit from

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -1,6 +1,5 @@
1
  import streamlit as st
2
  import numpy as np
3
- import torch
4
 
5
  my_model_name = "istassiy/ysda_2022_ml2_hw3_distilbert_base_uncased"
6
 
@@ -45,8 +44,11 @@ def load_model():
45
  model = AutoModel.from_pretrained(my_model_name)
46
  return tokenizer, model
47
 
 
 
 
48
  def get_top_predictions(predictions):
49
- probs = (torch.sigmoid(predictions) > 0).int().numpy()
50
  probs = probs / np.sum(probs)
51
 
52
  res = {}
 
1
  import streamlit as st
2
  import numpy as np
 
3
 
4
  my_model_name = "istassiy/ysda_2022_ml2_hw3_distilbert_base_uncased"
5
 
 
44
  model = AutoModel.from_pretrained(my_model_name)
45
  return tokenizer, model
46
 
47
+ def sigmoid(x):
48
+ return 1/(1 + np.exp(-x))
49
+
50
  def get_top_predictions(predictions):
51
+ probs = (sigmoid(predictions) > 0).astype(int)
52
  probs = probs / np.sum(probs)
53
 
54
  res = {}