Ashrafb commited on
Commit
dc5dca1
·
verified ·
1 Parent(s): 1e8a95f

Update static/index.html

Browse files
Files changed (1) hide show
  1. static/index.html +27 -4
static/index.html CHANGED
@@ -4,13 +4,36 @@
4
  <title>Aiconvert.online</title>
5
  </head>
6
  <body>
7
- <form action="/inference/" method="post" enctype="multipart/form-data">
8
- <input type="file" name="file">
9
- <select name="ver">
10
  <option value="version 1 (🔺 stylization, 🔻 robustness)">Version 1 (🔺 stylization, 🔻 robustness)</option>
11
  <option value="version 2 (🔺 robustness,🔻 stylization)" selected>Version 2 (🔺 robustness,🔻 stylization)</option>
12
  </select>
13
- <button type="submit">Submit</button>
14
  </form>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
  </body>
16
  </html>
 
4
  <title>Aiconvert.online</title>
5
  </head>
6
  <body>
7
+ <form id="uploadForm" enctype="multipart/form-data">
8
+ <input type="file" id="fileInput" name="file">
9
+ <select id="versionSelect" name="ver">
10
  <option value="version 1 (🔺 stylization, 🔻 robustness)">Version 1 (🔺 stylization, 🔻 robustness)</option>
11
  <option value="version 2 (🔺 robustness,🔻 stylization)" selected>Version 2 (🔺 robustness,🔻 stylization)</option>
12
  </select>
13
+ <button type="button" onclick="submitForm()">Submit</button>
14
  </form>
15
+
16
+ <div id="resultContainer"></div>
17
+
18
+ <script>
19
+ function submitForm() {
20
+ var formData = new FormData();
21
+ var fileInput = document.getElementById('fileInput');
22
+ var selectedVersion = document.getElementById('versionSelect').value;
23
+ formData.append('file', fileInput.files[0]);
24
+ formData.append('ver', selectedVersion);
25
+
26
+ fetch('/inference/', {
27
+ method: 'POST',
28
+ body: formData
29
+ })
30
+ .then(response => response.text())
31
+ .then(data => {
32
+ var resultContainer = document.getElementById('resultContainer');
33
+ resultContainer.innerHTML = '<img src="data:image/png;base64,' + data + '" />';
34
+ })
35
+ .catch(error => console.error('Error:', error));
36
+ }
37
+ </script>
38
  </body>
39
  </html>