Spaces:
Runtime error
Runtime error
added senitment task
Browse files
app.py
CHANGED
@@ -8,16 +8,21 @@ with st.spinner(text="Loading model..."):
|
|
8 |
classifier = t.pipeline("zero-shot-classification",
|
9 |
model="facebook/bart-large-mnli",
|
10 |
multi_class=True)
|
|
|
|
|
|
|
|
|
11 |
|
12 |
x = st.text_input("Enter your title here:")
|
13 |
candidate_labels = ['anger', 'sadness', 'fear', 'joy', 'interest',
|
14 |
-
'surprise', 'disgust', 'shame', '
|
15 |
|
16 |
if x != "":
|
17 |
|
18 |
with st.spinner(text="Evaluating your input..."):
|
19 |
output = classifier(x, candidate_labels)
|
20 |
-
|
|
|
21 |
|
22 |
ordered_results = []
|
23 |
for lbl in candidate_labels:
|
|
|
8 |
classifier = t.pipeline("zero-shot-classification",
|
9 |
model="facebook/bart-large-mnli",
|
10 |
multi_class=True)
|
11 |
+
sentiment_task = t.pipeline("sentiment-analysis",
|
12 |
+
model="cardiffnlp/twitter-xlm-roberta-base-sentiment",
|
13 |
+
tokenizer="cardiffnlp/twitter-xlm-roberta-base-sentiment")
|
14 |
+
|
15 |
|
16 |
x = st.text_input("Enter your title here:")
|
17 |
candidate_labels = ['anger', 'sadness', 'fear', 'joy', 'interest',
|
18 |
+
'surprise', 'disgust', 'shame', 'compassion', 'other']
|
19 |
|
20 |
if x != "":
|
21 |
|
22 |
with st.spinner(text="Evaluating your input..."):
|
23 |
output = classifier(x, candidate_labels)
|
24 |
+
sentiment = sentiment_task(x)
|
25 |
+
st.write(str(sentiment))
|
26 |
|
27 |
ordered_results = []
|
28 |
for lbl in candidate_labels:
|