kyled's picture
added plotly_chart to frontend
0885d54
raw
history blame
690 Bytes
import streamlit as st
import transformers as t
import plotly.express as px
import pandas as pd
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(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)