chaoshunh/myspace1
0
1import streamlit as st2from transformers import pipeline3 4sentiment_pipeline = pipeline("sentiment-analysis")5 6st.title("Sentiment Analysis with HuggingFace Spaces")7st.write("Enter a sentence to analyze its sentiment:")8 9user_input = st.text_input("")10if user_input:11 result = sentiment_pipeline(user_input)12 sentiment = result[0]["label"]13 confidence = result[0]["score"]14 15 st.write(f"Sentiment: {sentiment}")16 st.write(f"Confidence: {confidence:.2f}")17 