Uvini commited on
Commit
23a34ee
·
1 Parent(s): e44ad9a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -10
app.py CHANGED
@@ -25,7 +25,7 @@ if file is not None:
25
 
26
  # Write the total number of records
27
  st.markdown(
28
- f'<div style="background-color: #234A21; color: #ffffff; padding: 8px; font-size: 30px; font-family: Open-Sans; font-weight: bold; text-align: center;"> {len(df)} reviews to analyse!</div>',
29
  unsafe_allow_html=True
30
  )
31
 
@@ -34,7 +34,7 @@ if file is not None:
34
 
35
  # Generate pie chart
36
  # Define custom colors
37
- colors = ['#FFC845', '#52565E']
38
 
39
  # Generate pie chart
40
  sentiment_counts = df["Sentiment"].value_counts()
@@ -47,22 +47,22 @@ if file is not None:
47
  negative_reviews = " ".join(df[df["Sentiment"] == "NEGATIVE"]["Review"].tolist())
48
 
49
  st.markdown(
50
- f'<div style="background-color: #FFC845; color: #ffffff; padding: 6px; font-size: 20px; font-family: Open-Sans; font-weight: bold; text-align: center; margin-bottom: 40px;"> Causes behind Positive Reviews</div>',
51
  unsafe_allow_html=True
52
  )
53
- wc = WordCloud(width=800, height=400, background_color="white", colormap="Greens").generate(positive_reviews)
54
- st.image(wc.to_array(),use_column_width=True)
55
 
56
  st.markdown(
57
- f'<div style="background-color: #52565E; color: #ffffff; padding: 6px; font-size: 20px; font-family: Open-Sans; font-weight: bold; text-align: center; margin-bottom: 40px; margin-top: 60px;"> Causes behind Negative Reviews</div>',
58
  unsafe_allow_html=True
59
  )
60
- wc = WordCloud(width=800, height=400, background_color="white", colormap="Greens").generate(negative_reviews)
61
- st.image(wc.to_array(),use_column_width=True)
62
 
63
  # Display the sentiment of each review as cards
64
  st.markdown(
65
- f'<div style="background-color: #234A21; color: #ffffff; padding: 6px; font-size: 20px; font-family: Open-Sans; font-weight: bold; text-align: center; margin-top: 60px;"> What customers said about us</div>',
66
  unsafe_allow_html=True
67
  )
68
 
@@ -85,4 +85,4 @@ if file is not None:
85
 
86
 
87
  else:
88
- st.write("Please upload a CSV file.")
 
25
 
26
  # Write the total number of records
27
  st.markdown(
28
+ f'<div style="background-color: #4AA6DD; color: #ffffff; padding: 8px; font-size: 30px; font-family: Open-Sans; font-weight: bold; text-align: center; border-radius: 2rem"> {len(df)} reviews to analyse!</div>',
29
  unsafe_allow_html=True
30
  )
31
 
 
34
 
35
  # Generate pie chart
36
  # Define custom colors
37
+ colors = ['#30C3C4', '#D1DDDE']
38
 
39
  # Generate pie chart
40
  sentiment_counts = df["Sentiment"].value_counts()
 
47
  negative_reviews = " ".join(df[df["Sentiment"] == "NEGATIVE"]["Review"].tolist())
48
 
49
  st.markdown(
50
+ f'<div style="background-color: #4AA6DD; color: #ffffff; padding: 6px; font-size: 20px; font-family: Open-Sans; font-weight: bold; text-align: center; margin-bottom: 40px; border-radius: 2rem"> Causes behind Positive Reviews</div>',
51
  unsafe_allow_html=True
52
  )
53
+ wc = WordCloud(width=800, height=400, background_color="white", colormap="winter").generate(positive_reviews)
54
+ st.image(wc.to_array(),use_column_width=False, width=800)
55
 
56
  st.markdown(
57
+ f'<div style="background-color: #4AA6DD; color: #ffffff; padding: 6px; font-size: 20px; font-family: Open-Sans; font-weight: bold; text-align: center; margin-bottom: 40px; margin-top: 60px; border-radius: 2rem"> Causes behind Negative Reviews</div>',
58
  unsafe_allow_html=True
59
  )
60
+ wc = WordCloud(width=800, height=400, background_color="white", colormap="Blues").generate(negative_reviews)
61
+ st.image(wc.to_array(),use_column_width=False)
62
 
63
  # Display the sentiment of each review as cards
64
  st.markdown(
65
+ f'<div style="background-color: #4AA6DD; color: #ffffff; padding: 6px; font-size: 20px; font-family: Open-Sans; font-weight: bold; text-align: center; margin-top: 60px; border-radius: 2rem"> What customers said about us</div>',
66
  unsafe_allow_html=True
67
  )
68
 
 
85
 
86
 
87
  else:
88
+ st.write("Please upload a CSV file.")