| <!DOCTYPE html> |
| <html lang="en"> |
| <head> |
| <meta charset="UTF-8"> |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| <title>Image Stylization</title> |
| </head> |
| <body> |
| <h1>Upload Images for Stylization</h1> |
| <form id="upload-form" enctype="multipart/form-data"> |
| <label for="content">Content Image:</label> |
| <input type="file" id="content" name="content_file" accept="image/*" required><br><br> |
| <label for="style">Style Image:</label> |
| <input type="file" id="style" name="style_file" accept="image/*" required><br><br> |
| <button type="submit">Stylize</button> |
| </form> |
| <h2>Result</h2> |
| <img id="result" alt="Stylized Image" style="max-width: 100%;"> |
|
|
| <script> |
| const form = document.getElementById('upload-form'); |
| const resultImage = document.getElementById('result'); |
| |
| form.addEventListener('submit', async (event) => { |
| event.preventDefault(); |
| const formData = new FormData(form); |
| const response = await fetch('/process', { |
| method: 'POST', |
| body: formData |
| }); |
| const blob = await response.blob(); |
| resultImage.src = URL.createObjectURL(blob); |
| }); |
| </script> |
| </body> |
| </html> |