File size: 457 Bytes
d841954
 
 
438301c
d841954
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import streamlit as st
from transformers import pipeline

sentiment_pipeline = pipeline("text-classification", model="kwang123/bert-sentiment-analysis")

st.title("Sentiment Analysis with HuggingFace Spaces")

user_input = st.text_input("")
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}")