Vsdock / static /index1.html
Ashrafb's picture
Rename static/index.html to static/index1.html
f7ab34a verified
<!DOCTYPE html>
<html>
<head>
<title>Face2Vintage</title>
<style>
/* Style to make the image smaller */
#resultContainer img {
max-width: 100%;
height: auto;
}
</style>
<script>
document.addEventListener('DOMContentLoaded', function() {
document.getElementById('uploadForm').addEventListener('submit', async function(event) {
event.preventDefault();
const formData = new FormData(this);
try {
const response = await fetch('/process_image/', {
method: 'POST',
body: formData
});
const result = await response.blob();
const imageURL = URL.createObjectURL(result);
document.getElementById('resultContainer').innerHTML = `<img src="${imageURL}" alt="Result Image">`;
} catch (error) {
console.error('Error:', error);
}
});
});
</script>
</head>
<body>
<h1>Upload Image</h1>
<form id="uploadForm" enctype="multipart/form-data">
<input type="file" id="imageInput" name="file">
<input type="submit" value="Upload Image">
</form>
<div id="resultContainer"></div>
</body>
</html>