Update static/index.html
Browse files- static/index.html +15 -3
static/index.html
CHANGED
|
@@ -239,7 +239,8 @@ h1 {
|
|
| 239 |
|
| 240 |
|
| 241 |
<a id="download-link" href="#" download="colorized_image.jpg" style="display:none;">Download Colorized Image</a>
|
| 242 |
-
|
|
|
|
| 243 |
<script>
|
| 244 |
function previewImage(event, imageId) {
|
| 245 |
const fileInput = event.target;
|
|
@@ -254,6 +255,18 @@ h1 {
|
|
| 254 |
reader.readAsDataURL(file);
|
| 255 |
}
|
| 256 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 257 |
async function uploadFile() {
|
| 258 |
const sourceFileInput = document.getElementById('sourceFile');
|
| 259 |
const resultContainer = document.getElementById('resultContainer');
|
|
@@ -289,8 +302,7 @@ h1 {
|
|
| 289 |
// If successful response, display the result image
|
| 290 |
const blob = await response.blob();
|
| 291 |
|
| 292 |
-
displayColorizedImage(blob)
|
| 293 |
-
resultContainer.appendChild(blob);
|
| 294 |
|
| 295 |
|
| 296 |
} else {
|
|
|
|
| 239 |
|
| 240 |
|
| 241 |
<a id="download-link" href="#" download="colorized_image.jpg" style="display:none;">Download Colorized Image</a>
|
| 242 |
+
</div>
|
| 243 |
+
</div>
|
| 244 |
<script>
|
| 245 |
function previewImage(event, imageId) {
|
| 246 |
const fileInput = event.target;
|
|
|
|
| 255 |
reader.readAsDataURL(file);
|
| 256 |
}
|
| 257 |
|
| 258 |
+
|
| 259 |
+
function displayColorizedImage(blob) {
|
| 260 |
+
const url = URL.createObjectURL(blob);
|
| 261 |
+
const resultContainer = document.getElementById('resultContainer');
|
| 262 |
+
resultContainer.innerHTML = `<img src="${url}" alt="Colorized Image" width="400">`;
|
| 263 |
+
const downloadLink = document.getElementById('download-link');
|
| 264 |
+
downloadLink.href = url;
|
| 265 |
+
downloadLink.style.display = 'block';
|
| 266 |
+
}
|
| 267 |
+
|
| 268 |
+
|
| 269 |
+
|
| 270 |
async function uploadFile() {
|
| 271 |
const sourceFileInput = document.getElementById('sourceFile');
|
| 272 |
const resultContainer = document.getElementById('resultContainer');
|
|
|
|
| 302 |
// If successful response, display the result image
|
| 303 |
const blob = await response.blob();
|
| 304 |
|
| 305 |
+
displayColorizedImage(blob);
|
|
|
|
| 306 |
|
| 307 |
|
| 308 |
} else {
|