noranisa commited on
Commit
199a857
·
verified ·
1 Parent(s): 4075740

Create templates/result.html

Browse files
Files changed (1) hide show
  1. templates/result.html +45 -0
templates/result.html ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Hasil</title>
5
+ <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
6
+ </head>
7
+ <body class="bg-light">
8
+
9
+ <div class="container mt-5">
10
+
11
+ <h2>Hasil Sentimen</h2>
12
+
13
+ <canvas id="chart"></canvas>
14
+
15
+ <script>
16
+ const data = {
17
+ labels: ["Positive","Neutral","Negative"],
18
+ datasets: [{
19
+ data: [
20
+ {{ counts['Positive']|default(0) }},
21
+ {{ counts['Neutral']|default(0) }},
22
+ {{ counts['Negative']|default(0) }}
23
+ ]
24
+ }]
25
+ };
26
+
27
+ new Chart(document.getElementById('chart'), {
28
+ type: 'pie',
29
+ data: data
30
+ });
31
+ </script>
32
+
33
+ <hr>
34
+
35
+ <h3>Data Komentar</h3>
36
+
37
+ <ul>
38
+ {% for text, sent in data %}
39
+ <li>{{ text }} → <b>{{ sent }}</b></li>
40
+ {% endfor %}
41
+ </ul>
42
+
43
+ </div>
44
+ </body>
45
+ </html>