Spaces:
Runtime error
Runtime error
File size: 609 Bytes
8741f92 cfd743d 8741f92 718c1da 8741f92 718c1da cfd743d 718c1da d75d148 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
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']) |