Spaces:
Runtime error
Runtime error
import streamlit as st | |
from transformers import pipeline | |
def run_model(): | |
classifier = pipeline(task="sentiment-analysis", | |
model=models_available[model_picked]) | |
analysis = classifier(text_input) | |
st.markdown("Sentiment: ", analysis["label"], "Score: ", analysis["score"]) | |
models_available = {"Roberta Large English": "siebert/sentiment-roberta-large-english", | |
"Generic": "Seethal/sentiment_analysis_generic_dataset", | |
"Twitter Roberta": "cardiffnlp/twitter-roberta-base-sentiment"} | |
st.title("Sentiment Analysis Web Application") | |
text_input = st.text_area("I love Pizza") | |
model_picked = st.selectbox( | |
"Choose a model to run on", options=models_available.keys()) | |
st.button("Submit", run_model()) | |
run_model() | |