File size: 1,368 Bytes
a5d67cd
 
 
 
6bb6a6c
 
 
 
 
 
 
 
5fdfdbb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
61c4736
9efc85e
a5d67cd
 
 
9efc85e
 
5fdfdbb
a5d67cd
9efc85e
61c4736
a5d67cd
 
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
37
38
39
40
41
42
<!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>