Spaces:
Runtime error
Runtime error
File size: 570 Bytes
20240f4 e56c4c7 3064b0d 20240f4 33b659a |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
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...")
|