Spaces:
Sleeping
Sleeping
Update templates/result.html
Browse files- templates/result.html +26 -16
templates/result.html
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
<!DOCTYPE html>
|
| 2 |
<html>
|
| 3 |
<head>
|
| 4 |
-
<title>Hasil
|
| 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>
|
|
@@ -14,31 +14,36 @@
|
|
| 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 |
-
<!--
|
| 23 |
-
<h4>
|
| 24 |
<canvas id="platformChart"></canvas>
|
| 25 |
|
| 26 |
<hr>
|
| 27 |
|
| 28 |
-
<!--
|
| 29 |
<h4>WordCloud</h4>
|
| 30 |
<img src="/static/wordcloud.png" width="500">
|
| 31 |
|
| 32 |
<hr>
|
| 33 |
|
| 34 |
-
<!--
|
| 35 |
<a href="/download" class="btn btn-success">⬇ Download CSV</a>
|
| 36 |
|
| 37 |
<hr>
|
| 38 |
|
| 39 |
-
<!--
|
| 40 |
<h4>Evaluasi Model</h4>
|
| 41 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
|
| 43 |
<hr>
|
| 44 |
|
|
@@ -54,11 +59,13 @@
|
|
| 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: {
|
|
@@ -73,17 +80,20 @@ new Chart(document.getElementById('pieChart'), {
|
|
| 73 |
}
|
| 74 |
});
|
| 75 |
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
data: {{ platform_counts.values()|map(attribute='Positive')|list }}
|
| 81 |
-
}]
|
| 82 |
-
};
|
| 83 |
|
| 84 |
new Chart(document.getElementById('platformChart'), {
|
| 85 |
type: 'bar',
|
| 86 |
-
data:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 87 |
});
|
| 88 |
</script>
|
| 89 |
|
|
|
|
| 1 |
<!DOCTYPE html>
|
| 2 |
<html>
|
| 3 |
<head>
|
| 4 |
+
<title>Hasil</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>
|
|
|
|
| 14 |
<p><b>Keyword:</b> {{ keyword }}</p>
|
| 15 |
<p><b>Sumber:</b> {{ source }}</p>
|
| 16 |
|
| 17 |
+
<!-- PIE CHART -->
|
| 18 |
<canvas id="pieChart"></canvas>
|
| 19 |
|
| 20 |
<hr>
|
| 21 |
|
| 22 |
+
<!-- PLATFORM -->
|
| 23 |
+
<h4>Per 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 |
+
|
| 42 |
+
{% if eval_result.error %}
|
| 43 |
+
<p class="text-danger">{{ eval_result.error }}</p>
|
| 44 |
+
{% else %}
|
| 45 |
+
<p><b>Accuracy:</b> {{ eval_result.accuracy }}</p>
|
| 46 |
+
{% endif %}
|
| 47 |
|
| 48 |
<hr>
|
| 49 |
|
|
|
|
| 59 |
<td>{{ src }}</td>
|
| 60 |
</tr>
|
| 61 |
{% endfor %}
|
| 62 |
+
|
| 63 |
</table>
|
| 64 |
|
| 65 |
</div>
|
| 66 |
|
| 67 |
<script>
|
| 68 |
+
// pie
|
| 69 |
new Chart(document.getElementById('pieChart'), {
|
| 70 |
type: 'pie',
|
| 71 |
data: {
|
|
|
|
| 80 |
}
|
| 81 |
});
|
| 82 |
|
| 83 |
+
// platform chart
|
| 84 |
+
const labels = {{ platform_counts.keys()|list }};
|
| 85 |
+
const positive = {{ platform_counts.values()|map(attribute='Positive')|list }};
|
| 86 |
+
const negative = {{ platform_counts.values()|map(attribute='Negative')|list }};
|
|
|
|
|
|
|
|
|
|
| 87 |
|
| 88 |
new Chart(document.getElementById('platformChart'), {
|
| 89 |
type: 'bar',
|
| 90 |
+
data: {
|
| 91 |
+
labels: labels,
|
| 92 |
+
datasets: [
|
| 93 |
+
{ label: 'Positive', data: positive },
|
| 94 |
+
{ label: 'Negative', data: negative }
|
| 95 |
+
]
|
| 96 |
+
}
|
| 97 |
});
|
| 98 |
</script>
|
| 99 |
|