File size: 14,542 Bytes
7b7289a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>zvirevo</title>
    <link rel="stylesheet" href="{{ url_for('static', filename='css/styles.css') }}">
    <link href="https://fonts.googleapis.com/css2?family=Jacques+Francois+Shadow&display=swap" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css2?family=Jacques+Francois&display=swap" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css2?family=Kavoon&display=swap" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css2?family=Itim&display=swap" rel="stylesheet">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">


</head>

<body>


    <!-- 1. WELCOME SECTION-->
    <section id="welcome" class="welcome">
        <!-- header -->
        <header>
            <!-- navigation bar -->
            <nav>

                <!-- logo -->
                 <div class="logo">
                    <img src="{{ url_for('static', filename='images/logo.png') }}" alt="Example Image">
                    <!-- <img src="images/logo.png" alt=""> -->
                    <p>Zvirevo</p>
                 </div>
                

                <!-- headings -->
                <ul>
                    <li><a href="#welcome">About</a></li>
                    <li><a href="#embeddings">Embeddings</a></li>
                    <li><a href="#computations">Computations</a></li>
                    <li><a href="#contact">Contact</a></li>
                </ul>
            </nav>
            <hr>
        </header>

        <!-- welcome message -->
         <div class="welcomeMsg">
            <img src="{{ url_for('static', filename='images/welcome.png') }}" alt="Example Image">
            <!-- <img src="images/welcome.png" alt=""> -->
            <div class="rectangle"></div>
            <h1>Welcome to <span style="color:rgb(163, 46, 199)">Zvirevo</span></h1>

            <div class="container">
                <div class="ellipse"></div>

                <div class="ellipse top">
                    <div class="text">Increasing accessibility and functionality of <span style="color:rgb(171, 10, 203)">AI</span> through enhancing NLP capabilities for agglutinitive <span style="color:rgb(171, 10, 203)">African languages</span> with complex morphologies.
                        </div>
                </div>
            </div>

         </div>



    </section>






    <!-- 2. EMBEDDINGS SECTION-->
    <section id="embeddings">
        <h1>Perform Word <br><span style="color:rgb(163, 46, 199)">Embeddings</span></h1>
        <img src="{{ url_for('static', filename='images/nlp.png') }}" alt="NLP Image">
    
        <div class="generate">
            <form id="embeddingForm" class="word">
                <div class="word">
                    <div class="type-word">
                        <input type="text" id="wordInput" placeholder="Enter the word here e.g. mukadzi" required>
                    </div>
    
                    <div class="btns1">
                        <!-- Choose model -->
                        <div class="model">
                            <label for="modelSelect">Choose model</label>
                            <select id="modelSelect" name="modelSelect" required>
                                <!-- <option value="" disabled selected>Select a model</option> -->
                                <option value="word2vec">Word2Vec</option>
                                <option value="fasttext">FastText</option>
                            </select>
                        </div>
    
                        <!-- Select top words -->
                        <div class="top-n">
                            <label for="topNSelect">Top-n</label>
                            <select id="topNSelect" name="topNSelect" required>
                                <!-- <option value="" disabled selected>Select number of similar words</option> -->
                                <option value="1">1</option>
                                <option value="2">2</option>
                                <option value="3">3</option>
                                <option value="4">4</option>
                                <option value="5">5</option>
                            </select>
                        </div>
    
                        <!-- Submit -->
                        <div class="submit-btn">
                            <button type="submit">Submit</button>
                        </div>
                    </div>
                </div>
            </form>
    
            <div class="result1">
                <div class="result-title">
                    <h2>Results</h2>
                </div>
    
                <div class="outcome">
                    <ul id="resultsList">
                        <!-- Results will be dynamically inserted here -->
                    </ul>
                </div>
            </div>
        </div>
    </section>
    
    






    <!-- 3. COMPUTATIONS SECTION-->


    <section id="computations">
        <h1>Perform Word <br><span style="color:rgb(163, 46, 199)">Computations</span></h1>
        <img src="{{ url_for('static', filename='images/nlp.png') }}" alt="Example Image">
        <!-- <img src="images/nlp.png" alt=""> -->

        <div class="generate">
            <form id="computationForm" class="word">
                <div class="word">
                    <div class="type-word">
                        <input id="expressionInput" type="text" placeholder="Enter expression e.g. vana + vasikana - vakomana" required>
                    </div>
                    <div class="btns1">
                        <!-- Choose model -->
                        <div class="model">
                            <label for="modelSelectComputation">Choose model</label>
                            <select id="modelSelectComputation" name="modelSelectComputation" required>
                                <option value="word2vec">Word2Vec</option>
                                <option value="fasttext">FastText</option>
                            </select>
                        </div>
                        <!-- Select top words -->
                        <div class="top-n">
                            <label for="topNSelectComputation">Top-n</label>
                            <select id="topNSelectComputation" name="topNSelectComputation" required>
                                <option value="1">1</option>
                                <option value="2">2</option>
                                <option value="3">3</option>
                                <option value="4">4</option>
                                <option value="5">5</option>
                            </select>
                        </div>
                        <!-- Submit -->
                        <div class="submit-btn">
                            <button type="submit">Submit</button>
                        </div>
                    </div>
                </div>
            </form>
            <div class="result2">
                <div class="result-title">
                    <h2>Results</h2>
                </div>
                <div class="outcome">
                    <ul id="computationResultsList">
                        <!-- Results will be dynamically inserted here -->
                    </ul>
                </div>
            </div>
            
        </div>
        
    </section>








    <!-- 4. CONTACT SECTION-->
    <section id="contact">

        <!-- personal details on collaborators-->
        <div class="personal-info">
            <div class="people">
                <div class="daisy">
                    <img src="{{ url_for('static', filename='images/daisy.png') }}" alt="Example Image">
                    <!-- <img src="images/daisy.png" alt=""> -->
                    <div class="daisy-bio">
                        <p>Hello! <br>
                            "I'm Daisy, a passionate innovator in the tech world. 
                            Creating this project has been an incredibly fulfilling journey for me."
                            </p>
                    </div>

                </div>

                <div class="ruva">
                    <img src="{{ url_for('static', filename='images/ruva.png') }}" alt="Example Image">
                    <!-- <img src="images/ruva.png" alt=""> -->
                    <div class="ruva-bio">
                        <p>
                            Hi there, <br> “I'm Ruva, a tech ethusiast. 
                            Building this project was the most beautiful thing i have ever done in my life”
                            
                        </p>
                    </div>

                </div>

            </div>



            <hr>



            <div class="form-container">
                <form id="contactForm" action="/submit" method="POST">
                    <h2>Contact Us</h2>
                    <hr>
        
                    <div class="form-group">
                        <label for="name">Name:</label>
                        <input type="text" id="name" name="name" required>
                    </div>
        
                    <div class="form-group">
                        <label for="email">Email:</label>
                        <input type="email" id="email" name="email" required>
                    </div>
        
                    <div class="form-group">
                        <textarea id="message" name="message" rows="4" required placeholder="Type message ... "></textarea>
                    </div>
        
                   
        
                    <div class="form-group checkbox-group">
                        <label>
                            <input type="checkbox" name="subscribe" checked> Subscribe to our newsletter
                        </label>
                    </div>
        
                    <button type="submit">Submit</button>
                    <div id="responseMessage"></div>
                </form>
            </div>


        </div>



        <footer>
            <p>&copy; zvirevo 2024</p>
            <div class="social-media-icons">
                <a href="https://www.facebook.com" target="_blank"><i class="fab fa-facebook-f"></i></a>
                <a href="https://www.twitter.com" target="_blank"><i class="fab fa-twitter"></i></a>
                <a href="https://www.instagram.com" target="_blank"><i class="fab fa-instagram"></i></a>
                <a href="https://www.linkedin.com/in/daisy-tsenesa-577b5a221/" target="_blank"><i class="fab fa-linkedin-in"></i></a>
                <a href="https://github.com/daisy-py-bot" target="_blank"><i class="fab fa-github"></i></a>
              </div>

        </footer>
    </section>
    
