File size: 848 Bytes
1e6c35c
4d85e89
31cc01d
1e6c35c
4d85e89
 
 
 
 
 
 
 
 
31cc01d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import streamlit as st
import transformers as t
import plotly.graph_objects as go

st.title("Phrase Feeling Analysis")
classifier = t.pipeline("zero-shot-classification",
                        model="facebook/bart-large-mnli")

x = st.text_input("Enter your title here:")

candidate_labels = ['anger', 'sadness', 'fear', 'joy', 'interest',
                    'surprise', 'disgust', 'shame', 'guilt', 'compassion', 'other']
output = classifier(x, candidate_labels)
# st.write(output)

for i in range(len(candidate_labels)):
    st.write(candidate_labels[i] + ": " + str(output[i]))

# fig = go.Figure(data=go.Scatterpolar(
#     r=[1, 5, 2, 2, 3],
#     theta=candidate_labels,
#     fill='toself'
# ))

# fig.update_layout(
#     polar=dict(
#         radialaxis=dict(
#             visible=True
#         ),
#     ),
#     showlegend=False
# )