Uvini commited on
Commit
726740f
·
1 Parent(s): a8ee5c2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -7
app.py CHANGED
@@ -16,17 +16,17 @@ st.set_page_config(page_title="Review Analysis", page_icon=":smiley:")
16
  # Add image and heading
17
  st.image("Header.png", use_column_width=True)
18
 
19
- file = st.file_uploader(label=':sunglasses:',label_visibility='collapsed',type=["csv"])
20
 
21
  # Define the app's functionality
22
  if file is not None:
23
  # Read the CSV file into a Pandas DataFrame
24
  df = pd.read_csv(file)
25
- st.markdown(f"<h5 style='font-family: monospace;font-size: 16px;'>Total reviews: {len(df)-1} </h5>", unsafe_allow_html=True)
26
 
27
  # Write the total number of records
28
  st.markdown(
29
- f'<div style="background-color: #4AA6DD; color: #ffffff; padding: 6px; font-size: 16px; font-family: monospace; font-weight: bold; text-align: center; border-radius: 1rem;margin-top: 40px"> Distribution of Reviews </div>',
30
  unsafe_allow_html=True
31
  )
32
 
@@ -52,7 +52,7 @@ if file is not None:
52
 
53
  with col1:
54
  st.markdown(
55
- f'<div style="background-color: #4AA6DD; color: #ffffff; padding: 6px; font-size: 16px; font-family: monospace; font-weight: bold; text-align: center; margin-bottom: 40px; border-radius: 1rem">Positive Reviews</div>',
56
  unsafe_allow_html=True
57
  )
58
  wc_pos = WordCloud(width=800, height=600, background_color="white", colormap="winter").generate(positive_reviews)
@@ -60,7 +60,7 @@ if file is not None:
60
 
61
  with col2:
62
  st.markdown(
63
- f'<div style="background-color: #4AA6DD; color: #ffffff; padding: 6px; font-size: 16px; font-family: monospace; font-weight: bold; text-align: center; margin-bottom: 40px;border-radius: 1rem">Negative Reviews</div>',
64
  unsafe_allow_html=True
65
  )
66
  wc_neg = WordCloud(width=800, height=600, background_color="white", colormap="winter").generate(negative_reviews)
@@ -68,7 +68,7 @@ if file is not None:
68
 
69
  # Display the sentiment of each review as cards
70
  st.markdown(
71
- f'<div style="background-color: #4AA6DD; color: #ffffff; padding: 6px; font-size: 16px; font-family: monospace; font-weight: bold; text-align: center; margin-top: 60px; border-radius: 1rem"> Reviews in depth </div>',
72
  unsafe_allow_html=True
73
  )
74
 
@@ -84,7 +84,7 @@ if file is not None:
84
 
85
  # Create HTML table with no border and centered text
86
  table_html = (df.style
87
- .set_properties(**{'text-align': 'left','font-size': '12px','font-family': 'monospace'})
88
  .set_table_styles([{'selector': 'th', 'props': [('border', '0px')]},
89
  {'selector': 'td', 'props': [('border', '0px')]}])
90
  .set_table_attributes('style="position: sticky; top: 0;"')
 
16
  # Add image and heading
17
  st.image("Header.png", use_column_width=True)
18
 
19
+ file = st.file_uploader(" ",label_visibility='collapsed',type=["csv"])
20
 
21
  # Define the app's functionality
22
  if file is not None:
23
  # Read the CSV file into a Pandas DataFrame
24
  df = pd.read_csv(file)
25
+ st.markdown(f"<h5 style='font-family: sans-serif;font-size: 16px;'>Total reviews: {len(df)-1} </h5>", unsafe_allow_html=True)
26
 
27
  # Write the total number of records
28
  st.markdown(
29
+ f'<div style="background-color: #4AA6DD; color: #ffffff; padding: 6px; font-size: 16px; font-family: sans-serif; font-weight: bold; text-align: center; border-radius: 1rem;margin-top: 40px"> Distribution of Reviews </div>',
30
  unsafe_allow_html=True
31
  )
32
 
 
52
 
53
  with col1:
54
  st.markdown(
55
+ f'<div style="background-color: #4AA6DD; color: #ffffff; padding: 6px; font-size: 16px; font-family: sans-serif; font-weight: bold; text-align: center; margin-bottom: 40px; border-radius: 1rem">Positive Reviews</div>',
56
  unsafe_allow_html=True
57
  )
58
  wc_pos = WordCloud(width=800, height=600, background_color="white", colormap="winter").generate(positive_reviews)
 
60
 
61
  with col2:
62
  st.markdown(
63
+ f'<div style="background-color: #4AA6DD; color: #ffffff; padding: 6px; font-size: 16px; font-family: sans-serif; font-weight: bold; text-align: center; margin-bottom: 40px;border-radius: 1rem">Negative Reviews</div>',
64
  unsafe_allow_html=True
65
  )
66
  wc_neg = WordCloud(width=800, height=600, background_color="white", colormap="winter").generate(negative_reviews)
 
68
 
69
  # Display the sentiment of each review as cards
70
  st.markdown(
71
+ f'<div style="background-color: #4AA6DD; color: #ffffff; padding: 6px; font-size: 16px; font-family: sans-serif; font-weight: bold; text-align: center; margin-top: 60px; border-radius: 1rem"> Reviews in depth </div>',
72
  unsafe_allow_html=True
73
  )
74
 
 
84
 
85
  # Create HTML table with no border and centered text
86
  table_html = (df.style
87
+ .set_properties(**{'text-align': 'left','font-size': '12px','font-family': 'sans-serif'})
88
  .set_table_styles([{'selector': 'th', 'props': [('border', '0px')]},
89
  {'selector': 'td', 'props': [('border', '0px')]}])
90
  .set_table_attributes('style="position: sticky; top: 0;"')