Spaces:
Running
Running
Bintang Fajar Julio
commited on
Commit
•
3d7d3a1
1
Parent(s):
b0cc3ff
update toggle
Browse files- templates/dashboard/base.html +1 -1
- templates/dashboard/classifier.html +185 -134
- templates/dashboard/history.html +3 -1
- views/classifier.py +15 -3
templates/dashboard/base.html
CHANGED
@@ -205,7 +205,7 @@
|
|
205 |
></path>
|
206 |
</svg>
|
207 |
</span>
|
208 |
-
<span class="nav-link-text">
|
209 |
</a>
|
210 |
</li>
|
211 |
<li class="nav-item d-none" id="menu-history">
|
|
|
205 |
></path>
|
206 |
</svg>
|
207 |
</span>
|
208 |
+
<span class="nav-link-text">Inferensi</span>
|
209 |
</a>
|
210 |
</li>
|
211 |
<li class="nav-item d-none" id="menu-history">
|
templates/dashboard/classifier.html
CHANGED
@@ -1,17 +1,14 @@
|
|
1 |
-
{% extends 'dashboard/base.html' %} {% block title %}
|
2 |
-
|
3 |
|
4 |
-
<h1 class="app-page-title">
|
5 |
-
|
6 |
-
<hr class="my-4" />
|
7 |
|
8 |
<div class="row g-4 settings-section">
|
9 |
<div class="col-12">
|
10 |
-
<h3 class="section-title">Kelas</h3>
|
11 |
<div class="section-intro">
|
12 |
Terdapat
|
13 |
-
<span class="text-unmuted">4
|
14 |
-
|
15 |
</div>
|
16 |
</div>
|
17 |
|
@@ -170,20 +167,43 @@ title %} {% block content %}
|
|
170 |
</div>
|
171 |
</div>
|
172 |
|
173 |
-
<
|
174 |
-
|
175 |
-
<div class="row g-4 settings-section">
|
176 |
-
<div class="col-12">
|
177 |
-
<h3 class="section-title">Data</h3>
|
178 |
-
<div class="section-intro">
|
179 |
-
Masukkan <span class="text-unmuted">abstrak dan kata kunci</span> Anda
|
180 |
-
sebagai data untuk diklasifikasikan.
|
181 |
-
</div>
|
182 |
-
</div>
|
183 |
<div class="col-12">
|
184 |
<div class="app-card app-card-settings shadow-sm p-4">
|
185 |
<div class="app-card-body">
|
186 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
187 |
<div class="mb-3">
|
188 |
<div class="d-flex justify-content-between">
|
189 |
<label for="abstrak" class="form-label">Abstrak</label>
|
@@ -232,9 +252,7 @@ title %} {% block content %}
|
|
232 |
</button>
|
233 |
</div>
|
234 |
<div class="col-auto">
|
235 |
-
<button class="btn app-btn-primary" type="submit">
|
236 |
-
Klasifikasi
|
237 |
-
</button>
|
238 |
</div>
|
239 |
</div>
|
240 |
</form>
|
@@ -245,13 +263,14 @@ title %} {% block content %}
|
|
245 |
</div>
|
246 |
</div>
|
247 |
|
248 |
-
<
|
249 |
-
|
250 |
-
|
|
|
251 |
<div class="col-12">
|
252 |
<h3 class="section-title">Hasil</h3>
|
253 |
</div>
|
254 |
-
<div class="col-12 col-lg-6">
|
255 |
<div class="app-card app-card-stats-table h-100 shadow-sm">
|
256 |
<div class="app-card-header p-3">
|
257 |
<div class="row justify-content-between align-items-center">
|
@@ -281,7 +300,7 @@ title %} {% block content %}
|
|
281 |
<!--//app-card-->
|
282 |
</div>
|
283 |
|
284 |
-
<div class="col-12 mt-5 text-center">
|
285 |
<h3 class="section-title">
|
286 |
Dosen Kelompok Bidang Keahlian<br /><span
|
287 |
id="kbk"
|
@@ -290,21 +309,26 @@ title %} {% block content %}
|
|
290 |
</h3>
|
291 |
</div>
|
292 |
|
293 |
-
<div
|
|
|
|
|
|
|
294 |
|
295 |
-
<div class="col-12 mt-5 text-center mb-3">
|
296 |
<h3 class="section-title">
|
297 |
Dosen dengan
|
298 |
<span style="color: #128c9b">Riwayat Bimbingan Termirip</span>
|
299 |
</h3>
|
300 |
</div>
|
301 |
|
302 |
-
<div class="container-xl" id="similarity-results"></div>
|
303 |
</div>
|
304 |
|
305 |
{% endblock content %} {% block script %}
|
306 |
<script>
|
307 |
let keywords = [];
|
|
|
|
|
308 |
|
309 |
$("#abstrak").on("input", function () {
|
310 |
let text = $(this).val().trim();
|
@@ -337,8 +361,8 @@ title %} {% block content %}
|
|
337 |
if (keyword) {
|
338 |
let badge = $(
|
339 |
`<span class="badge px-2 me-2" style="border: 1px solid #128c9b; color: #128c9b">${keyword}<svg class="close-badge ms-1" xmlns="http://www.w3.org/2000/svg" width="16" height="13" fill="currentColor" class="bi bi-x" viewBox="0 0 16 16">
|
340 |
-
|
341 |
-
|
342 |
);
|
343 |
$("#keywordContainer").append(badge);
|
344 |
keywords.push(keyword);
|
@@ -361,13 +385,28 @@ title %} {% block content %}
|
|
361 |
keywords = [];
|
362 |
});
|
363 |
|
364 |
-
$("#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
365 |
e.preventDefault();
|
366 |
|
367 |
if ($("#abstrak").val().trim() == "") {
|
368 |
alertMessage(
|
369 |
"Abstrak Harus Diisi",
|
370 |
-
"Tidak dapat melakukan
|
371 |
"error"
|
372 |
);
|
373 |
return;
|
@@ -376,7 +415,7 @@ title %} {% block content %}
|
|
376 |
if (keywords.length == 0) {
|
377 |
alertMessage(
|
378 |
"Minimal 1 Kata Kunci",
|
379 |
-
"Tidak dapat melakukan
|
380 |
"error"
|
381 |
);
|
382 |
return;
|
@@ -392,122 +431,134 @@ title %} {% block content %}
|
|
392 |
data: JSON.stringify({
|
393 |
abstrak: $("#abstrak").val(),
|
394 |
kata_kunci: keywords.join(", "),
|
|
|
|
|
395 |
}),
|
396 |
xhrFields: {
|
397 |
withCredentials: true,
|
398 |
},
|
399 |
success: function (response) {
|
400 |
$("#statsResult").empty();
|
401 |
-
|
402 |
-
probs = response["message"]["probs"];
|
403 |
-
|
404 |
-
const classificationResult = Object.entries(probs)
|
405 |
-
.sort((x, y) => x[1] - y[1])
|
406 |
-
.reverse();
|
407 |
-
|
408 |
-
let isFirstRow = true;
|
409 |
-
classificationResult.forEach(([key, value]) => {
|
410 |
-
$("#statsResult").append(
|
411 |
-
`<tr>
|
412 |
-
<td>${key}</td>
|
413 |
-
<td class="stat-cell${
|
414 |
-
isFirstRow ? " fw-bold" : ""
|
415 |
-
}" style="color: #128c9b">${value}%</td>
|
416 |
-
</tr>`
|
417 |
-
);
|
418 |
-
isFirstRow = false;
|
419 |
-
});
|
420 |
-
|
421 |
-
$("#kbk").text(response["message"]["kbk"]);
|
422 |
-
|
423 |
$("#lecturers").empty();
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
439 |
</div>
|
440 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
441 |
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
451 |
</li>
|
|
|
|
|
|
|
|
|
|
|
452 |
</ul>
|
453 |
</div>
|
454 |
</div>
|
455 |
</div>
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
`<div class="app-card app-card-notification shadow-sm mb-4">
|
466 |
-
<div class="app-card-header px-4 py-3">
|
467 |
-
<div class="row g-3 align-items-center">
|
468 |
-
<div class="col-12 col-lg-auto text-start">
|
469 |
-
<div class="notification-type mb-3">
|
470 |
-
<span class="badge" style="background-color: #128c9b"
|
471 |
-
>Rank #${topSimilarity[index]["rank"]}</span
|
472 |
-
>
|
473 |
-
</div>
|
474 |
-
|
475 |
-
<h4 class="notification-title mb-1">${
|
476 |
-
topSimilarity[index]["supervisor"]
|
477 |
-
}</h4>
|
478 |
-
|
479 |
-
<ul class="notification-meta list-inline mb-0">
|
480 |
-
<li class="list-inline-item fw-bold">
|
481 |
-
Skor Kemiripan: <span style="color: #128c9b">${
|
482 |
-
topSimilarity[index]["similarity_score"]
|
483 |
-
}%</span>
|
484 |
-
</li>
|
485 |
-
${
|
486 |
-
topSimilarity[index]["similarity_score"] > 80
|
487 |
-
? `<li class="fw-bold" style="color: red;">Tingkat Kemiripan Sangat Tinggi</li>`
|
488 |
-
: ``
|
489 |
-
}
|
490 |
-
</ul>
|
491 |
</div>
|
492 |
</div>
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
<b>Judul</b><br />${topSimilarity[index]["title"]}
|
497 |
-
</div>
|
498 |
-
<div class="notification-content mb-4">
|
499 |
-
<b>Abstrak</b><br />${topSimilarity[index]["abstract"]}
|
500 |
-
</div>
|
501 |
-
<div class="notification-content">
|
502 |
-
<b>Kata Kunci</b><br />${topSimilarity[index]["keywords"]}
|
503 |
</div>
|
504 |
-
</div
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
</div>`
|
510 |
-
);
|
511 |
}
|
512 |
|
513 |
$("#hasil").removeClass("d-none");
|
@@ -525,7 +576,7 @@ title %} {% block content %}
|
|
525 |
error: function (response) {
|
526 |
$(".spinner").addClass("d-none");
|
527 |
$(".overlay").addClass("d-none");
|
528 |
-
alertMessage("
|
529 |
},
|
530 |
});
|
531 |
});
|
|
|
1 |
+
{% extends 'dashboard/base.html' %} {% block title %}Inferensi{% endblock title
|
2 |
+
%} {% block content %}
|
3 |
|
4 |
+
<h1 class="app-page-title">Inferensi</h1>
|
|
|
|
|
5 |
|
6 |
<div class="row g-4 settings-section">
|
7 |
<div class="col-12">
|
|
|
8 |
<div class="section-intro">
|
9 |
Terdapat
|
10 |
+
<span class="text-unmuted">4 Kelompok Bidang Keahlian (KBK) </span>untuk
|
11 |
+
diklasifikasikan:
|
12 |
</div>
|
13 |
</div>
|
14 |
|
|
|
167 |
</div>
|
168 |
</div>
|
169 |
|
170 |
+
<div class="row g-4 mt-3 settings-section">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
171 |
<div class="col-12">
|
172 |
<div class="app-card app-card-settings shadow-sm p-4">
|
173 |
<div class="app-card-body">
|
174 |
+
<nav
|
175 |
+
id="orders-table-tab"
|
176 |
+
class="orders-table-tab app-nav-tabs nav shadow-sm flex-column flex-sm-row mb-4"
|
177 |
+
>
|
178 |
+
<a
|
179 |
+
class="flex-sm-fill text-sm-center nav-link active"
|
180 |
+
data-bs-toggle="tab"
|
181 |
+
role="tab"
|
182 |
+
aria-controls="orders-all"
|
183 |
+
aria-selected="true"
|
184 |
+
id="setKlasifikasi"
|
185 |
+
>Klasifikasi KBK</a
|
186 |
+
>
|
187 |
+
<a
|
188 |
+
class="flex-sm-fill text-sm-center nav-link"
|
189 |
+
data-bs-toggle="tab"
|
190 |
+
role="tab"
|
191 |
+
aria-controls="orders-paid"
|
192 |
+
aria-selected="false"
|
193 |
+
id="setRekomendasi"
|
194 |
+
>Rekomendasi Dosen</a
|
195 |
+
>
|
196 |
+
<a
|
197 |
+
class="flex-sm-fill text-sm-center nav-link"
|
198 |
+
data-bs-toggle="tab"
|
199 |
+
role="tab"
|
200 |
+
aria-controls="orders-pending"
|
201 |
+
aria-selected="false"
|
202 |
+
id="setAll"
|
203 |
+
>Semua</a
|
204 |
+
>
|
205 |
+
</nav>
|
206 |
+
<form method="post" id="inferencer">
|
207 |
<div class="mb-3">
|
208 |
<div class="d-flex justify-content-between">
|
209 |
<label for="abstrak" class="form-label">Abstrak</label>
|
|
|
252 |
</button>
|
253 |
</div>
|
254 |
<div class="col-auto">
|
255 |
+
<button class="btn app-btn-primary" type="submit">Submit</button>
|
|
|
|
|
256 |
</div>
|
257 |
</div>
|
258 |
</form>
|
|
|
263 |
</div>
|
264 |
</div>
|
265 |
|
266 |
+
<div
|
267 |
+
class="row g-3 settings-section justify-content-center d-none mt-4"
|
268 |
+
id="hasil"
|
269 |
+
>
|
270 |
<div class="col-12">
|
271 |
<h3 class="section-title">Hasil</h3>
|
272 |
</div>
|
273 |
+
<div class="col-12 col-lg-6 hasil-klasifikasi">
|
274 |
<div class="app-card app-card-stats-table h-100 shadow-sm">
|
275 |
<div class="app-card-header p-3">
|
276 |
<div class="row justify-content-between align-items-center">
|
|
|
300 |
<!--//app-card-->
|
301 |
</div>
|
302 |
|
303 |
+
<div class="col-12 mt-5 text-center hasil-klasifikasi">
|
304 |
<h3 class="section-title">
|
305 |
Dosen Kelompok Bidang Keahlian<br /><span
|
306 |
id="kbk"
|
|
|
309 |
</h3>
|
310 |
</div>
|
311 |
|
312 |
+
<div
|
313 |
+
class="row justify-content-center gy-2 hasil-klasifikasi"
|
314 |
+
id="lecturers"
|
315 |
+
></div>
|
316 |
|
317 |
+
<div class="col-12 mt-5 text-center mb-3 hasil-rekomendasi">
|
318 |
<h3 class="section-title">
|
319 |
Dosen dengan
|
320 |
<span style="color: #128c9b">Riwayat Bimbingan Termirip</span>
|
321 |
</h3>
|
322 |
</div>
|
323 |
|
324 |
+
<div class="container-xl hasil-rekomendasi" id="similarity-results"></div>
|
325 |
</div>
|
326 |
|
327 |
{% endblock content %} {% block script %}
|
328 |
<script>
|
329 |
let keywords = [];
|
330 |
+
let klasifikasi = true;
|
331 |
+
let rekomendasi = false;
|
332 |
|
333 |
$("#abstrak").on("input", function () {
|
334 |
let text = $(this).val().trim();
|
|
|
361 |
if (keyword) {
|
362 |
let badge = $(
|
363 |
`<span class="badge px-2 me-2" style="border: 1px solid #128c9b; color: #128c9b">${keyword}<svg class="close-badge ms-1" xmlns="http://www.w3.org/2000/svg" width="16" height="13" fill="currentColor" class="bi bi-x" viewBox="0 0 16 16">
|
364 |
+
<path d="M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708"/>
|
365 |
+
</svg></span>`
|
366 |
);
|
367 |
$("#keywordContainer").append(badge);
|
368 |
keywords.push(keyword);
|
|
|
385 |
keywords = [];
|
386 |
});
|
387 |
|
388 |
+
$("#setKlasifikasi").on("click", function () {
|
389 |
+
klasifikasi = true;
|
390 |
+
rekomendasi = false;
|
391 |
+
});
|
392 |
+
|
393 |
+
$("#setRekomendasi").on("click", function () {
|
394 |
+
klasifikasi = false;
|
395 |
+
rekomendasi = true;
|
396 |
+
});
|
397 |
+
|
398 |
+
$("#setAll").on("click", function () {
|
399 |
+
klasifikasi = true;
|
400 |
+
rekomendasi = true;
|
401 |
+
});
|
402 |
+
|
403 |
+
$("#inferencer").on("submit", function (e) {
|
404 |
e.preventDefault();
|
405 |
|
406 |
if ($("#abstrak").val().trim() == "") {
|
407 |
alertMessage(
|
408 |
"Abstrak Harus Diisi",
|
409 |
+
"Tidak dapat melakukan inferensi",
|
410 |
"error"
|
411 |
);
|
412 |
return;
|
|
|
415 |
if (keywords.length == 0) {
|
416 |
alertMessage(
|
417 |
"Minimal 1 Kata Kunci",
|
418 |
+
"Tidak dapat melakukan inferensi",
|
419 |
"error"
|
420 |
);
|
421 |
return;
|
|
|
431 |
data: JSON.stringify({
|
432 |
abstrak: $("#abstrak").val(),
|
433 |
kata_kunci: keywords.join(", "),
|
434 |
+
klasifikasi: klasifikasi,
|
435 |
+
rekomendasi: rekomendasi,
|
436 |
}),
|
437 |
xhrFields: {
|
438 |
withCredentials: true,
|
439 |
},
|
440 |
success: function (response) {
|
441 |
$("#statsResult").empty();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
442 |
$("#lecturers").empty();
|
443 |
+
$("#similarity-results").empty();
|
444 |
+
|
445 |
+
if (klasifikasi) {
|
446 |
+
$(".hasil-klasifikasi").removeClass("d-none");
|
447 |
+
probs = response["message"]["probs"];
|
448 |
+
|
449 |
+
const classificationResult = Object.entries(probs)
|
450 |
+
.sort((x, y) => x[1] - y[1])
|
451 |
+
.reverse();
|
452 |
+
|
453 |
+
let isFirstRow = true;
|
454 |
+
classificationResult.forEach(([key, value]) => {
|
455 |
+
$("#statsResult").append(
|
456 |
+
`<tr>
|
457 |
+
<td>${key}</td>
|
458 |
+
<td class="stat-cell${
|
459 |
+
isFirstRow ? " fw-bold" : ""
|
460 |
+
}" style="color: #128c9b">${value}%</td>
|
461 |
+
</tr>`
|
462 |
+
);
|
463 |
+
isFirstRow = false;
|
464 |
+
});
|
465 |
+
|
466 |
+
$("#kbk").text(response["message"]["kbk"]);
|
467 |
+
|
468 |
+
$.each(response["message"]["lecturers"], function (index, lecturer) {
|
469 |
+
$("#lecturers").append(
|
470 |
+
`<div class="col-6 col-md-3">
|
471 |
+
<div class="app-card app-card-doc shadow-sm h-100">
|
472 |
+
<div class="app-card-thumb-holder p-3 d-flex justify-content-center">
|
473 |
+
<div
|
474 |
+
style="
|
475 |
+
width: 95px;
|
476 |
+
height: 95px;
|
477 |
+
overflow: hidden;
|
478 |
+
border-radius: 50%;
|
479 |
+
border: 2px solid white;
|
480 |
+
"
|
481 |
+
>
|
482 |
+
<img src="${lecturer.foto}" style="width: 100%; height: 100%; object-fit: cover" />
|
483 |
+
</div>
|
484 |
+
</div>
|
485 |
+
|
486 |
+
<div class="app-card-body p-3 has-card-actions">
|
487 |
+
<h4 class="app-doc-title truncate mb-0">
|
488 |
+
<a href="#">${lecturer.nama}</a>
|
489 |
+
</h4>
|
490 |
+
<div class="app-doc-meta">
|
491 |
+
<ul class="list-unstyled mb-0">
|
492 |
+
<li>
|
493 |
+
Kelompok Bidang Keahlian:
|
494 |
+
<span class="text-unmuted">${lecturer.kelompok_bidang_keahlian}</span>
|
495 |
+
</li>
|
496 |
+
</ul>
|
497 |
+
</div>
|
498 |
</div>
|
499 |
</div>
|
500 |
+
</div>`
|
501 |
+
);
|
502 |
+
});
|
503 |
+
} else {
|
504 |
+
$(".hasil-klasifikasi").addClass("d-none");
|
505 |
+
}
|
506 |
|
507 |
+
if (rekomendasi) {
|
508 |
+
$(".hasil-rekomendasi").removeClass("d-none");
|
509 |
+
var topSimilarity = response["message"]["top_similarity"];
|
510 |
+
|
511 |
+
for (var index = 0; index < topSimilarity.length; index++) {
|
512 |
+
$("#similarity-results").append(
|
513 |
+
`<div class="app-card app-card-notification shadow-sm mb-4">
|
514 |
+
<div class="app-card-header px-4 py-3">
|
515 |
+
<div class="row g-3 align-items-center">
|
516 |
+
<div class="col-12 col-lg-auto text-start">
|
517 |
+
<div class="notification-type mb-3">
|
518 |
+
<span class="badge" style="background-color: #128c9b"
|
519 |
+
>Rank #${topSimilarity[index]["rank"]}</span
|
520 |
+
>
|
521 |
+
</div>
|
522 |
+
|
523 |
+
<h4 class="notification-title mb-1">${
|
524 |
+
topSimilarity[index]["supervisor"]
|
525 |
+
}</h4>
|
526 |
+
|
527 |
+
<ul class="notification-meta list-inline mb-0">
|
528 |
+
<li class="list-inline-item fw-bold">
|
529 |
+
Skor Kemiripan: <span style="color: #128c9b">${
|
530 |
+
topSimilarity[index]["similarity_score"]
|
531 |
+
}%</span>
|
532 |
</li>
|
533 |
+
${
|
534 |
+
topSimilarity[index]["similarity_score"] > 80
|
535 |
+
? `<li class="fw-bold" style="color: red;">Tingkat Kemiripan Sangat Tinggi</li>`
|
536 |
+
: ``
|
537 |
+
}
|
538 |
</ul>
|
539 |
</div>
|
540 |
</div>
|
541 |
</div>
|
542 |
+
<div class="app-card-body p-4">
|
543 |
+
<div class="notification-content mb-4">
|
544 |
+
<b>Judul</b><br />${topSimilarity[index]["title"]}
|
545 |
+
</div>
|
546 |
+
<div class="notification-content mb-4">
|
547 |
+
<b>Abstrak</b><br />${topSimilarity[index]["abstract"]}
|
548 |
+
</div>
|
549 |
+
<div class="notification-content">
|
550 |
+
<b>Kata Kunci</b><br />${topSimilarity[index]["keywords"]}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
551 |
</div>
|
552 |
</div>
|
553 |
+
<div class="app-card-footer px-4 py-3">
|
554 |
+
<a class="action-link" href="${topSimilarity[index]["url"]}"
|
555 |
+
>${topSimilarity[index]["url"]}</a>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
556 |
</div>
|
557 |
+
</div>`
|
558 |
+
);
|
559 |
+
}
|
560 |
+
} else {
|
561 |
+
$(".hasil-rekomendasi").addClass("d-none");
|
|
|
|
|
562 |
}
|
563 |
|
564 |
$("#hasil").removeClass("d-none");
|
|
|
576 |
error: function (response) {
|
577 |
$(".spinner").addClass("d-none");
|
578 |
$(".overlay").addClass("d-none");
|
579 |
+
alertMessage("Inferensi Gagal", "Terjadi kesalahan server", "error");
|
580 |
},
|
581 |
});
|
582 |
});
|
templates/dashboard/history.html
CHANGED
@@ -109,6 +109,7 @@
|
|
109 |
</div>
|
110 |
</div>
|
111 |
|
|
|
112 |
<div class="accordion-item">
|
113 |
<h2 class="accordion-header" id="faq1-heading-3">
|
114 |
<button
|
@@ -167,7 +168,7 @@
|
|
167 |
</div>
|
168 |
</div>
|
169 |
</div>
|
170 |
-
|
171 |
<div class="accordion-item">
|
172 |
<h2 class="accordion-header" id="faq1-heading-5">
|
173 |
<button
|
@@ -205,6 +206,7 @@
|
|
205 |
</div>
|
206 |
</div>
|
207 |
</div>
|
|
|
208 |
</div>
|
209 |
</div>
|
210 |
</div>
|
|
|
109 |
</div>
|
110 |
</div>
|
111 |
|
112 |
+
{% if history.probabilitas %}
|
113 |
<div class="accordion-item">
|
114 |
<h2 class="accordion-header" id="faq1-heading-3">
|
115 |
<button
|
|
|
168 |
</div>
|
169 |
</div>
|
170 |
</div>
|
171 |
+
{% endif %} {% if history.top_similarity %}
|
172 |
<div class="accordion-item">
|
173 |
<h2 class="accordion-header" id="faq1-heading-5">
|
174 |
<button
|
|
|
206 |
</div>
|
207 |
</div>
|
208 |
</div>
|
209 |
+
{% endif %}
|
210 |
</div>
|
211 |
</div>
|
212 |
</div>
|
views/classifier.py
CHANGED
@@ -15,14 +15,26 @@ tz = timezone('Asia/Jakarta')
|
|
15 |
def inference():
|
16 |
abstrak = request.get_json().get('abstrak')
|
17 |
kata_kunci = request.get_json().get('kata_kunci')
|
|
|
|
|
18 |
|
19 |
try:
|
20 |
text = current_app.inference.text_processing(abstrak, kata_kunci)
|
21 |
|
22 |
-
|
23 |
-
|
|
|
24 |
|
25 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
|
27 |
history = History(abstrak=abstrak, kata_kunci=kata_kunci, probabilitas=probs, kelompok_bidang_keahlian=kbk, tanggal_inferensi=datetime.now(tz), top_similarity=recommended)
|
28 |
history.save(current_user.id)
|
|
|
15 |
def inference():
|
16 |
abstrak = request.get_json().get('abstrak')
|
17 |
kata_kunci = request.get_json().get('kata_kunci')
|
18 |
+
klasifikasi = request.get_json().get('klasifikasi')
|
19 |
+
rekomendasi = request.get_json().get('rekomendasi')
|
20 |
|
21 |
try:
|
22 |
text = current_app.inference.text_processing(abstrak, kata_kunci)
|
23 |
|
24 |
+
if klasifikasi:
|
25 |
+
probs, kbk = current_app.inference.classification(text)
|
26 |
+
lecturers = Lecturer.fetch(kelompok_bidang_keahlian=kbk)
|
27 |
|
28 |
+
else:
|
29 |
+
probs = {}
|
30 |
+
kbk = ""
|
31 |
+
lecturers = []
|
32 |
+
|
33 |
+
if rekomendasi:
|
34 |
+
recommended = current_app.inference.content_based_filtering(text)
|
35 |
+
|
36 |
+
else:
|
37 |
+
recommended = []
|
38 |
|
39 |
history = History(abstrak=abstrak, kata_kunci=kata_kunci, probabilitas=probs, kelompok_bidang_keahlian=kbk, tanggal_inferensi=datetime.now(tz), top_similarity=recommended)
|
40 |
history.save(current_user.id)
|