stanlys96 commited on
Commit
ef922eb
·
verified ·
1 Parent(s): 80c5c5f

Upload 2 files

Browse files
Files changed (2) hide show
  1. home.py +9 -9
  2. youtube.py +20 -17
home.py CHANGED
@@ -26,16 +26,16 @@ for the_value in val:
26
  image = Image.open(f"./images/{item}")
27
  break
28
  with col1:
29
- if image:
30
- st.markdown(f"### {the_value}")
31
- st.image(image, caption=f"{the_value} Image")
32
 
33
  with col2:
34
- st.markdown(f"### Word Cloud for {the_value}")
35
 
36
- plt.figure(figsize=(10, 5))
37
- plt.imshow(wordcloud, interpolation='bilinear')
38
- plt.axis("off")
39
- st.pyplot(plt)
40
 
41
- st.write('<div style="padding: 10px;"></div>', unsafe_allow_html=True)
 
26
  image = Image.open(f"./images/{item}")
27
  break
28
  with col1:
29
+ if image:
30
+ st.markdown(f"### {the_value}")
31
+ st.image(image, caption=f"{the_value} Image")
32
 
33
  with col2:
34
+ st.markdown(f"### Word Cloud for {the_value}")
35
 
36
+ plt.figure(figsize=(10, 5))
37
+ plt.imshow(wordcloud, interpolation='bilinear')
38
+ plt.axis("off")
39
+ st.pyplot(plt)
40
 
41
+ st.write('<div style="padding: 10px;"></div>', unsafe_allow_html=True)
youtube.py CHANGED
@@ -3,17 +3,20 @@ import streamlit as st
3
  import random
4
 
5
  st.header("💬 Youtube Comments Sentiment Analysis")
 
6
  st.markdown("""
7
  <style>
8
- .stTextInput > label > div > p {
9
- font-size: 23px;
10
- padding: 0;
11
- margin: 0;
12
- font-weight: 600;
13
- }
14
  </style>
15
  """, unsafe_allow_html=True)
 
16
  user_input = st.text_input("Enter a youtube link for sentiment analysis")
 
17
  sentiment_colors = {
18
  "Positive": "#28a745",
19
  "Neutral": "#ffc107",
@@ -33,17 +36,17 @@ if st.button('Submit', type="secondary"):
33
  sentiment = random.choice(sentiments)
34
  sentiment_color = sentiment_colors.get(sentiment, "#6c757d")
35
  comment_html = f"""
36
- <div style="background-color: #f9f9f9; border: 1px solid #ddd; border-radius: 10px; padding: 20px; margin: 20px auto; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);">
37
- <p style="font-size: 18px; line-height: 1.6; color: #333; font-family: 'Arial', sans-serif;">
38
- {data["comment"]}
39
- </p>
40
- <p style="font-size: 16px; margin-top: 15px; font-family: 'Arial', sans-serif; font-weight: bold;">
41
- Sentiment Analysis: <span style="color: {sentiment_color}; font-size: 18px; font-weight: bold; padding: 5px 10px; background-color: {sentiment_color + "33"}; border-radius: 5px;">
42
- {sentiment}
43
- </span>
44
- </p>
45
- </div>
46
- """
47
 
48
  st.markdown(comment_html, unsafe_allow_html=True)
49
  else:
 
3
  import random
4
 
5
  st.header("💬 Youtube Comments Sentiment Analysis")
6
+
7
  st.markdown("""
8
  <style>
9
+ .stTextInput > label > div > p {
10
+ font-size: 23px;
11
+ padding: 0;
12
+ margin: 0;
13
+ font-weight: 600;
14
+ }
15
  </style>
16
  """, unsafe_allow_html=True)
17
+
18
  user_input = st.text_input("Enter a youtube link for sentiment analysis")
19
+
20
  sentiment_colors = {
21
  "Positive": "#28a745",
22
  "Neutral": "#ffc107",
 
36
  sentiment = random.choice(sentiments)
37
  sentiment_color = sentiment_colors.get(sentiment, "#6c757d")
38
  comment_html = f"""
39
+ <div style="background-color: #f9f9f9; border: 1px solid #ddd; border-radius: 10px; padding: 20px; margin: 20px auto; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);">
40
+ <p style="font-size: 18px; line-height: 1.6; color: #333; font-family: 'Arial', sans-serif;">
41
+ {data["comment"]}
42
+ </p>
43
+ <p style="font-size: 16px; margin-top: 15px; font-family: 'Arial', sans-serif; font-weight: bold;">
44
+ Sentiment Analysis: <span style="color: {sentiment_color}; font-size: 18px; font-weight: bold; padding: 5px 10px; background-color: {sentiment_color + "33"}; border-radius: 5px;">
45
+ {sentiment}
46
+ </span>
47
+ </p>
48
+ </div>
49
+ """
50
 
51
  st.markdown(comment_html, unsafe_allow_html=True)
52
  else: