osamaifti commited on
Commit
bf24c1f
·
verified ·
1 Parent(s): 7d04725

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +46 -18
index.html CHANGED
@@ -1,19 +1,47 @@
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="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  </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
+ <style>
8
+ body {
9
+ font-family: Arial, sans-serif;
10
+ margin: 20px;
11
+ }
12
+ .image-container {
13
+ margin-top: 20px;
14
+ }
15
+ .image-container img {
16
+ max-width: 100%;
17
+ height: auto;
18
+ }
19
+ </style>
20
+ </head>
21
+ <body>
22
+ <h1>Upload an Image for Object Detection</h1>
23
+ <form id="uploadForm" enctype="multipart/form-data">
24
+ <input type="file" name="file" accept="image/*" required>
25
+ <button type="submit">Upload and Detect</button>
26
+ </form>
27
+ <div class="image-container" id="imageContainer"></div>
28
+
29
+ <script>
30
+ document.getElementById('uploadForm').addEventListener('submit', async function(event) {
31
+ event.preventDefault();
32
+
33
+ const formData = new FormData(this);
34
+ const response = await fetch('/', {
35
+ method: 'POST',
36
+ body: formData
37
+ });
38
+
39
+ const result = await response.json();
40
+ const imageUrl = result.image_url;
41
+
42
+ const imageContainer = document.getElementById('imageContainer');
43
+ imageContainer.innerHTML = `<h2>Detected Image:</h2><img src="${imageUrl}" alt="Detected Image">`;
44
+ });
45
+ </script>
46
+ </body>
47
  </html>