</body>

    <script>
        // Get the form for the word embeddings
        document.getElementById('embeddingForm').addEventListener('submit', function(e) {
            e.preventDefault();
            const word = document.getElementById('wordInput').value;
            const modelType = document.getElementById('modelSelect').value;
            const topN = document.getElementById('topNSelect').value;

            fetch('/get_similar_words', {
                method: 'POST',
                headers: { 'Content-Type': 'application/json' },
                body: JSON.stringify({ word: word, model_type: modelType, top_n: topN })
            })
            .then(response => response.json())
            .then(data => {
                const resultsList = document.getElementById('resultsList');
                resultsList.innerHTML = ''; // Clear previous results

                if (data.error) {
                    resultsList.innerHTML = `<li>Error: ${data.error}</li>`;
                } else {
                    data.similar_words.forEach(item => {
                        const listItem = document.createElement('li');
                        listItem.textContent = `${item[0]}: ${item[1].toFixed(4)}`;
                        resultsList.appendChild(listItem);
                    });
                }
            })
            .catch(error => console.error('Error:', error));
        });



        // Get the form from the word computations
        document.getElementById('computationForm').addEventListener('submit', function(e) {
            e.preventDefault();
            const expression = document.getElementById('expressionInput').value;
            const modelType = document.getElementById('modelSelectComputation').value;
            const topN = document.getElementById('topNSelectComputation').value;

            fetch('/compute', {
                method: 'POST',
                headers: { 'Content-Type': 'application/json' },
                body: JSON.stringify({ expression: expression, model: modelType, top_n: topN })
            })
            .then(response => response.json())
            .then(data => {
                const computationResultsList = document.getElementById('computationResultsList');
                computationResultsList.innerHTML = ''; // Clear previous results

                if (data.error) {
                    computationResultsList.innerHTML = `<li>${data.error}</li>`;
                } else {
                    data.forEach(item => {
                        const listItem = document.createElement('li');
                        listItem.textContent = `${item.word}: ${item.similarity.toFixed(4)}`;
                        computationResultsList.appendChild(listItem);
                    });
                }
            })
            .catch(error => console.error('Error:', error));
        });


        // Send email

        document.getElementById('contactForm').addEventListener('submit', function(event) {
        event.preventDefault(); // Prevent the default form submission

        const formData = new FormData(this);
        fetch('/submit', {
            method: 'POST',
            body: formData
        })
        .then(response => response.json())
        .then(data => {
            document.getElementById('responseMessage').innerText = data.message;
        })
        .catch(error => {
            console.error('Error:', error);
            document.getElementById('responseMessage').innerText = 'An error occurred. Please try again.';
        });
    });

    </script>
</html>