Spaces:
Sleeping

imalaiyke's picture
Rename ikeapp.py to app.py
9b85838 verified
Raw History Blame Contribute Delete
702 Bytes
import streamlit as st
from transformers import pipeline
# Load Hugging Face Sentiment Analysis pipeline
sentiment_pipeline = pipeline("sentiment-analysis")
# Streamlit app title
st.title("Sentiment Analysis with Hugging Face")
# Input text box
input_text = st.text_area("Enter text to analyze:")
# Analyze button
if st.button("Analyze Sentiment"):
if input_text:
# Perform sentiment analysis
result = sentiment_pipleline(input_text)
# Display the result
label = result[0]['label']
score = result[0]['score']
st.write(f"*Sentiment*: {label}")
st.write(f"*Confidence*: {score:.2f}")
else:
st.write("Please enter some text.")