Ashrafb commited on
Commit
80824b5
·
verified ·
1 Parent(s): 23d0106

Update AB/index.html

Browse files
Files changed (1) hide show
  1. AB/index.html +15 -319
AB/index.html CHANGED
@@ -3,331 +3,27 @@
3
  <head>
4
  <meta charset="UTF-8">
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.13.11/katex.min.css">
7
- <link href="https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@100&display=swap" rel="stylesheet">
8
- <style>
9
- body {
10
- background-color: #121212;
11
- color: #FFFFFF;
12
- }
13
-
14
- /* Dark mode for upload buttons */
15
- .uploadButton {
16
- background-color: #1E7E34;
17
- }
18
-
19
- /* Dark mode for file input labels */
20
- .uploadLabel {
21
- background-color: #BF2C25;
22
- }
23
-
24
- /* Dark mode for face number inputs */
25
- input[type="number"] {
26
- background-color: #333333;
27
- color: #FFFFFF;
28
- border: 1px solid #555555;
29
- }
30
-
31
- /* Dark mode for swap button */
32
- button[type="button"] {
33
- background-color: #1E7E34;
34
- }
35
-
36
- /* Dark mode hover effect for swap button */
37
- button[type="button"]:hover {
38
- background-color: #2E9E44;
39
- }
40
-
41
- /* Style for upload buttons */
42
- input[type="file"] {
43
- display: none; /* Hide the default file input */
44
- }
45
-
46
- .uploadButton {
47
- background-color: #4CAF50;
48
- border: none;
49
- color: white;
50
- padding: 10px 20px;
51
- text-align: center;
52
- text-decoration: none;
53
- display: inline-block;
54
- font-size: 16px;
55
- margin-top: 10px;
56
- cursor: pointer;
57
- border-radius: 5px;
58
- margin: auto;
59
- }
60
-
61
- /* Style for file input labels */
62
- #uploadForm {
63
- display: flex;
64
- flex-direction: column;
65
- align-items: center;
66
- }
67
-
68
- .uploadLabel {
69
- padding: 10px 20px;
70
- background-color: #f44336;
71
- color: white;
72
- border-radius: 5px;
73
- cursor: pointer;
74
- display: inline-block;
75
- }
76
-
77
- .uploadLabel input[type="file"] {
78
- display: none;
79
- }
80
-
81
- /* Style for face number inputs */
82
- input[type="number"] {
83
- padding: 8px;
84
- Width :50px;
85
- border: 1px solid #ccc;
86
- border-radius: 4px;
87
- box-sizing: border-box;
88
- margin-top: 5px;
89
- font-size: 16px;
90
- }
91
-
92
- /* Style for labels */
93
- label {
94
- font-weight: bold;
95
- }
96
-
97
- /* Optional: Increase space between elements */
98
- form > * {
99
- margin-bottom: 10px;
100
- }
101
- /* Style for the swap button */
102
- button[type="button"] {
103
- background-image: linear-gradient(
104
- 45deg,
105
- hsl(240deg 75% 29%) 0%,
106
- hsl(254deg 78% 28%) 6%,
107
- hsl(264deg 82% 27%) 13%,
108
- hsl(272deg 87% 26%) 19%,
109
- hsl(278deg 93% 25%) 25%,
110
- hsl(284deg 98% 24%) 31%,
111
- hsl(289deg 100% 23%) 37%,
112
- hsl(294deg 100% 23%) 44%,
113
- hsl(299deg 100% 22%) 50%,
114
- hsl(303deg 100% 23%) 56%,
115
- hsl(307deg 100% 24%) 63%,
116
- hsl(311deg 100% 25%) 69%,
117
- hsl(313deg 100% 26%) 75%,
118
- hsl(316deg 95% 28%) 81%,
119
- hsl(320deg 88% 30%) 87%,
120
- hsl(323deg 81% 32%) 94%,
121
- hsl(326deg 75% 33%) 100%
122
- );
123
- border: none;
124
- color: white;
125
- padding: 10px 20px;
126
- text-align: center;
127
- text-decoration: none;
128
- display: inline-block;
129
- font-size: 16px;
130
- margin-top: 10px;
131
- cursor: pointer;
132
- border-radius: 5px;
133
- display: block; /* Change display property to block */
134
- margin: 0 auto;
135
- Width :200px;
136
- }
137
-
138
- /* Hover effect for the swap button */
139
- button[type="button"]:hover {
140
- background-color: #45a049;
141
- }
142
- h1 {
143
- text-align: center;
144
- margin-bottom: 20px;
145
- font-family: 'Barlow Condensed';
146
- color: pink;
147
- font-size: 40px; /* Adjust the font size as needed */
148
- }
149
-
150
- h2 {
151
- font-size: 24px; /* Adjust size as needed */
152
- font-family: 'Barlow Condensed';
153
- color: #FFFFFF; /* Text color */
154
-
155
- margin-top: 20px; /* Top margin */
156
- margin-bottom: 10px; /* Bottom margin */
157
- }
158
-
159
-
160
- #resultImage {
161
- border: 2px solid blue;
162
- width: 269px;
163
- height: 300px;
164
- display: flex;
165
- flex-direction: column;
166
- overflow-y: scroll;
167
- margin: auto;
168
- margin-top: 30px;
169
- padding-bottom: 7px;
170
- gap: 14px;
171
- background: linear-gradient(black , black) padding-box,
172
- linear-gradient(to right, red, blue) border-box;
173
- border-radius: 20px;
174
- border: 2.5px solid transparent;
175
- }
176
-
177
- #sourceImageContainer, #destinationImageContainer {
178
- border: 2px solid blue;
179
- width: 200px;
180
- height: 200px;
181
- display: flex;
182
- flex-direction: column;
183
- overflow-y: scroll;
184
- margin: auto;
185
- margin-top: 30px;
186
- padding-bottom: 7px;
187
- gap: 100px;
188
- background: linear-gradient(black , black) padding-box,
189
- linear-gradient(to right, red, blue) border-box;
190
- border-radius: 20px;
191
- border: 2.5px solid transparent;
192
- }
193
-
194
- #sourceImage, #destinationImage {
195
- max-width: 100%;
196
- height: auto;
197
- display: block;
198
- margin: auto;
199
- }
200
-
201
- #loadingSpinner {
202
- border: 3px solid rgba(255, 255, 255, 0.3);
203
- border-radius: 50%;
204
- border-top: 3px solid #ffffff;
205
- width: 20px;
206
- height: 20px;
207
- animation: spin 2s linear infinite;
208
- position: relative;
209
- top: 50%;
210
- left: 50%;
211
- transform: translate(-50%, -50%);
212
- display: none; /* Initially hide the loading spinner */
213
- }
214
-
215
- @keyframes spin {
216
- 0% { transform: rotate(0deg); }
217
- 100% { transform: rotate(360deg); }
218
- }
219
- </style>
220
  </head>
