Prajwal-r-k commited on
Commit
9e9a423
·
verified ·
1 Parent(s): 871ce8c

Update templates/index.html

Browse files
Files changed (1) hide show
  1. templates/index.html +60 -60
templates/index.html CHANGED
@@ -1,60 +1,60 @@
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>Image Enhancement with NAFNet</title>
7
- <style>
8
- body { font-family: Arial, sans-serif; margin: 20px; }
9
- .image-container { display: flex; gap: 20px; margin-top: 20px; }
10
- img { max-width: 300px; height: auto; border: 1px solid #ccc; }
11
- .hidden { display: none; }
12
- </style>
13
- </head>
14
- <body>
15
- <h1>Upload Image for AI Enhancement (NAFNet)</h1>
16
- <input type="file" id="fileInput" accept="image/*">
17
- <button id="enhanceButton">Enhance Image</button>
18
-
19
- <div class="image-container hidden" id="imageResults">
20
- <div>
21
- <h3>Original Image:</h3>
22
- <img id="beforeImage" src="" alt="Before Image">
23
- </div>
24
- <div>
25
- <h3>Enhanced Image:</h3>
26
- <img id="afterImage" src="" alt="Enhanced Image">
27
- </div>
28
- </div>
29
-
30
- <script>
31
- document.getElementById('enhanceButton').addEventListener('click', function () {
32
- const fileInput = document.getElementById('fileInput');
33
- if (!fileInput.files.length) {
34
- alert('Please select an image.');
35
- return;
36
- }
37
-
38
- const file = fileInput.files[0];
39
- const formData = new FormData();
40
- formData.append('file', file);
41
-
42
- fetch('http://127.0.0.1:5000/process_image', {
43
- method: 'POST',
44
- body: formData,
45
- })
46
- .then(response => response.json())
47
- .then(data => {
48
- if (data.status === 'success') {
49
- document.getElementById('beforeImage').src = URL.createObjectURL(file);
50
- document.getElementById('afterImage').src = data.output_path;
51
- document.getElementById('imageResults').classList.remove('hidden');
52
- } else {
53
- alert('Processing failed: ' + data.message);
54
- }
55
- })
56
- .catch(error => console.error('Error:', error));
57
- });
58
- </script>
59
- </body>
60
- </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>Image Enhancement with NAFNet</title>
7
+ <style>
8
+ body { font-family: Arial, sans-serif; margin: 20px; }
9
+ .image-container { display: flex; gap: 20px; margin-top: 20px; }
10
+ img { max-width: 300px; height: auto; border: 1px solid #ccc; }
11
+ .hidden { display: none; }
12
+ </style>
13
+ </head>
14
+ <body>
15
+ <h1>Upload Image for AI Enhancement (NAFNet)</h1>
16
+ <input type="file" id="fileInput" accept="image/*">
17
+ <button id="enhanceButton">Enhance Image</button>
18
+
19
+ <div class="image-container hidden" id="imageResults">
20
+ <div>
21
+ <h3>Original Image:</h3>
22
+ <img id="beforeImage" src="" alt="Before Image">
23
+ </div>
24
+ <div>
25
+ <h3>Enhanced Image:</h3>
26
+ <img id="afterImage" src="" alt="Enhanced Image">
27
+ </div>
28
+ </div>
29
+
30
+ <script>
31
+ document.getElementById('enhanceButton').addEventListener('click', function () {
32
+ const fileInput = document.getElementById('fileInput');
33
+ if (!fileInput.files.length) {
34
+ alert('Please select an image.');
35
+ return;
36
+ }
37
+
38
+ const file = fileInput.files[0];
39
+ const formData = new FormData();
40
+ formData.append('file', file);
41
+
42
+ fetch('/process_image', {
43
+ method: 'POST',
44
+ body: formData,
45
+ })
46
+ .then(response => response.json())
47
+ .then(data => {
48
+ if (data.status === 'success') {
49
+ document.getElementById('beforeImage').src = URL.createObjectURL(file);
50
+ document.getElementById('afterImage').src = data.output_path;
51
+ document.getElementById('imageResults').classList.remove('hidden');
52
+ } else {
53
+ alert('Processing failed: ' + data.message);
54
+ }
55
+ })
56
+ .catch(error => console.error('Error:', error));
57
+ });
58
+ </script>
59
+ </body>
60
+ </html>