DmitrMakeev commited on
Commit
61311b9
·
verified ·
1 Parent(s): 6f5975a

Update online.html

Browse files
Files changed (1) hide show
  1. online.html +42 -32
online.html CHANGED
@@ -1,33 +1,43 @@
1
  <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="https://huggingface.co/spaces/vk-ai-system/flask_inference_api/resolve/main/style.css" />
8
-
9
-
10
-
11
-
12
-
13
-
14
- </head>
15
- <body>
16
- <div class="card">
17
- <h1>Welcome to your static Space!</h1>
18
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
19
- <p>
20
- Also don't forget to check the
21
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
22
- </p>
23
- </div>
24
-
25
-
26
-
27
-
28
-
29
-
30
-
31
-
32
- </body>
33
- </html>
 
 
 
 
 
 
 
 
 
 
 
1
  <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Upload Image</title>
7
+ </head>
8
+ <body>
9
+ <h1>Upload Image</h1>
10
+ <form id="uploadForm" enctype="multipart/form-data">
11
+ <input type="file" name="image" id="imageInput">
12
+ <button type="submit">Upload</button>
13
+ </form>
14
+ <div id="message"></div>
15
+
16
+ <script>
17
+ document.getElementById('uploadForm').addEventListener('submit', function(event) {
18
+ event.preventDefault();
19
+ var formData = new FormData();
20
+ var imageFile = document.getElementById('imageInput').files[0];
21
+ formData.append('image', imageFile);
22
+
23
+ fetch('/upload', {
24
+ method: 'POST',
25
+ body: formData
26
+ })
27
+ .then(response => {
28
+ if (response.ok) {
29
+ return response.text();
30
+ }
31
+ throw new Error('Network response was not ok.');
32
+ })
33
+ .then(data => {
34
+ document.getElementById('message').innerText = data;
35
+ })
36
+ .catch(error => {
37
+ console.error('There was a problem with the fetch operation:', error);
38
+ document.getElementById('message').innerText = 'Error: ' + error.message;
39
+ });
40
+ });
41
+ </script>
42
+ </body>
43
+ </html>