Spaces:
Paused
Paused
from transformers import pipeline | |
# x = st.slider('Select a value') | |
# st.write(x, 'squared is', x * x) | |
def sentimentAnalysis(user_input): | |
sentiment_pipeline = pipeline("sentiment-analysis") | |
#st.title("Sentiment Analysis with HuggingFace Spaces") | |
#st.write("Enter a sentence to analyze its sentiment:") | |
#user_input = st.text_input("") | |
if user_input: | |
result = sentiment_pipeline(user_input) | |
sentiment = result[0]["label"] | |
confidence = result[0]["score"] | |
return {"Sentiment": sentiment, "Confidence":confidence } | |
#st.write(f"Sentiment: {sentiment}") | |
#st.write(f"Confidence: {confidence:.2f}") |