Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -47,12 +47,25 @@ if file is not None:
|
|
47 |
positive_reviews = " ".join(df[df["Sentiment"] == "POSITIVE"]["Review"].tolist())
|
48 |
negative_reviews = " ".join(df[df["Sentiment"] == "NEGATIVE"]["Review"].tolist())
|
49 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
st.markdown(
|
51 |
-
f'<div style="background-color: #4AA6DD; color: #ffffff; padding: 6px; font-size: 20px; font-family: Verdana; font-weight: bold; text-align: center; margin-bottom: 40px; border-radius: 1rem">
|
52 |
unsafe_allow_html=True
|
53 |
)
|
54 |
-
|
55 |
-
|
|
|
|
|
|
|
|
|
56 |
|
57 |
st.markdown(
|
58 |
f'<div style="background-color: #4AA6DD; color: #ffffff; padding: 6px; font-size: 20px; font-family: Verdana; font-weight: bold; text-align: center; margin-bottom: 40px; margin-top: 60px; border-radius: 1rem"> Causes behind Negative Reviews</div>',
|
@@ -102,5 +115,5 @@ if file is not None:
|
|
102 |
data=csv,
|
103 |
file_name='Review Sentiments.csv'
|
104 |
)
|
105 |
-
st.write("<br
|
106 |
st.caption('<div style="text-align:center; background-color:#F3F4F7;padding: 6px">crafted with ❤️</div>', unsafe_allow_html=True)
|
|
|
47 |
positive_reviews = " ".join(df[df["Sentiment"] == "POSITIVE"]["Review"].tolist())
|
48 |
negative_reviews = " ".join(df[df["Sentiment"] == "NEGATIVE"]["Review"].tolist())
|
49 |
|
50 |
+
# Center-align the word clouds
|
51 |
+
css = """
|
52 |
+
.center {
|
53 |
+
display: flex;
|
54 |
+
justify-content: center;
|
55 |
+
}
|
56 |
+
"""
|
57 |
+
st.write(f'<style>{css}</style>', unsafe_allow_html=True)
|
58 |
+
|
59 |
st.markdown(
|
60 |
+
f'<div style="background-color: #4AA6DD; color: #ffffff; padding: 6px; font-size: 20px; font-family: Verdana; font-weight: bold; text-align: center; margin-bottom: 40px; border-radius: 1rem">Causes behind Positive Reviews</div>',
|
61 |
unsafe_allow_html=True
|
62 |
)
|
63 |
+
|
64 |
+
wc = WordCloud(width=600, height=300, background_color="white", colormap="winter").generate(positive_reviews)
|
65 |
+
st.image(wc.to_array(), width=500, height=250, use_column_width=True, output_format="PNG", caption="Positive Reviews Word Cloud",
|
66 |
+
channels="RGB", clamp=False, format="PNG", caption_position="centered", use_video_player=False,
|
67 |
+
allow_stretch=False, alt_text=None, key=None, caption_style="default", container_width=None,
|
68 |
+
quality=None, use_pixelated_dataset=None, focal_point=None)
|
69 |
|
70 |
st.markdown(
|
71 |
f'<div style="background-color: #4AA6DD; color: #ffffff; padding: 6px; font-size: 20px; font-family: Verdana; font-weight: bold; text-align: center; margin-bottom: 40px; margin-top: 60px; border-radius: 1rem"> Causes behind Negative Reviews</div>',
|
|
|
115 |
data=csv,
|
116 |
file_name='Review Sentiments.csv'
|
117 |
)
|
118 |
+
st.write("<br>", unsafe_allow_html=True)
|
119 |
st.caption('<div style="text-align:center; background-color:#F3F4F7;padding: 6px">crafted with ❤️</div>', unsafe_allow_html=True)
|