Spaces:
Sleeping
Sleeping
File size: 767 Bytes
7f81307 7179214 7f81307 5a3e810 7179214 6f318d4 e5df87e 6f318d4 3e1c304 1ea0270 a222015 3e1c304 e5df87e 5a3e810 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
import streamlit as st
from transformers import pipeline
pipe = pipeline(task="sentiment-analysis")
st.title("Toxic Tweets Analyzer")
image = "kanye_tweet.jpg"
st.image(image, use_column_width=True)
# create a dropdown to select the model
model = st.selectbox("Select model", ["sentiment-analysis transformer", "finiteautomata/bertweet-base-sentiment-analysis"])
#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 = None
if model == "sentiment-analysis transformer":
out = pipe(tweet)
else:
out = pipe(tweet, model="nlptown/bert-base-multilingual-uncased-sentiment")
st.json(out)
|