Spaces:
Build error
Build error
File size: 1,009 Bytes
ab29a45 8360753 ab29a45 8360753 c89d92c |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
import streamlit as st
from transformers import pipeline
# widget for selecting langugae model
# available sentiment analysis models: https://huggingface.co/models?pipeline_tag=text-classification&sort=downloads&search=sentiment
# we take the first 5 most downloaded ones.
language_model = st.selectbox(
"Select the Pretrained Language Model you'd like to use",
(
"finiteautomata/bertweet-base-sentiment-analysis",
"siebert/sentiment-roberta-large-english",
"cardiffnlp/twitter-roberta-base-sentiment",
"Seethal/sentiment_analysis_generic_dataset",
"nlptown/bert-base-multilingual-uncased-sentiment",
),
)
# pass the model to transformers pipeline - model selection component.
sentiment_analysis = pipeline(model=language_model)
# get text entry from users
data = st.text_input(
"Enter Text", "Just started school at NYU! Looking forward to this new chapter!"
)
if st.button("Submit"):
results = sentiment_analysis([data])
st.write(results)
|