File size: 851 Bytes
0e46a6f
 
 
 
 
 
 
 
b241691
e25cffd
 
0e46a6f
 
 
 
 
 
 
e25cffd
0e46a6f
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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)
    for output in analysis:
        to_output = "Sentiment: ", output["label"], " Score: ", output["score"]
        st.markdown(to_output)


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(placeholder="I Love Pizza")
model_picked = st.selectbox(
    "Choose a model to run on", options=models_available.keys())

st.button("Submit", run_model())