ta-azis-pendeteksi-nominal-.../project/templates/testing.html

304 lines
8.8 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<title>MIRA - Testing</title>
<link href="https://fonts.googleapis.com/css2?family=Dangrek&family=Poppins:wght@400;600;700&display=swap" rel="stylesheet">
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
font-family: 'Poppins', sans-serif;
background: #6D60B4;
min-height: 100vh;
display: flex;
align-items: center;
padding: 20px;
}
.wrapper {
display: flex;
width: 100%;
min-height: calc(100vh - 40px);
}
.sidebar {
width: 170px;
display: flex;
flex-direction: column;
align-items: center;
padding: 32px 14px 24px;
gap: 40px;
flex-shrink: 0;
}
.brand {
text-align: center;
color: white;
}
.brand h2 {
font-family: 'Poppins', sans-serif;
font-size: 26px;
font-weight: 700;
line-height: 1;
letter-spacing: 2px;
}
.brand p {
font-family: 'Poppins', sans-serif;
font-size: 10px;
line-height: 1.5;
margin-top: 7px;
opacity: 0.9;
font-weight: 400;
}
.nav {
display: flex;
flex-direction: column;
gap: 10px;
width: 100%;
}
.nav-item {
display: flex;
align-items: center;
gap: 10px;
padding: 10px 10px 10px 16px;
color: rgba(255,255,255,0.6);
cursor: pointer;
font-family: 'Poppins', sans-serif;
font-size: 14px;
font-weight: 600;
text-decoration: none;
position: relative;
}
.nav-item.active { color: white; }
.nav-item.active::before {
content: '';
position: absolute;
left: 0;
top: 50%;
transform: translateY(-50%);
width: 4px;
height: 28px;
background: white;
border-radius: 0 3px 3px 0;
}
.icon-grid {
width: 22px; height: 22px;
display: inline-block;
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Crect x='3' y='3' width='8' height='8' rx='1'/%3E%3Crect x='13' y='3' width='8' height='8' rx='1'/%3E%3Crect x='3' y='13' width='8' height='8' rx='1'/%3E%3Crect x='13' y='13' width='8' height='8' rx='1'/%3E%3C/svg%3E");
background-size: contain;
background-repeat: no-repeat;
flex-shrink: 0;
}
.icon-money {
width: 22px; height: 22px;
display: inline-block;
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z'/%3E%3C/svg%3E");
background-size: contain;
background-repeat: no-repeat;
flex-shrink: 0;
}
.icon-train {
width: 22px; height: 22px;
display: inline-block; flex-shrink: 0;
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M19 3H5c-1.1 0-2 .9-2 2v14l4-4h12c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-5 9l-3-2.25V12H7V6h4v2.25L14 6l5 3-5 3z'/%3E%3C/svg%3E");
background-size: contain;
background-repeat: no-repeat;
}
.main-wrap {
flex: 1;
display: flex;
}
.content-area {
flex: 1;
background: #FFFFFF;
border-radius: 24px;
padding: 32px 36px 36px;
display: flex;
flex-direction: column;
}
.page-title {
font-family: 'Poppins', sans-serif;
font-size: 24px;
font-weight: 700;
color: #6D60B4;
margin-bottom: 24px;
width: 100%;
text-align: left;
}
.test-card-wrap {
flex: 1;
display: flex;
align-items: flex-start;
justify-content: center;
}
.test-card {
background: #C4BFDF;
border-radius: 18px;
padding: 28px 32px;
width: 420px;
max-width: 100%;
display: flex;
flex-direction: column;
align-items: center;
gap: 14px;
}
.test-title {
font-family: 'Poppins', sans-serif;
font-size: 18px;
font-weight: 700;
color: #4a3a9a;
text-align: center;
}
.file-row {
display: flex;
align-items: center;
gap: 10px;
}
.file-label {
background: #6D60B4;
color: white;
font-family: 'Poppins', sans-serif;
font-size: 11px;
padding: 6px 16px;
border-radius: 7px;
cursor: pointer;
font-weight: 600;
white-space: nowrap;
}
.file-label:hover { background: #5c51a0; }
input[type="file"] { display: none; }
.file-name {
font-family: 'Poppins', sans-serif;
font-size: 11px;
color: #4a3a9a;
}
.detect-btn {
background: #6D60B4;
color: white;
border: none;
border-radius: 10px;
padding: 8px 28px;
font-family: 'Poppins', sans-serif;
font-size: 13px;
font-weight: 600;
cursor: pointer;
}
.detect-btn:hover { background: #5c51a0; }
.preview-box { width: 100%; }
.preview-box img {
width: 100%;
border-radius: 12px;
display: block;
}
.result-box {
font-family: 'Poppins', sans-serif;
font-size: 14px;
font-weight: 700;
color: #4a3a9a;
line-height: 2;
text-align: center;
}
</style>
</head>
<body>
<div class="wrapper">
<div class="sidebar">
<div class="brand">
<h2>MIRA</h2>
<p>Money Identification and<br>Recognition Assistant</p>
</div>
<nav class="nav">
<a href="/monitoring" class="nav-item">
<span class="icon-grid"></span> Monitoring
</a>
<a href="/testing" class="nav-item active">
<span class="icon-money"></span> Testing
</a>
<a href="/training" class="nav-item">
<span class="icon-train"></span> Training
</a>
</nav>
</div>
<div class="main-wrap">
<div class="content-area">
<div class="page-title">Testing</div>
<div class="test-card-wrap">
<div class="test-card">
<div class="test-title">Test Deteksi Uang</div>
<div class="file-row">
<label class="file-label" for="fileInput">Choose File</label>
<input type="file" id="fileInput" onchange="updateFileName(this)" />
<span class="file-name" id="fileName">No File Chosen</span>
</div>
<button class="detect-btn" onclick="uploadImage()">Detect</button>
<div class="preview-box">
<img id="preview" src="" alt="" style="display:none;" />
</div>
<div class="result-box">
Nominal : <span id="nominal">-</span><br>
Convidance : <span id="conf">-</span>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
function updateFileName(input) {
const name = input.files[0] ? input.files[0].name : "No File Chosen";
document.getElementById("fileName").textContent = name;
}
function uploadImage() {
let fileInput = document.getElementById("fileInput");
let file = fileInput.files[0];
if (!file) return;
let formData = new FormData();
formData.append("image", file);
fetch("/upload_test", {
method: "POST",
body: formData
})
.then(res => res.json())
.then(data => {
const preview = document.getElementById("preview");
preview.src = data.image + "?t=" + new Date().getTime();
preview.style.display = "block";
document.getElementById("nominal").innerText = data.nominal;
document.getElementById("conf").innerText = data.confidence;
});
}
</script>
</body>
</html>