kyled's picture
added tensorflow
31cc01d
raw
history blame
848 Bytes
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
# )