Ashrafb commited on
Commit
435caf5
1 Parent(s): 17d50ba

Update static/index.html

Browse files
Files changed (1) hide show
  1. static/index.html +341 -30
static/index.html CHANGED
@@ -7,55 +7,366 @@
7
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
8
  <title>Image Enhancement</title>
9
  <style>
10
- /* Style to make the image smaller */
11
- #resultContainer img {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12
  max-width: 100%;
13
  height: auto;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
  }
 
15
  </style>
16
  </head>
17
  <body>
18
- <h1>Image Enhancement</h1>
19
- <form id="uploadForm" enctype="multipart/form-data">
20
- <label for="image">Upload Image:</label>
21
- <input type="file" id="image" name="file" accept="image/*" required><br><br>
22
-
 
 
 
 
 
 
 
 
23
  <label for="version">Select Version:</label>
24
  <select id="version" name="version">
25
  <option value="v1.2">v1.2</option>
26
  <option value="v1.3">v1.3</option>
27
  <option value="v1.4">v1.4</option>
28
  <!-- Add more options as needed -->
29
- </select><br><br>
30
 
31
- <label for="scale">Select Scale:</label>
32
- <select id="scale" name="scale">
33
- <option value="2">2x</option>
34
- <option value="4">4x</option>
35
- <!-- Add more options as needed -->
36
- </select><br><br>
37
 
38
  <button type="submit">Enhance Image</button>
39
  </form>
40
 
 
 
 
 
 
 
 
41
  <div id="resultContainer"></div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
42
 
43
- <script>
44
- document.getElementById('uploadForm').addEventListener('submit', async function(event) {
45
- event.preventDefault();
46
- const formData = new FormData(this);
47
- try {
48
- const response = await fetch('/upload/', {
49
- method: 'POST',
50
- body: formData
51
- });
52
- const result = await response.blob();
53
- const imageURL = URL.createObjectURL(result);
54
- document.getElementById('resultContainer').innerHTML = `<img src="${imageURL}" alt="Enhanced Image">`;
55
- } catch (error) {
56
- console.error('Error:', error);
57
- }
 
 
 
 
 
58
  });
59
- </script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
60
  </body>
61
  </html>
 
7
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
8
  <title>Image Enhancement</title>
9
  <style>
