import numpy as np import pandas as pd from transformers import pipeline from transformers import AutoTokenizer, TFAutoModelForSequenceClassification import streamlit as st classifier = pipeline("sentiment-analysis") model_name ="distilbert-base-uncased-finetuned-sst-2-english" tokenizer = AutoTokenizer.from_pretrained(model_name) model = TFAutoModelForSequenceClassification.from_pretrained(model_name) classifier = pipeline("sentiment-analysis", model=model, tokenizer=tokenizer) print(classifier("Thanks a lot for watching the video. Really appreciate it")) st.title("Sentiment Analysis of a Tweet") tweet = st.text_input(label="Tweet Text") if(st.button("Analyze")): sentiment = classifier(tweet) st.write(sentiment[0]['label'])