Create templates/index.html
Browse files- templates/index.html +30 -0
templates/index.html
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!DOCTYPE html>
|
2 |
+
<html>
|
3 |
+
<head>
|
4 |
+
<title>Image Matcher</title>
|
5 |
+
</head>
|
6 |
+
<body>
|
7 |
+
<h2>Upload an Image (Base64 encoded)</h2>
|
8 |
+
<textarea id="b64input" rows="10" cols="80" placeholder="Paste Base64 image here..."></textarea>
|
9 |
+
<br><br>
|
10 |
+
<button onclick="sendImage()">Match Image</button>
|
11 |
+
<pre id="result"></pre>
|
12 |
+
|
13 |
+
<script>
|
14 |
+
async function sendImage() {
|
15 |
+
const b64 = document.getElementById("b64input").value.trim();
|
16 |
+
if (!b64) {
|
17 |
+
alert("Please paste a base64 image string");
|
18 |
+
return;
|
19 |
+
}
|
20 |
+
const res = await fetch("/match", {
|
21 |
+
method: "POST",
|
22 |
+
headers: {"Content-Type": "application/json"},
|
23 |
+
body: JSON.stringify({images: [b64]})
|
24 |
+
});
|
25 |
+
const data = await res.json();
|
26 |
+
document.getElementById("result").textContent = JSON.stringify(data, null, 2);
|
27 |
+
}
|
28 |
+
</script>
|
29 |
+
</body>
|
30 |
+
</html>
|