| import streamlit as st | |
| from transformers import pipeline | |
| # Load sentiment analysis pipeline | |
| pipe = pipeline("text-classification", model="tabularisai/multilingual-sentiment-analysis", device=1) | |
| # Streamlit UI | |
| st.title("Sentiment Analyzer") | |
| st.write("Enter your message below:") | |
| user_input = st.text_input("You:", "") | |
| if st.button("Submit") and user_input: | |
| response = pipe(user_input)[0] | |
| label = response['label'] | |
| score = response['score'] | |
| st.write(f"**Label:** {label}") | |
| st.write(f"**Score:** {score:.4f}") | |