Itsdockertest1 / static /index.html
Ashrafb's picture
Create static/index.html
e108154 verified
raw
history blame
1.1 kB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Sketch Prediction</title>
</head>
<body>
<h1>Sketch Prediction</h1>
<form id="uploadForm" enctype="multipart/form-data">
<input type="file" id="fileInput" name="file" accept="image/*">
<button type="submit">Submit</button>
</form>
<div id="result"></div>
<script>
document.getElementById('uploadForm').addEventListener('submit', async function(event) {
event.preventDefault();
const formData = new FormData();
formData.append('file', document.getElementById('fileInput').files[0]);
const response = await fetch('/predict/', {
method: 'POST',
body: formData
});
const data = await response.blob();
const url = URL.createObjectURL(data);
document.getElementById('result').innerHTML = `<img src="${url}" alt="Prediction Result">`;
});
</script>
</body>
</html>