Spaces:
Runtime error
Runtime error
Commit
·
b523b2d
1
Parent(s):
1156b48
Update app.py
Browse files
app.py
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
from transformers import AutoTokenizer, AutoModelForSequenceClassification
|
2 |
from scipy.special import expit
|
3 |
import numpy as np
|
|
|
4 |
|
5 |
# set up model
|
6 |
auth_token = os.environ.get("TOKEN") or True
|
@@ -9,9 +10,9 @@ model = AutoModelForSequenceClassification.from_pretrained("guidecare/feelings_a
|
|
9 |
all_label_names = list(model.config.id2label.values())
|
10 |
|
11 |
|
12 |
-
def probs(
|
13 |
-
probs = expit(model(**tokenizer(texts, return_tensors="pt", padding=True)).logits.detach().numpy())
|
14 |
-
return list(zip(all_label_names, probs))
|
15 |
|
16 |
iface = gr.Interface(
|
17 |
fn=predict,
|
|
|
1 |
from transformers import AutoTokenizer, AutoModelForSequenceClassification
|
2 |
from scipy.special import expit
|
3 |
import numpy as np
|
4 |
+
import os
|
5 |
|
6 |
# set up model
|
7 |
auth_token = os.environ.get("TOKEN") or True
|
|
|
10 |
all_label_names = list(model.config.id2label.values())
|
11 |
|
12 |
|
13 |
+
def probs(text):
|
14 |
+
probs = expit(model(**tokenizer([texts], return_tensors="pt", padding=True)).logits.detach().numpy())
|
15 |
+
return list(zip(all_label_names, probs[0]))
|
16 |
|
17 |
iface = gr.Interface(
|
18 |
fn=predict,
|