Spaces:
Runtime error
Runtime error
import streamlit as st | |
from transformers import pipeline | |
# Create a Streamlit app | |
st.title("Text Classification with Hugginface: sentiment analysis case") | |
# Get user input | |
text = st.text_input("Enter some text to classify:") | |
#pipeline for sentiment analysis | |
sentiment = pipeline("sentiment-analysis", model="distilbert-base-uncased-finetuned-sst-2-english") | |
#Print the sentiment and the corresponding score when the button is clicked | |
if st.button('Click to get the sentiment'): | |
output = sentiment(text) | |
st.write("The sentiment is ",output[0]['label'].lower(),' avec un score ', output[0]['score']) |