Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -12,13 +12,14 @@ st.write("Enter text below to analyze sentiment:")
|
|
| 12 |
user_input = st.text_area("Text input")
|
| 13 |
|
| 14 |
# Button to perform sentiment analysis
|
| 15 |
-
if st.button("
|
| 16 |
if user_input:
|
| 17 |
# Perform sentiment analysis
|
| 18 |
results = sentiment_pipeline(user_input)
|
| 19 |
# Display the results
|
| 20 |
sentiment = results[0]['label']
|
| 21 |
score = results[0]['score']
|
| 22 |
-
|
|
|
|
| 23 |
else:
|
| 24 |
st.write("Please enter some text to analyze.")
|
|
|
|
| 12 |
user_input = st.text_area("Text input")
|
| 13 |
|
| 14 |
# Button to perform sentiment analysis
|
| 15 |
+
if st.button("Analyse Sentiment"):
|
| 16 |
if user_input:
|
| 17 |
# Perform sentiment analysis
|
| 18 |
results = sentiment_pipeline(user_input)
|
| 19 |
# Display the results
|
| 20 |
sentiment = results[0]['label']
|
| 21 |
score = results[0]['score']
|
| 22 |
+
confidence_percentage = score * 100
|
| 23 |
+
st.write(f"Sentiment: {sentiment} (Confidence: {confidence_percentage:.2f}%)")
|
| 24 |
else:
|
| 25 |
st.write("Please enter some text to analyze.")
|