Spaces:
Sleeping
Sleeping
Commit
Β·
d6eb02e
1
Parent(s):
69722dc
Update app.py
Browse files
app.py
CHANGED
@@ -11,7 +11,7 @@ st.title("Sentiment Analysis App")
|
|
11 |
|
12 |
user_input = st.text_area("Enter a message:", height=150)
|
13 |
|
14 |
-
if st.button("Analyze Sentiment"):
|
15 |
if user_input:
|
16 |
# Perform sentiment analysis
|
17 |
st.markdown("---")
|
@@ -20,9 +20,25 @@ if st.button("Analyze Sentiment"):
|
|
20 |
sentiment_label = results[0]["label"]
|
21 |
sentiment_score = results[0]["score"]
|
22 |
|
23 |
-
st.success("Analysis Complete!")
|
24 |
st.write("")
|
25 |
|
26 |
st.subheader("Sentiment Analysis Result")
|
27 |
st.write(f"**Sentiment:** {sentiment_label}")
|
28 |
st.write(f"**Confidence Score:** {sentiment_score:.2f}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
|
12 |
user_input = st.text_area("Enter a message:", height=150)
|
13 |
|
14 |
+
if st.button("Analyze Sentiment π", key="analyze_button", help="Click to analyze sentiment"):
|
15 |
if user_input:
|
16 |
# Perform sentiment analysis
|
17 |
st.markdown("---")
|
|
|
20 |
sentiment_label = results[0]["label"]
|
21 |
sentiment_score = results[0]["score"]
|
22 |
|
23 |
+
st.success("Analysis Complete! π")
|
24 |
st.write("")
|
25 |
|
26 |
st.subheader("Sentiment Analysis Result")
|
27 |
st.write(f"**Sentiment:** {sentiment_label}")
|
28 |
st.write(f"**Confidence Score:** {sentiment_score:.2f}")
|
29 |
+
|
30 |
+
# Colorful styled button
|
31 |
+
if sentiment_label == "positive":
|
32 |
+
button_color = "#33cc33" # green color for positive sentiment
|
33 |
+
elif sentiment_label == "negative":
|
34 |
+
button_color = "#ff3333" # red color for negative sentiment
|
35 |
+
else:
|
36 |
+
button_color = "#3399ff" # blue color for neutral sentiment
|
37 |
+
|
38 |
+
st.markdown(
|
39 |
+
f'<a style="background-color:{button_color};color:white;text-decoration:none;padding:8px 12px;'
|
40 |
+
f"border-radius:5px;display:inline-block;margin-top:15px;"
|
41 |
+
f'font-weight:bold;" href="https://www.streamlit.io/">'
|
42 |
+
f'Share Analysis on Streamlit <span style="font-size:20px;">π</span></a>',
|
43 |
+
unsafe_allow_html=True,
|
44 |
+
)
|