osamaifti commited on
Commit
c57e253
·
verified ·
1 Parent(s): 7372569

Rename templates/upload.html to templates/index.html

Browse files
templates/{upload.html → index.html} RENAMED
@@ -1,47 +1,47 @@
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>
 
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>