Spaces:
Sleeping
Sleeping
import streamlit as st | |
from transformers import pipeline | |
pipe = pipeline(task="sentiment-analysis") | |
st.title("Toxic Tweets Analyzer") | |
#form | |
with st.form("my_form"): | |
submitted = st.form_submit_button("Analyze") | |
tweet = st.text_area("enter tweet here:", value="i'm nice at ping pong") | |
if submitted: | |
out = pipe(tweet) | |
# print out nicely | |
sentiment = out[0]['label'] | |
score = out[0]['score'] | |
print(f"{tweet} \nsentiment: {sentiment} \nscore: {score}") | |