Spaces:
Runtime error
Runtime error
commit from
Browse files
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 = (
|
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 = {}
|