Spaces:
Sleeping
Sleeping
Commit
·
3f27f6d
1
Parent(s):
18c35a9
Update app.py
Browse files
app.py
CHANGED
@@ -7,9 +7,9 @@ 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(
|
11 |
|
12 |
-
model_name =
|
13 |
model = AutoModelForSequenceClassification.from_pretrained(model_name)
|
14 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
15 |
|
@@ -46,7 +46,7 @@ def multi_label_emotions(text):
|
|
46 |
|
47 |
demo = gr.Interface(multi_label_emotions, inputs=gr.Textbox(),
|
48 |
outputs = gr.Label(num_top_classes=16),
|
49 |
-
title=
|
50 |
|
51 |
-
if __name__ ==
|
52 |
demo.launch(debug=True)
|
|
|
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)
|
14 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
15 |
|
|
|
46 |
|
47 |
demo = gr.Interface(multi_label_emotions, inputs=gr.Textbox(),
|
48 |
outputs = gr.Label(num_top_classes=16),
|
49 |
+
title="Multi-label-emotion-classification")
|
50 |
|
51 |
+
if __name__ == "__main__":
|
52 |
demo.launch(debug=True)
|