Spaces:
Demise307
/
No application file

File size: 1,388 Bytes
01c532f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
43
44
45
46
47
48
49
50
51
52
53
54
55
<!DOCTYPE html>
<html>
<head>
  <title>Image Super Resolution</title>
</head>
<body>
  <h2>Upload Image</h2>

  <input type="file" id="imageInput"><br><br>

  <label>Steps:</label>
  <select id="steps">
    <option>1</option>
    <option>2</option>
    <option>3</option>
    <option>4</option>
    <option>5</option>
  </select><br><br>

  <label>Chopping Size:</label>
  <select id="chop">
    <option>128</option>
    <option>256</option>
    <option>512</option>
  </select><br><br>

  <label>Seed:</label>
  <input type="number" id="seed" value="12345"><br><br>

  <button onclick="upload()">Run</button>

  <h3>Result:</h3>
  <img id="output" width="400"/>

  <script>

    async function upload() {

      let file = document.getElementById("imageInput").files[0];



      let formData = new FormData();

      formData.append("image", file);

      formData.append("num_steps", document.getElementById("steps").value);

      formData.append("chopping_size", document.getElementById("chop").value);

      formData.append("seed", document.getElementById("seed").value);



      let res = await fetch("http://localhost:5000/predict", {

        method: "POST",

        body: formData

      });



      let blob = await res.blob();

      document.getElementById("output").src = URL.createObjectURL(blob);

    }

  </script>
</body>
</html>