Ashrafb commited on
Commit
e00db0c
·
verified ·
1 Parent(s): 2371a34

Update static/index.html

Browse files
Files changed (1) hide show
  1. static/index.html +18 -14
static/index.html CHANGED
@@ -15,23 +15,27 @@
15
 
16
  <script>
17
  async function uploadFile() {
18
- const formData = new FormData();
19
- const fileInput = document.querySelector('input[type="file"]');
20
- formData.append('file', fileInput.files[0]);
21
 
22
- const response = await fetch('/upload/', {
23
- method: 'POST',
24
- body: formData
25
- });
26
 
27
- const data = await response.json();
28
- document.getElementById('result').innerHTML = `<img src="data:image/png;base64,${data.sketch_image}" />`;
29
- }
 
 
 
 
 
 
 
 
30
 
31
- document.querySelector('form').addEventListener('submit', function(event) {
32
- event.preventDefault();
33
- uploadFile();
34
- });
35
  </script>
36
  </body>
37
  </html>
 
15
 
16
  <script>
17
  async function uploadFile() {
18
+ const formData = new FormData();
19
+ const fileInput = document.querySelector('input[type="file"]');
20
+ formData.append('file', fileInput.files[0]);
21
 
22
+ const response = await fetch('/upload/', {
23
+ method: 'POST',
24
+ body: formData
25
+ });
26
 
27
+ const data = await response.json();
28
+
29
+ // Assuming 'Result File' contains a file path
30
+ const resultFilePath = data['Result File'];
31
+ document.getElementById('result').innerHTML = `<img src="${resultFilePath}" />`;
32
+ }
33
+
34
+ document.querySelector('form').addEventListener('submit', function(event) {
35
+ event.preventDefault();
36
+ uploadFile();
37
+ });
38
 
 
 
 
 
39
  </script>
40
  </body>
41
  </html>