Spaces:
Sleeping
Sleeping
abdulmatinomotoso
commited on
Commit
•
a843c60
1
Parent(s):
d886294
Update app.py
Browse files
app.py
CHANGED
@@ -7,7 +7,7 @@ import torch
|
|
7 |
|
8 |
target_list = ["Playful", "Infuriating", "Sentimental", "Cynical", "Depressing", "Awe-inspiring", "Patriotic", "Begrudging", "Educational", "Hopeful",
|
9 |
"Sarcastic", "Disrespectful", "Disparaging"]
|
10 |
-
device = torch.device('cuda' if torch.cuda.is_available() else 'CPU')
|
11 |
|
12 |
model_name = "valurank/finetuned-distilbert-multi-label-emotion"
|
13 |
model = AutoModelForSequenceClassification.from_pretrained(model_name)
|
@@ -20,7 +20,7 @@ def get_probs(logits, threshold=0.5):
|
|
20 |
|
21 |
def multi_label_emotions(text):
|
22 |
inputs = tokenizer(text, return_tensors="pt", truncation=True)
|
23 |
-
model.to(device)
|
24 |
|
25 |
with torch.no_grad():
|
26 |
logits = model(**inputs).logits
|
|
|
7 |
|
8 |
target_list = ["Playful", "Infuriating", "Sentimental", "Cynical", "Depressing", "Awe-inspiring", "Patriotic", "Begrudging", "Educational", "Hopeful",
|
9 |
"Sarcastic", "Disrespectful", "Disparaging"]
|
10 |
+
#device = torch.device('cuda' if torch.cuda.is_available() else 'CPU')
|
11 |
|
12 |
model_name = "valurank/finetuned-distilbert-multi-label-emotion"
|
13 |
model = AutoModelForSequenceClassification.from_pretrained(model_name)
|
|
|
20 |
|
21 |
def multi_label_emotions(text):
|
22 |
inputs = tokenizer(text, return_tensors="pt", truncation=True)
|
23 |
+
#model.to(device)
|
24 |
|
25 |
with torch.no_grad():
|
26 |
logits = model(**inputs).logits
|