10
+ body {
11
+ background-color: #121212;
12
+ color: #FFFFFF;
13
+ }
14
+
15
+ /* Dark mode for upload buttons */
16
+ .uploadButton {
17
+ background-color: #1E7E34;
18
+ }
19
+
20
+ /* Dark mode for file input labels */
21
+ .uploadLabel {
22
+ background-color: #BF2C25;
23
+ }
24
+
25
+ /* Dark mode for face number inputs */
26
+ input[type="number"] {
27
+ background-color: #333333;
28
+ color: #FFFFFF;
29
+ border: 1px solid #555555;
30
+ }
31
+
32
+ /* Dark mode for swap button */
33
+ button[type="button"] {
34
+ background-color: #1E7E34;
35
+ }
36
+
37
+ /* Dark mode hover effect for swap button */
38
+ button[type="button"]:hover {
39
+ background-color: #2E9E44;
40
+ }
41
+
42
+ /* Style for upload buttons */
43
+ input[type="file"] {
44
+ display: none; /* Hide the default file input */
45
+ }
46
+
47
+ .uploadButton {
48
+ background-color: #4CAF50;
49
+ border: none;
50
+ color: white;
51
+ padding: 10px 20px;
52
+ text-align: center;
53
+ text-decoration: none;
54
+ display: inline-block;
55
+ font-size: 16px;
56
+ margin-top: 10px;
57
+ cursor: pointer;
58
+ border-radius: 5px;
59
+ margin: auto;
60
+ margin: 0 auto;
61
+ }
62
+
63
+ /* Style for file input labels */
64
+ #uploadForm {
65
+ display: flex;
66
+ flex-direction: column;
67
+ align-items: center;
68
+ }
69
+
70
+ .uploadLabel {
71
+ padding: 10px 20px;
72
+ background-color: #f44336;
73
+ color: white;
74
+ border-radius: 5px;
75
+ cursor: pointer;
76
+ display: block;
77
+ margin: 0 auto;
78
+
79
+ }
80
+
81
+ .uploadLabel input[type="file"] {
82
+ display: none;
83
+ }
84
+
85
+ /* Style for face number inputs */
86
+ #version #scale {
87
+ padding: 8px;
88
+ Width :50px;
89
+ border: 1px solid #ccc;
90
+ border-radius: 4px;
91
+ box-sizing: border-box;
92
+ margin-top: 5px;
93
+ font-size: 16px;
94
+ }
95
+
96
+ /* Style for labels */
97
+ label {
98
+ font-weight: bold;
99
+ }
100
+
101
+ /* Optional: Increase space between elements */
102
+ form > * {
103
+ margin-bottom: 10px;
104
+ }
105
+ /* Style for the swap button */
106
+ button {
107
+ background-image: linear-gradient(
108
+ 45deg,
109
+ hsl(240deg 75% 29%) 0%,
110
+ hsl(254deg 78% 28%) 6%,
111
+ hsl(264deg 82% 27%) 13%,
112
+ hsl(272deg 87% 26%) 19%,
113
+ hsl(278deg 93% 25%) 25%,
114
+ hsl(284deg 98% 24%) 31%,
115
+ hsl(289deg 100% 23%) 37%,
116
+ hsl(294deg 100% 23%) 44%,
117
+ hsl(299deg 100% 22%) 50%,
118
+ hsl(303deg 100% 23%) 56%,
119
+ hsl(307deg 100% 24%) 63%,
120
+ hsl(311deg 100% 25%) 69%,
121
+ hsl(313deg 100% 26%) 75%,
122
+ hsl(316deg 95% 28%) 81%,
123
+ hsl(320deg 88% 30%) 87%,
124
+ hsl(323deg 81% 32%) 94%,
125
+ hsl(326deg 75% 33%) 100%
126
+ );
127
+ border: none;
128
+ color: white;
129
+ padding: 10px 20px;
130
+ text-align: center;
131
+ text-decoration: none;
132
+ display: inline-block;
133
+ font-size: 16px;
134
+ margin-top: 10px;
135
+ cursor: pointer;
136
+ border-radius: 5px;
137
+ display: block;
138
+ margin: 0 auto;
139
+ width: 200px;
140
+ }
141
+
142
+ /* Hover effect for the button */
143
+ button:hover {
144
+ background-color: #45a049;
145
+ }
146
+
147
+ h1 {
148
+ text-align: center;
149
+ margin-bottom: 20px;
150
+ font-family: 'Barlow Condensed';
151
+ color: pink;
152
+ font-size: 40px; /* Adjust the font size as needed */
153
+ }
154
+
155
+ h2 {
156
+ font-size: 24px; /* Adjust size as needed */
157
+ font-family: 'Barlow Condensed';
158
+ color: #FFFFFF; /* Text color */
159
+
160
+ margin-top: 20px; /* Top margin */
161
+ margin-bottom: 10px; /* Bottom margin */
162
+ }
163
+ select {
164
+ width: 150px; /* Adjust width as needed */
165
+ padding: 8px;
166
+ border: 1px solid #ccc;
167
+ border-radius: 4px;
168
+ background-color: #333333; /* Background color */
169
+ color: white; /* Text color */
170
+ font-size: 16px;
171
+ }
172
+ /* Style for the scale number input */
173
+ input[type="number"]#scale {
174
+ padding: 8px;
175
+ width: 50px;
176
+ border: 1px solid #ccc;
177
+ border-radius: 4px;
178
+ box-sizing: border-box;
179
+ margin-top: 5px;
180
+ font-size: 16px;
181
+ color: white; /* Set text color to white */
182
+ background-color: #333333; /* Set background color */
183
+ }
184
+
185
+ /* Optional: Adjust focus styling for the scale number input */
186
+ input[type="number"]#scale:focus {
187
+ outline: none; /* Remove default outline */
188
+ border-color: #1E7E34; /* Change border color on focus */
189
+ }
190
+
191
+ #estimatedTime {
192
+ display: none;
193
+ text-align: center; /* Center align the text */
194
+ margin-top: 10px; /* Add margin to separate it from the spinner */
195
+ color: white; /* Set text color */
196
+ }
197
+
198
+ #resultImage {
199
+ border: 2px solid blue;
200
+ width: 265px;
201
+ height: 300px;
202
+ display: flex;
203
+ flex-direction: column;
204
+ overflow-y: scroll;
205
+ margin: auto;
206
+ margin-top: 30px;
207
+ padding-bottom: 7px;
208
+ gap: 14px;
209
+ background: linear-gradient(black , black) padding-box,
210
+ linear-gradient(to right, red, blue) border-box;
211
+ border-radius: 20px;
212
+ border: 2.5px solid transparent;
213
+ }
214
+
215
+ #sourceImageContainer, #destinationImageContainer {
216
+ border: 2px solid blue;
217
+ width: 200px;
218
+ height: 200px;
219
+ display: flex;
220
+ flex-direction: column;
221
+ overflow-y: scroll;
222
+ margin: auto;
223
+ margin-top: 30px;
224
+ padding-bottom: 7px;
225
+ gap: 100px;
226
+ background: linear-gradient(black , black) padding-box,
227
+ linear-gradient(to right, red, blue) border-box;
228
+ border-radius: 20px;
229
+ border: 2.5px solid transparent;
230
+ }
231
+
232
+ #sourceImage, #destinationImage {
233
  max-width: 100%;
