geminitestapp / app.py
typesdigital's picture
Update app.py
70b6cd9 verified
raw
history blame contribute delete
500 Bytes
# app.py
import streamlit as st
from transformers import pipeline
# Load sentiment analysis pipeline
classifier = pipeline("sentiment-analysis")
def analyze_sentiment(text):
"""Analyzes the sentiment of a given text."""
result = classifier(text)
return result[0]['label'], result[0]['score']
st.title("Sentiment Analysis App")
text = st.text_area("Enter your text here:")
if st.button("Analyze"):
label, score = analyze_sentiment(text)
st.success(f"Sentiment: {label}, Score: {score}")