221
  <body>
222
- <h1>Aiconvert.online </h1>
223
- <form id="uploadForm" action="/upload/" method="post" enctype="multipart/form-data">
224
- <label for="sourceFile" class="uploadLabel">Choose image </label>
225
- <input type="file" id="sourceFile" name="source_file" accept="image/*" required onchange="previewImage(event, 'sourceImage')"><br>
226
- <div id="sourceImageContainer">
227
- <img id="sourceImage">
228
- </div><br>
229
- <button type="button" onclick="uploadFile()">Generate </button> <!-- Changed to type="button" and added onclick handler -->
230
- </form>
231
- <div id="resultImage">
232
- <div id="estimatedTime" style="display: none;">Estimated time: 120s</div>
233
- <div id="loadingSpinner" style="display: none;">
234
- <!-- Replace this with your loading spinner HTML/CSS -->
235
- </div>
236
- <div id="resultContainer">
237
-
238
-
239
-
240
-
241
- <a id="download-link" href="#" download="colorized_image.jpg" style="display:none;">Download Colorized Image</a>
242
- </div>
243
- </div>
244
- <script>
245
- function previewImage(event, imageId) {
246
- const fileInput = event.target;
247
- const file = fileInput.files[0];
248
- const reader = new FileReader();
249
-
250
- reader.onload = function(e) {
251
- const image = document.getElementById(imageId);
252
- image.src = e.target.result;
253
- }
254
-
255
- reader.readAsDataURL(file);
256
- }
257
-
258
-
259
- function displayColorizedImage(blob) {
260
- const url = URL.createObjectURL(blob);
261
- const resultContainer = document.getElementById('resultContainer');
262
- resultContainer.innerHTML = `<img src="${url}" alt="Colorized Image" width="400">`;
263
- const downloadLink = document.getElementById('download-link');
264
- downloadLink.href = url;
265
- downloadLink.style.display = 'block';
266
- }
267
 
