File size: 547 Bytes
e164004
1e9c534
e164004
1e9c534
 
 
 
eb78a1d
1e9c534
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import streamlit as st
from transformers import pipeline

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("userinput")
if user_input:
    result = sentiment_pipeline(user_input)
    sentiment = result[0]["label"]
    confidence = result[0]["score"]

    st.write(f"Sentiment: {sentiment}")
    st.write(f"Confidence: {confidence:.2f}")

# x = st.slider('Select a value')
# st.write(x, 'squared is', x * x)