File size: 1,291 Bytes
07e0d73
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<!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>