Demo-app / app.py
Divyansh Kushwaha
m
1364bb1
raw
history blame contribute delete
542 Bytes
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}")