tt-ai / app.py
Kingston Yip
updates
6f318d4
raw
history blame
619 Bytes
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", ["distilbert-base-uncased-finetuned-sst-2-english", "nlptown/bert-base-multilingual-uncased-sentiment"])
#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, model=model)
st.json(out)