sree4411 commited on
Commit
22f800a
Β·
verified Β·
1 Parent(s): 10e772a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +33 -65
app.py CHANGED
@@ -3,10 +3,38 @@ import streamlit as st
3
  # Apply custom styles using Streamlit's markdown
4
  st.markdown("""
5
  <style>
6
- .main-title { color: #FF5733; font-size: 40px; font-weight: bold; text-align: center; }
7
- .section-title { color: #2E86C1; font-size: 30px; font-weight: bold; margin-top: 20px; }
8
- .sub-title { color: #27AE60; font-size: 24px; font-weight: bold; margin-top: 10px; }
9
- .text { font-size: 18px; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
  </style>
11
  """, unsafe_allow_html=True)
12
 
@@ -89,64 +117,4 @@ elif selected_method == "TF-IDF":
89
 
90
  **Disadvantages:**
91
  - ❌ Still ignores word order
92
- - ❌ Does not capture deep semantics
93
- """)
94
-
95
- elif selected_method == "One-Hot Encoding":
96
- st.markdown('<p class="sub-title">One-Hot Encoding</p>', unsafe_allow_html=True)
97
- st.markdown("""
98
- **Definition**: Represents words as binary vectors where each word has a unique position in a vocabulary.
99
- """)
100
- st.markdown("""
101
- **Uses:**
102
- - βœ… Simple NLP tasks
103
- - βœ… Word-level feature engineering
104
-
105
- **Advantages:**
106
- - βœ… Simple to understand
107
- - βœ… Works well with small vocabulary sizes
108
-
109
- **Disadvantages:**
110
- - ❌ Inefficient for large vocabularies
111
- - ❌ No information on word meaning
112
- """)
113
-
114
- elif selected_method == "Word Embeddings (Word2Vec)":
115
- st.markdown('<p class="sub-title">Word Embeddings (Word2Vec)</p>', unsafe_allow_html=True)
116
- st.markdown("""
117
- **Definition**: Converts words into dense numerical vectors capturing semantic relationships.
118
- """)
119
- st.markdown("""
120
- **Uses:**
121
- - βœ… Machine translation
122
- - βœ… Speech recognition
123
- - βœ… Sentiment analysis
124
-
125
- **Advantages:**
126
- - βœ… Captures semantic relationships
127
- - βœ… Works well for deep learning models
128
-
129
- **Disadvantages:**
130
- - ❌ Requires large datasets to train
131
- - ❌ Computationally expensive
132
- """)
133
-
134
- # Sample texts for Word2Vec model
135
- from gensim.models import Word2Vec
136
- texts = [
137
- "Natural Language Processing is fascinating.",
138
- "Natural Language Processing involves understanding human language.",
139
- "The field of NLP is growing rapidly."
140
- ]
141
- model = Word2Vec(sentences=[text.split() for text in texts], vector_size=100, window=5, min_count=1, workers=4)
142
- word_vectors = model.wv
143
- word = 'natural'
144
- if word in word_vectors:
145
- st.markdown(f'Word2Vec Representation of "{word}":')
146
- st.write(word_vectors[word])
147
- else:
148
- st.markdown(f'Word "{word}" not found in the vocabulary.')
149
-
150
- # Footer
151
- st.markdown('<hr>', unsafe_allow_html=True)
152
- st.markdown('<p class="text" style="text-align:center;">Developed with ❀️ using Streamlit for NLP enthusiasts.</p>', unsafe_allow_html=True)
 
3
  # Apply custom styles using Streamlit's markdown
4
  st.markdown("""
5
  <style>
6
+ /* Link to Google Fonts */
7
+ @import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&display=swap');
8
+
9
+ /* Custom styles */
10
+ .main-title {
11
+ color: #FF5733;
12
+ font-size: 40px;
13
+ font-weight: bold;
14
+ text-align: center;
15
+ font-family: 'Roboto', sans-serif; /* Custom font */
16
+ }
17
+
18
+ .section-title {
19
+ color: #2E86C1;
20
+ font-size: 30px;
21
+ font-weight: bold;
22
+ margin-top: 20px;
23
+ font-family: 'Roboto', sans-serif; /* Custom font */
24
+ }
25
+
26
+ .sub-title {
27
+ color: #27AE60;
28
+ font-size: 24px;
29
+ font-weight: bold;
30
+ margin-top: 10px;
31
+ font-family: 'Roboto', sans-serif; /* Custom font */
32
+ }
33
+
34
+ .text {
35
+ font-size: 18px;
36
+ font-family: 'Roboto', sans-serif; /* Custom font */
37
+ }
38
  </style>
39
  """, unsafe_allow_html=True)
40
 
 
117
 
118
  **Disadvantages:**
119
  - ❌ Still ignores word order
120
+ - ❌ Does not capture deep