Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -2,12 +2,15 @@ import streamlit as st
|
|
2 |
from transformers import pipeline
|
3 |
|
4 |
# Create a Streamlit app
|
5 |
-
st.title("
|
6 |
|
7 |
# Get user input
|
8 |
text = st.text_input("Enter some text to classify:")
|
9 |
|
10 |
-
|
|
|
11 |
|
12 |
-
|
13 |
-
|
|
|
|
|
|
2 |
from transformers import pipeline
|
3 |
|
4 |
# Create a Streamlit app
|
5 |
+
st.title("Text Classification with Hugginface: sentiment analysis case")
|
6 |
|
7 |
# Get user input
|
8 |
text = st.text_input("Enter some text to classify:")
|
9 |
|
10 |
+
#pipeline for sentiment analysis
|
11 |
+
sentiment = pipeline("sentiment-analysis", model="distilbert-base-uncased-finetuned-sst-2-english")
|
12 |
|
13 |
+
#Print the sentiment and the corresponding score when the button is clicked
|
14 |
+
if st.button('Click to get the sentiment'):
|
15 |
+
output = sentiment(text)
|
16 |
+
st.write(output[0]['label'],' avec un score ', output[0]['score'])
|