268
-
269
-
270
- async function uploadFile() {
271
- const sourceFileInput = document.getElementById('sourceFile');
272
- const resultContainer = document.getElementById('resultContainer');
273
-
274
-
275
-
276
- // Check if both source and destination file inputs are empty
277
- if (!sourceFileInput.files[0] ) {
278
- // Update the result container with the error message
279
- resultContainer.innerHTML = "<p>Please upload an image.</p>";
280
- return;
281
- }
282
 
283
- // Clear the result container if both images are uploaded
284
- resultContainer.innerHTML = "";
285
 
286
- const formData = new FormData();
287
- const fileInput = document.querySelector('input[type="file"]');
288
- formData.append('file', fileInput.files[0]);
289
-
290
- try {
291
- // Display loading spinner
292
- const loadingSpinner = document.getElementById('loadingSpinner');
293
- loadingSpinner.style.display = 'block';
294
- const estimatedTime = document.getElementById('estimatedTime');
295
- estimatedTime.style.display = 'block';
296
 
297
- const response = await fetch('/upload/', {
298
- method: 'POST',
299
- body: formData
300
- });
301
- if (response.ok) {
302
- // If successful response, display the result image
303
- const blob = await response.blob();
304
-
305
- displayColorizedImage(blob);
306
 
307
-
308
- } else {
309
- // If server error, display the error message
310
- const errorMessage = await response.text();
311
- resultContainer.innerHTML = `<p>Oops! Something went wrong. Please try again later. </p>`;
312
- }
313
- // Hide loading spinner after result (or error message) is displayed
314
- loadingSpinner.style.display = 'none';
315
- estimatedTime.style.display = 'none';
316
- } catch (error) {
317
- console.error('Error swapping faces:', error);
318
- // Hide loading spinner if there's an error
319
- const loadingSpinner = document.getElementById('loadingSpinner');
320
- loadingSpinner.style.display = 'none';
321
- estimatedTime.style.display = 'none';
322
- }
323
- }
324
-
325
-
326
-
327
-
328
-
329
-
330
-
331
- </script>
332
  </body>
333
  </html>
 
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 action="/upload/" method="post" enctype="multipart/form-data">
11
+ <label for="file">Select Image:</label><br>
12
+ <input type="file" id="file" name="file" accept="image/*" required><br><br>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
 
14
+ <label for="top">Top:</label><br>
15
+ <input type="number" id="top" name="top" value="200" required><br><br>
 
 
 
 
 
 
 
 
 
 
 
 
16
 
17
+ <label for="bottom">Bottom:</label><br>
18
+ <input type="number" id="bottom" name="bottom" value="200" required><br><br>
19
 
20
+ <label for="left">Left:</label><br>
21
+ <input type="number" id="left" name="left" value="200" required><br><br>
 
 
 
 
 
 
 
 
22
 
23
+ <label for="right">Right:</label><br>
24
+ <input type="number" id="right" name="right" value="200" required><br><br>
 
 
 
 
 
 
 
25
 
26
+ <button type="submit">Upload and Process Image</button>
27
+ </form>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
28
  </body>
29
  </html>