File size: 829 Bytes
1e6c35c
4d85e89
0885d54
 
1e6c35c
4d85e89
9f4d605
 
 
 
4d85e89
 
552048c
 
4d85e89
a0667b7
552048c
 
 
 
31cc01d
a0667b7
 
 
31cc01d
a0667b7
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
import streamlit as st
import transformers as t
import plotly.express as px
import pandas as pd

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

x = st.text_input("Enter your title here:")
candidate_labels = ['anger', 'sadness', 'fear', 'joy', 'interest',
                    'surprise', 'disgust', 'shame', 'guilt', 'compassion', 'other']

if x != "":

    with st.spinner():
        output = classifier(x, candidate_labels)
    # st.write(str(output))

    df = pd.DataFrame(dict(r=output['scores'], theta=output['labels']))
    fig = px.line_polar(df, r='r', theta='theta', line_close=True)
    fig.update_traces(fill='toself')

    st.plotly_chart(fig)