|
import streamlit as st |
|
from transformers import pipeline |
|
from transformers import AutoModelForSequenceClassification, AutoTokenizer |
|
|
|
|
|
classifier = pipeline("text-classification", model = "MarieAngeA13/Sentiment-Analysis-BERT") |
|
|
|
|
|
st.title('Sentiment Analysis with BERT') |
|
st.write('Enter some text and we will predict its sentiment!') |
|
|
|
|
|
text_input = st.text_input('Enter text here') |
|
|
|
|
|
|
|
if st.button('Submit'): |
|
|
|
output = classifier(text_input) |
|
|
|
best_prediction = output[0] |
|
sentiment = best_prediction['label'] |
|
confidence = best_prediction['score'] |
|
|
|
|
|
st.write(f'Sentiment: {sentiment}') |
|
st.write(f'Confidence: {round(confidence, 2)}') |