234
  height: auto;
235
+ display: block;
236
+ margin: auto;
237
+ }
238
+
239
+ #loadingSpinner {
240
+ border: 3px solid rgba(255, 255, 255, 0.3);
241
+ border-radius: 50%;
242
+ border-top: 5px solid #ffffff;
243
+ width: 20px;
244
+ height: 20px;
245
+ animation: spin 2s linear infinite;
246
+ position: relative;
247
+ top: 50%;
248
+ left: 50%;
249
+ transform: translate(-50%, -50%);
250
+ display: none; /* Initially hide the loading spinner */
251
+ }
252
+
253
+ @keyframes spin {
254
+ 0% { transform: rotate(0deg); }
255
+ 100% { transform: rotate(360deg); }
256
  }
257
+
258
  </style>
259
  </head>
260
  <body>
261
+ <h1>Aiconvert.online</h1>
262
+ <form id="uploadForm" enctype="multipart/form-data">
263
+ <!-- Label for the file input -->
264
+ <label for="image" class="uploadLabel">Choose image</label>
265
+ <!-- Hidden file input -->
266
+ <input type="file" id="image" name="file" accept="image/*" required onchange="previewImage(event, 'sourceImage')" style="display: none;">
267
+
268
+
269
+ <div id="sourceImageContainer">
270
+ <img id="sourceImage">
271
+ </div>
272
+ <br>
273
+
274
  <label for="version">Select Version:</label>
275
  <select id="version" name="version">
276
  <option value="v1.2">v1.2</option>
277
  <option value="v1.3">v1.3</option>
278
  <option value="v1.4">v1.4</option>
279
  <!-- Add more options as needed -->
280
+ </select>
281
 
282
+ <label for="scale">Scale:</label>
283
+ <input type="number" id="scale" name="scale" min="1" value="2"><br>
284
+
285
+
 
 
286
 
287
  <button type="submit">Enhance Image</button>
288
  </form>
289
 
290
+ <div id="resultImage">
291
+ <div id="loadingSpinner">
292
+ <div id="spinner"></div>
293
+ </div>
294
+ <div id="estimatedTime" style="display: none;">Estimated time: 90s</div>
295
+ </div>
296
+
297
  <div id="resultContainer"></div>
298
+ </div>
299
+
300
+ <!-- Placeholder for the result image -->
301
+ <script>
302
+
303
+
304
+ function previewImage(event, imageId) {
305
+ const fileInput = event.target;
306
+ const file = fileInput.files[0];
307
+ const reader = new FileReader();
308
+
309
+ reader.onload = function(e) {
310
+ const image = document.getElementById(imageId);
311
+ image.src = e.target.result;
312
+ }
313
+
314
+ reader.readAsDataURL(file);
315
+ }
316
 
317
+ document.getElementById('uploadForm').addEventListener('submit', async function(event) {
318
+ event.preventDefault();
319
+ const formData = new FormData(this);
320
+ const fileInput = document.getElementById('image');
321
+
322
+
323
+
324
+ // Show the loading spinner
325
+ const loadingSpinner = document.getElementById('loadingSpinner');
326
+ const spinner = document.getElementById('spinner');
327
+ const estimatedTime = document.getElementById('estimatedTime');
328
+
329
+ loadingSpinner.style.display = 'block';
330
+ spinner.style.display = 'block';
331
+ estimatedTime.style.display = 'block';
332
+
333
+ try {
334
+ const response = await fetch('/upload/', {
335
+ method: 'POST',
336
+ body: formData
337
  });
338
+
339
+ if (response.ok) {
340
+ // If successful response, display the result image
341
+ const blob = await response.blob();
342
+ const imageUrl = URL.createObjectURL(blob);
343
+ resultImage.innerHTML = `<img src="${imageUrl}" alt="Result Image" style="max-width: 100%;">`;
344
+ } else {
345
+ // If server error, display the error message
346
+ const errorMessage = await response.text();
347
+ resultImage.innerHTML = `<p style="color: white;">Oops! Something went wrong. Please try again later.</p>`;
348
+ }
349
+
350
+ // Hide the loading spinner
351
+ loadingSpinner.style.display = 'none';
352
+ } catch (error) {
353
+ console.error('Error:', error);
354
+ }
355
+ });
356
+
357
+ // Add event listener to the "Enhance Image" button
358
+ document.querySelector('button[type="submit"]').addEventListener('click', function(event) {
359
+ const fileInput = document.getElementById('image');
360
+
361
+ // Check if file input is empty
362
+ if (!fileInput.files.length) {
363
+ // Display message in resultImage container
364
+ document.getElementById('resultImage').innerHTML = `<p style="color: white;">Please upload an image.</p>`;
365
+ }
366
+ });
367
+
368
+
369
+ </script>
370
+
371
  </body>
372
  </html>