Update templates/pifuhd.html
Browse files- templates/pifuhd.html +92 -0
templates/pifuhd.html
CHANGED
|
@@ -0,0 +1,92 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>PIFuHD Mesh Generator</title>
|
| 7 |
+
<style>
|
| 8 |
+
body {
|
| 9 |
+
font-family: Arial, sans-serif;
|
| 10 |
+
background-color: #f4f4f4;
|
| 11 |
+
margin: 0;
|
| 12 |
+
padding: 20px;
|
| 13 |
+
display: flex;
|
| 14 |
+
flex-direction: column;
|
| 15 |
+
align-items: center;
|
| 16 |
+
justify-content: center;
|
| 17 |
+
height: 100vh;
|
| 18 |
+
}
|
| 19 |
+
h1 {
|
| 20 |
+
color: #333;
|
| 21 |
+
}
|
| 22 |
+
form {
|
| 23 |
+
background-color: #fff;
|
| 24 |
+
padding: 20px;
|
| 25 |
+
border-radius: 5px;
|
| 26 |
+
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
|
| 27 |
+
}
|
| 28 |
+
input[type="file"] {
|
| 29 |
+
margin-bottom: 10px;
|
| 30 |
+
}
|
| 31 |
+
button {
|
| 32 |
+
background-color: #007bff;
|
| 33 |
+
color: #fff;
|
| 34 |
+
border: none;
|
| 35 |
+
padding: 10px 20px;
|
| 36 |
+
cursor: pointer;
|
| 37 |
+
border-radius: 5px;
|
| 38 |
+
}
|
| 39 |
+
button:hover {
|
| 40 |
+
background-color: #0056b3;
|
| 41 |
+
}
|
| 42 |
+
#download-link {
|
| 43 |
+
display: none;
|
| 44 |
+
margin-top: 20px;
|
| 45 |
+
}
|
| 46 |
+
</style>
|
| 47 |
+
</head>
|
| 48 |
+
<body>
|
| 49 |
+
|
| 50 |
+
<h1>PIFuHD Mesh Generator</h1>
|
| 51 |
+
|
| 52 |
+
<form id="upload-form">
|
| 53 |
+
<input type="file" id="file-input" name="file" accept="image/*" required>
|
| 54 |
+
<button type="submit">Generate Mesh</button>
|
| 55 |
+
</form>
|
| 56 |
+
|
| 57 |
+
<a id="download-link">Download Generated OBJ File</a>
|
| 58 |
+
|
| 59 |
+
<script>
|
| 60 |
+
document.getElementById('upload-form').addEventListener('submit', function(event) {
|
| 61 |
+
event.preventDefault();
|
| 62 |
+
|
| 63 |
+
var formData = new FormData();
|
| 64 |
+
var fileInput = document.getElementById('file-input');
|
| 65 |
+
formData.append('file', fileInput.files[0]);
|
| 66 |
+
|
| 67 |
+
fetch('/generate-mesh', {
|
| 68 |
+
method: 'POST',
|
| 69 |
+
body: formData
|
| 70 |
+
})
|
| 71 |
+
.then(response => {
|
| 72 |
+
if (!response.ok) {
|
| 73 |
+
throw new Error('Network response was not ok.');
|
| 74 |
+
}
|
| 75 |
+
return response.blob();
|
| 76 |
+
})
|
| 77 |
+
.then(blob => {
|
| 78 |
+
var url = window.URL.createObjectURL(blob);
|
| 79 |
+
var downloadLink = document.getElementById('download-link');
|
| 80 |
+
downloadLink.href = url;
|
| 81 |
+
downloadLink.download = 'output.obj';
|
| 82 |
+
downloadLink.style.display = 'block';
|
| 83 |
+
downloadLink.textContent = 'Download Generated OBJ File';
|
| 84 |
+
})
|
| 85 |
+
.catch(error => {
|
| 86 |
+
console.error('There was a problem with the fetch operation:', error);
|
| 87 |
+
});
|
| 88 |
+
});
|
| 89 |
+
</script>
|
| 90 |
+
|
| 91 |
+
</body>
|
| 92 |
+
</html>
|