File size: 790 Bytes
15702c2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
<!DOCTYPE html>
<html>
<head>
    <title>Image Enhancer</title>
    <style>
        body { font-family: Arial; padding: 40px; }
        img { max-width: 400px; margin-top: 20px; }
    </style>
</head>
<body>

<h2>Real-ESRGAN Image Enhancer</h2>

<input type="file" id="fileInput">
<button onclick="upload()">Enhance</button>

<br>
<img id="result"/>

<script>
async function upload() {
    const file = document.getElementById("fileInput").files[0];
    if (!file) return alert("Select image");

    const form = new FormData();
    form.append("file", file);

    const res = await fetch("/enhance", {
        method: "POST",
        body: form
    });

    const blob = await res.blob();
    document.getElementById("result").src = URL.createObjectURL(blob);
}
</script>

</body>
</html>