Spaces:
Sleeping
Sleeping
Update templates/result.html
Browse files- templates/result.html +66 -127
templates/result.html
CHANGED
|
@@ -1,138 +1,68 @@
|
|
| 1 |
<!DOCTYPE html>
|
| 2 |
-
<html
|
| 3 |
<head>
|
| 4 |
-
<meta charset="UTF-8">
|
| 5 |
<title>Hasil Sentimen</title>
|
| 6 |
-
|
| 7 |
-
<!-- Bootstrap -->
|
| 8 |
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
| 9 |
-
|
| 10 |
-
<!-- Chart.js -->
|
| 11 |
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
|
| 12 |
-
|
| 13 |
-
<style>
|
| 14 |
-
body {
|
| 15 |
-
background-color: #f4f6f9;
|
| 16 |
-
}
|
| 17 |
-
.card {
|
| 18 |
-
border-radius: 15px;
|
| 19 |
-
}
|
| 20 |
-
.badge-positive {
|
| 21 |
-
background-color: #28a745;
|
| 22 |
-
}
|
| 23 |
-
.badge-neutral {
|
| 24 |
-
background-color: #6c757d;
|
| 25 |
-
}
|
| 26 |
-
.badge-negative {
|
| 27 |
-
background-color: #dc3545;
|
| 28 |
-
}
|
| 29 |
-
</style>
|
| 30 |
</head>
|
| 31 |
|
| 32 |
-
<body>
|
| 33 |
|
| 34 |
<div class="container mt-5">
|
| 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 |
-
</div>
|
| 82 |
-
</div>
|
| 83 |
-
|
| 84 |
-
</div>
|
| 85 |
-
|
| 86 |
-
<!-- TABLE DATA -->
|
| 87 |
-
<div class="card mt-5 shadow">
|
| 88 |
-
<div class="card-header bg-dark text-white">
|
| 89 |
-
<h5>π Data Komentar</h5>
|
| 90 |
-
</div>
|
| 91 |
-
|
| 92 |
-
<div class="table-responsive">
|
| 93 |
-
<table class="table table-striped table-hover">
|
| 94 |
-
|
| 95 |
-
<thead class="table-dark">
|
| 96 |
-
<tr>
|
| 97 |
-
<th>No</th>
|
| 98 |
-
<th>Komentar</th>
|
| 99 |
-
<th>Sentimen</th>
|
| 100 |
-
</tr>
|
| 101 |
-
</thead>
|
| 102 |
-
|
| 103 |
-
<tbody>
|
| 104 |
-
{% for text, sent in data %}
|
| 105 |
-
<tr>
|
| 106 |
-
<td>{{ loop.index }}</td>
|
| 107 |
-
<td>{{ text }}</td>
|
| 108 |
-
<td>
|
| 109 |
-
{% if sent == "Positive" %}
|
| 110 |
-
<span class="badge badge-positive">Positive</span>
|
| 111 |
-
{% elif sent == "Neutral" %}
|
| 112 |
-
<span class="badge badge-neutral">Neutral</span>
|
| 113 |
-
{% else %}
|
| 114 |
-
<span class="badge badge-negative">Negative</span>
|
| 115 |
-
{% endif %}
|
| 116 |
-
</td>
|
| 117 |
-
</tr>
|
| 118 |
-
{% endfor %}
|
| 119 |
-
</tbody>
|
| 120 |
-
|
| 121 |
-
</table>
|
| 122 |
-
</div>
|
| 123 |
-
</div>
|
| 124 |
-
|
| 125 |
-
<!-- BUTTON BACK -->
|
| 126 |
-
<div class="text-center mt-4">
|
| 127 |
-
<a href="/" class="btn btn-secondary">β¬
Kembali</a>
|
| 128 |
-
</div>
|
| 129 |
|
| 130 |
</div>
|
| 131 |
|
| 132 |
-
<!-- CHART SCRIPT -->
|
| 133 |
<script>
|
| 134 |
-
|
| 135 |
-
|
|
|
|
|
|
|
| 136 |
datasets: [{
|
| 137 |
data: [
|
| 138 |
{{ counts['Positive']|default(0) }},
|
|
@@ -140,12 +70,21 @@
|
|
| 140 |
{{ counts['Negative']|default(0) }}
|
| 141 |
]
|
| 142 |
}]
|
| 143 |
-
}
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 149 |
</script>
|
| 150 |
|
| 151 |
</body>
|
|
|
|
| 1 |
<!DOCTYPE html>
|
| 2 |
+
<html>
|
| 3 |
<head>
|
|
|
|
| 4 |
<title>Hasil Sentimen</title>
|
|
|
|
|
|
|
| 5 |
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
|
|
|
|
|
|
| 6 |
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
</head>
|
| 8 |
|
| 9 |
+
<body class="bg-light">
|
| 10 |
|
| 11 |
<div class="container mt-5">
|
| 12 |
|
| 13 |
+
<h2>π Hasil Sentimen</h2>
|
| 14 |
+
<p><b>Keyword:</b> {{ keyword }}</p>
|
| 15 |
+
<p><b>Sumber:</b> {{ source }}</p>
|
| 16 |
+
|
| 17 |
+
<!-- PIE -->
|
| 18 |
+
<canvas id="pieChart"></canvas>
|
| 19 |
+
|
| 20 |
+
<hr>
|
| 21 |
+
|
| 22 |
+
<!-- π PER PLATFORM -->
|
| 23 |
+
<h4>Perbandingan Platform</h4>
|
| 24 |
+
<canvas id="platformChart"></canvas>
|
| 25 |
+
|
| 26 |
+
<hr>
|
| 27 |
+
|
| 28 |
+
<!-- βοΈ WORDCLOUD -->
|
| 29 |
+
<h4>WordCloud</h4>
|
| 30 |
+
<img src="/static/wordcloud.png" width="500">
|
| 31 |
+
|
| 32 |
+
<hr>
|
| 33 |
+
|
| 34 |
+
<!-- π DOWNLOAD -->
|
| 35 |
+
<a href="/download" class="btn btn-success">β¬ Download CSV</a>
|
| 36 |
+
|
| 37 |
+
<hr>
|
| 38 |
+
|
| 39 |
+
<!-- π EVALUASI -->
|
| 40 |
+
<h4>Evaluasi Model</h4>
|
| 41 |
+
<pre>{{ report }}</pre>
|
| 42 |
+
|
| 43 |
+
<hr>
|
| 44 |
+
|
| 45 |
+
<!-- DATA -->
|
| 46 |
+
<table class="table table-striped">
|
| 47 |
+
<tr><th>No</th><th>Text</th><th>Sentiment</th><th>Source</th></tr>
|
| 48 |
+
|
| 49 |
+
{% for t,s,src in data %}
|
| 50 |
+
<tr>
|
| 51 |
+
<td>{{ loop.index }}</td>
|
| 52 |
+
<td>{{ t }}</td>
|
| 53 |
+
<td>{{ s }}</td>
|
| 54 |
+
<td>{{ src }}</td>
|
| 55 |
+
</tr>
|
| 56 |
+
{% endfor %}
|
| 57 |
+
</table>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 58 |
|
| 59 |
</div>
|
| 60 |
|
|
|
|
| 61 |
<script>
|
| 62 |
+
new Chart(document.getElementById('pieChart'), {
|
| 63 |
+
type: 'pie',
|
| 64 |
+
data: {
|
| 65 |
+
labels: ["Positive","Neutral","Negative"],
|
| 66 |
datasets: [{
|
| 67 |
data: [
|
| 68 |
{{ counts['Positive']|default(0) }},
|
|
|
|
| 70 |
{{ counts['Negative']|default(0) }}
|
| 71 |
]
|
| 72 |
}]
|
| 73 |
+
}
|
| 74 |
+
});
|
| 75 |
+
|
| 76 |
+
const platformData = {
|
| 77 |
+
labels: {{ platform_counts.keys()|list }},
|
| 78 |
+
datasets: [{
|
| 79 |
+
label: "Positive",
|
| 80 |
+
data: {{ platform_counts.values()|map(attribute='Positive')|list }}
|
| 81 |
+
}]
|
| 82 |
+
};
|
| 83 |
+
|
| 84 |
+
new Chart(document.getElementById('platformChart'), {
|
| 85 |
+
type: 'bar',
|
| 86 |
+
data: platformData
|
| 87 |
+
});
|
| 88 |
</script>
|
| 89 |
|
| 90 |
</body>
|