kmanoj's picture
Update app.py
33b659a
raw
history blame
No virus
570 Bytes
import streamlit as st
from transformers import pipeline
pipe=pipeline('sentiment-analysis')
# Set the title
st.title("Sentiment Analysis")
# Input for text to analyze sentiment
text = st.text_area("Enter text for sentiment analysis:")
if text:
if st.button("Analyze Sentiment"):
out=pipe(text)
result=st.json(out)
sentiment = result["label"]
score = result["score"]
st.write(f"Sentiment: {sentiment}")
st.write(f"Sentiment Score: {score}")
# else:
# st.error("Error: Something went wrong. Please try again...")