DAOUED31 commited on
Commit
5781a3a
·
verified ·
1 Parent(s): ebb1239

Add 2 files

Browse files
Files changed (2) hide show
  1. index.html +675 -38
  2. prompts.txt +4 -0
index.html CHANGED
@@ -1,41 +1,678 @@
1
  <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>My app</title>
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
- <meta charset="utf-8">
 
 
 
7
  <style>
8
- body {
9
- display: flex;
10
- justify-content: center;
11
- align-items: center;
12
- overflow: hidden;
13
- height: 100dvh;
14
- font-family: "Arial", sans-serif;
15
- text-align: center;
16
- }
17
- .arrow {
18
- position: absolute;
19
- bottom: 32px;
20
- left: 0px;
21
- width: 100px;
22
- transform: rotate(30deg);
23
- }
24
- h1 {
25
- font-size: 50px;
26
- }
27
- h1 span {
28
- color: #acacac;
29
- font-size: 32px;
30
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
  </style>
32
- </head>
33
- <body>
34
- <h1>
35
- <span>I'm ready to work,</span><br />
36
- Ask me anything.
37
- </h1>
38
- <img src="https://enzostvs-deepsite.hf.space/arrow.svg" class="arrow" />
39
- <script></script>
40
- <p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=DAOUED31/nobg-ai" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
41
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  <!DOCTYPE html>
2
+ <html lang="en" class="light">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>NoBG.AI - Remove Background from Images Instantly</title>
7
+ <script src="https://cdn.tailwindcss.com"></script>
8
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
9
+ <link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap" rel="stylesheet">
10
  <style>
11
+ body {
12
+ font-family: 'Poppins', sans-serif;
13
+ transition: background-color 0.3s, color 0.3s;
14
+ background: linear-gradient(135deg, #f9fafb 0%, #f3f4f6 100%);
15
+ }
16
+
17
+ .dark body {
18
+ background: linear-gradient(135deg, #111827 0%, #1f2937 100%);
19
+ }
20
+
21
+ .upload-area {
22
+ border: 2px dashed #d1d5db;
23
+ transition: all 0.3s;
24
+ background-color: rgba(255, 255, 255, 0.8);
25
+ }
26
+
27
+ .dark .upload-area {
28
+ background-color: rgba(31, 41, 55, 0.8);
29
+ }
30
+
31
+ .upload-area:hover {
32
+ border-color: #3b82f6;
33
+ box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
34
+ }
35
+
36
+ .upload-area.dragover {
37
+ border-color: #3b82f6;
38
+ background-color: rgba(59, 130, 246, 0.05);
39
+ }
40
+
41
+ .btn-primary {
42
+ background-color: #3b82f6;
43
+ transition: all 0.2s;
44
+ }
45
+
46
+ .btn-primary:hover {
47
+ background-color: #2563eb;
48
+ transform: translateY(-1px);
49
+ box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
50
+ }
51
+
52
+ .btn-secondary {
53
+ background-color: #f3f4f6;
54
+ transition: all 0.2s;
55
+ }
56
+
57
+ .btn-secondary:hover {
58
+ background-color: #e5e7eb;
59
+ }
60
+
61
+ .dark .btn-secondary {
62
+ background-color: #374151;
63
+ color: white;
64
+ }
65
+
66
+ .dark .btn-secondary:hover {
67
+ background-color: #4b5563;
68
+ }
69
+
70
+ .theme-toggle {
71
+ transition: all 0.3s;
72
+ }
73
+
74
+ .theme-toggle:hover {
75
+ transform: rotate(15deg) scale(1.1);
76
+ }
77
+
78
+ .image-comparison {
79
+ position: relative;
80
+ width: 100%;
81
+ overflow: hidden;
82
+ }
83
+
84
+ .image-comparison img {
85
+ width: 100%;
86
+ height: auto;
87
+ display: block;
88
+ }
89
+
90
+ .image-comparison .before {
91
+ position: absolute;
92
+ top: 0;
93
+ left: 0;
94
+ width: 50%;
95
+ height: 100%;
96
+ overflow: hidden;
97
+ }
98
+
99
+ .comparison-slider {
100
+ position: absolute;
101
+ top: 0;
102
+ left: 50%;
103
+ width: 4px;
104
+ height: 100%;
105
+ background-color: white;
106
+ cursor: ew-resize;
107
+ z-index: 10;
108
+ }
109
+
110
+ .comparison-slider::before {
111
+ content: "";
112
+ position: absolute;
113
+ top: 50%;
114
+ left: 50%;
115
+ width: 40px;
116
+ height: 40px;
117
+ border-radius: 50%;
118
+ background-color: white;
119
+ transform: translate(-50%, -50%);
120
+ box-shadow: 0 0 0 2px #3b82f6;
121
+ }
122
+
123
+ .fade-in {
124
+ animation: fadeIn 0.3s ease-in-out;
125
+ }
126
+
127
+ @keyframes fadeIn {
128
+ from { opacity: 0; transform: translateY(10px); }
129
+ to { opacity: 1; transform: translateY(0); }
130
+ }
131
+
132
+ .processing-animation {
133
+ animation: pulse 1.5s infinite;
134
+ }
135
+
136
+ @keyframes pulse {
137
+ 0% { opacity: 0.6; }
138
+ 50% { opacity: 1; }
139
+ 100% { opacity: 0.6; }
140
+ }
141
+
142
+ .error-message {
143
+ color: #ef4444;
144
+ background-color: #fee2e2;
145
+ padding: 0.5rem 1rem;
146
+ border-radius: 0.375rem;
147
+ margin-top: 1rem;
148
+ }
149
+
150
+ .dark .error-message {
151
+ background-color: #450a0a;
152
+ }
153
+
154
+ .glass-effect {
155
+ backdrop-filter: blur(12px);
156
+ -webkit-backdrop-filter: blur(12px);
157
+ background-color: rgba(255, 255, 255, 0.8);
158
+ }
159
+
160
+ .dark .glass-effect {
161
+ background-color: rgba(17, 24, 39, 0.8);
162
+ }
163
  </style>
164
+ </head>
165
+ <body class="min-h-screen">
166
+ <!-- Header -->
167
+ <header class="sticky top-0 z-50 glass-effect shadow-sm">
168
+ <div class="container mx-auto px-4 py-4 flex justify-between items-center">
169
+ <div class="flex items-center space-x-2">
170
+ <div class="w-8 h-8 bg-blue-500 rounded-md flex items-center justify-center text-white font-bold">NB</div>
171
+ <h1 class="text-xl font-bold">NoBG<span class="text-blue-500">.AI</span></h1>
172
+ </div>
173
+
174
+ <nav class="hidden md:flex space-x-6">
175
+ <a href="#" class="font-medium hover:text-blue-500">Remove Background</a>
176
+ <a href="#" class="font-medium hover:text-blue-500">Photo Editing</a>
177
+ <a href="#" class="font-medium hover:text-blue-500">Tools & API</a>
178
+ <a href="#" class="font-medium hover:text-blue-500">How To Use</a>
179
+ <a href="#" class="font-medium hover:text-blue-500">Pricing</a>
180
+ </nav>
181
+
182
+ <div class="flex items-center space-x-4">
183
+ <button class="px-4 py-2 rounded-md font-medium hover:bg-gray-100 dark:hover:bg-gray-800">Login</button>
184
+ <button class="px-4 py-2 bg-blue-500 text-white rounded-md font-medium hover:bg-blue-600">Sign Up</button>
185
+ </div>
186
+
187
+ <button class="md:hidden text-gray-600 dark:text-gray-300">
188
+ <i class="fas fa-bars text-xl"></i>
189
+ </button>
190
+ </div>
191
+ </header>
192
+
193
+ <!-- Main Content -->
194
+ <main class="container mx-auto px-4 py-8 md:py-12">
195
+ <!-- Hero Section -->
196
+ <section class="max-w-4xl mx-auto text-center mb-12">
197
+ <h1 class="text-4xl md:text-5xl font-bold mb-4">Remove Background from Images</h1>
198
+ <p class="text-lg text-gray-600 dark:text-gray-300 mb-8">Get transparent backgrounds instantly with our AI-powered tool. No registration required.</p>
199
+
200
+ <!-- Upload Box -->
201
+ <div id="upload-container" class="upload-area rounded-xl p-8 md:p-12 mb-6 shadow-md">
202
+ <div id="upload-content" class="flex flex-col items-center justify-center">
203
+ <i class="fas fa-cloud-upload-alt text-4xl text-blue-500 mb-4"></i>
204
+ <h3 class="text-xl font-medium mb-2">Upload Your Image</h3>
205
+ <p class="text-gray-500 dark:text-gray-400 mb-6">Supported formats: JPG, PNG, or WebP (up to 10MB)</p>
206
+ <button id="upload-btn" class="btn-primary px-6 py-3 rounded-md text-white font-medium mb-2">
207
+ <i class="fas fa-upload mr-2"></i> Select an Image
208
+ </button>
209
+ <p class="text-sm text-gray-500 dark:text-gray-400">Or drag & drop, paste with Ctrl+V</p>
210
+ <input type="file" id="file-input" accept="image/*" class="hidden">
211
+ </div>
212
+
213
+ <div id="processing-container" class="hidden flex-col items-center justify-center">
214
+ <div class="w-16 h-16 rounded-full bg-blue-100 dark:bg-blue-900 flex items-center justify-center mb-4 processing-animation">
215
+ <i class="fas fa-magic text-blue-500 text-2xl"></i>
216
+ </div>
217
+ <h3 class="text-xl font-medium mb-2">Processing your image...</h3>
218
+ <p class="text-gray-500 dark:text-gray-400 mb-4">Our AI is removing the background automatically</p>
219
+ <div id="progress-bar" class="w-full bg-gray-200 rounded-full h-2.5 dark:bg-gray-700 mb-4">
220
+ <div class="bg-blue-600 h-2.5 rounded-full" style="width: 0%"></div>
221
+ </div>
222
+ <button id="cancel-btn" class="px-4 py-2 rounded-md font-medium bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600">
223
+ Cancel
224
+ </button>
225
+ </div>
226
+
227
+ <div id="result-container" class="hidden flex-col items-center justify-center">
228
+ <div class="w-full mb-6">
229
+ <div class="image-comparison rounded-lg overflow-hidden shadow-lg">
230
+ <img id="result-image" src="" alt="Result with transparent background" class="w-full">
231
+ <div class="before">
232
+ <img id="original-image" src="" alt="Original image" class="w-full">
233
+ </div>
234
+ <div class="comparison-slider"></div>
235
+ </div>
236
+ </div>
237
+
238
+ <div class="flex flex-wrap justify-center gap-4 mb-6">
239
+ <button id="download-btn" class="btn-primary px-6 py-3 rounded-md text-white font-medium">
240
+ <i class="fas fa-download mr-2"></i> Download PNG
241
+ </button>
242
+ <button id="new-project-btn" class="btn-secondary px-6 py-3 rounded-md font-medium">
243
+ <i class="fas fa-redo mr-2"></i> Process Another
244
+ </button>
245
+ </div>
246
+ </div>
247
+
248
+ <div id="error-container" class="hidden">
249
+ <div class="error-message">
250
+ <i class="fas fa-exclamation-circle mr-2"></i>
251
+ <span id="error-text"></span>
252
+ </div>
253
+ </div>
254
+ </div>
255
+
256
+ <!-- Quick Test Section -->
257
+ <div class="mt-8">
258
+ <p class="text-gray-600 dark:text-gray-300 mb-4">Try with our sample images:</p>
259
+ <div class="flex justify-center gap-4">
260
+ <img src="https://images.unsplash.com/photo-1523275335684-37898b6baf30?w=200" alt="Sample watch" class="w-16 h-16 md:w-20 md:h-20 rounded-md cursor-pointer hover:opacity-80 transition" data-sample="watch">
261
+ <img src="https://images.unsplash.com/photo-1491553895911-0055eca6402d?w=200" alt="Sample shoes" class="w-16 h-16 md:w-20 md:h-20 rounded-md cursor-pointer hover:opacity-80 transition" data-sample="shoes">
262
+ <img src="https://images.unsplash.com/photo-1572635196237-14b3f281503f?w=200" alt="Sample sunglasses" class="w-16 h-16 md:w-20 md:h-20 rounded-md cursor-pointer hover:opacity-80 transition" data-sample="sunglasses">
263
+ <img src="https://images.unsplash.com/photo-1529626455594-4ff0802cfb7e?w=200" alt="Sample portrait" class="w-16 h-16 md:w-20 md:h-20 rounded-md cursor-pointer hover:opacity-80 transition" data-sample="portrait">
264
+ </div>
265
+ </div>
266
+ </section>
267
+
268
+ <!-- Features Section -->
269
+ <section class="max-w-6xl mx-auto px-4 py-12 grid grid-cols-1 md:grid-cols-3 gap-8">
270
+ <div class="bg-white dark:bg-gray-800 p-6 rounded-xl shadow-sm">
271
+ <div class="w-12 h-12 bg-blue-100 dark:bg-blue-900 rounded-full flex items-center justify-center mb-4">
272
+ <i class="fas fa-bolt text-blue-500"></i>
273
+ </div>
274
+ <h3 class="text-xl font-bold mb-2">Instant Processing</h3>
275
+ <p class="text-gray-600 dark:text-gray-300">Get results in seconds with our powerful AI technology. No waiting in queues.</p>
276
+ </div>
277
+
278
+ <div class="bg-white dark:bg-gray-800 p-6 rounded-xl shadow-sm">
279
+ <div class="w-12 h-12 bg-blue-100 dark:bg-blue-900 rounded-full flex items-center justify-center mb-4">
280
+ <i class="fas fa-lock-open text-blue-500"></i>
281
+ </div>
282
+ <h3 class="text-xl font-bold mb-2">No Registration</h3>
283
+ <p class="text-gray-600 dark:text-gray-300">Use our tool without creating an account. Your privacy matters to us.</p>
284
+ </div>
285
+
286
+ <div class="bg-white dark:bg-gray-800 p-6 rounded-xl shadow-sm">
287
+ <div class="w-12 h-12 bg-blue-100 dark:bg-blue-900 rounded-full flex items-center justify-center mb-4">
288
+ <i class="fas fa-shield-alt text-blue-500"></i>
289
+ </div>
290
+ <h3 class="text-xl font-bold mb-2">Secure Processing</h3>
291
+ <p class="text-gray-600 dark:text-gray-300">Your images are processed securely and deleted automatically after 24 hours.</p>
292
+ </div>
293
+ </section>
294
+ </main>
295
+
296
+ <!-- Footer -->
297
+ <footer class="bg-white dark:bg-gray-800 border-t border-gray-200 dark:border-gray-700 py-8">
298
+ <div class="container mx-auto px-4">
299
+ <div class="flex flex-col md:flex-row justify-between items-center">
300
+ <div class="flex items-center space-x-2 mb-4 md:mb-0">
301
+ <div class="w-8 h-8 bg-blue-500 rounded-md flex items-center justify-center text-white font-bold">NB</div>
302
+ <h2 class="text-xl font-bold">NoBG<span class="text-blue-500">.AI</span></h2>
303
+ </div>
304
+
305
+ <div class="flex space-x-6">
306
+ <a href="#" class="text-gray-600 dark:text-gray-300 hover:text-blue-500">Privacy Policy</a>
307
+ <a href="#" class="text-gray-600 dark:text-gray-300 hover:text-blue-500">Terms of Service</a>
308
+ <a href="#" class="text-gray-600 dark:text-gray-300 hover:text-blue-500">Contact Us</a>
309
+ </div>
310
+ </div>
311
+
312
+ <div class="mt-8 text-center text-gray-500 dark:text-gray-400 text-sm">
313
+ <p>© 2023 NoBG.AI. All rights reserved.</p>
314
+ </div>
315
+ </div>
316
+ </footer>
317
+
318
+ <!-- Theme Toggle -->
319
+ <button id="theme-toggle" class="fixed bottom-6 right-6 w-12 h-12 rounded-full bg-white dark:bg-gray-800 shadow-lg flex items-center justify-center theme-toggle">
320
+ <i class="fas fa-sun text-yellow-400 dark:hidden"></i>
321
+ <i class="fas fa-moon text-gray-300 hidden dark:block"></i>
322
+ </button>
323
+
324
+ <script>
325
+ // DOM Elements
326
+ const uploadContainer = document.getElementById('upload-container');
327
+ const uploadContent = document.getElementById('upload-content');
328
+ const processingContainer = document.getElementById('processing-container');
329
+ const resultContainer = document.getElementById('result-container');
330
+ const errorContainer = document.getElementById('error-container');
331
+ const errorText = document.getElementById('error-text');
332
+ const uploadBtn = document.getElementById('upload-btn');
333
+ const fileInput = document.getElementById('file-input');
334
+ const cancelBtn = document.getElementById('cancel-btn');
335
+ const downloadBtn = document.getElementById('download-btn');
336
+ const newProjectBtn = document.getElementById('new-project-btn');
337
+ const originalImage = document.getElementById('original-image');
338
+ const resultImage = document.getElementById('result-image');
339
+ const progressBar = document.querySelector('#progress-bar div');
340
+ const themeToggle = document.getElementById('theme-toggle');
341
+ const sampleImages = document.querySelectorAll('[data-sample]');
342
+
343
+ // API Key
344
+ const API_KEY = "CHLEvtuxaKf9d72Jqerc3ExQ";
345
+
346
+ // Variables
347
+ let currentFile = null;
348
+ let processedImageUrl = null;
349
+ let apiRequest = null;
350
+ let controller = null;
351
+
352
+ // Event Listeners
353
+ uploadBtn.addEventListener('click', () => fileInput.click());
354
+ fileInput.addEventListener('change', handleFileSelect);
355
+ cancelBtn.addEventListener('click', cancelProcessing);
356
+ downloadBtn.addEventListener('click', downloadImage);
357
+ newProjectBtn.addEventListener('click', resetUpload);
358
+ themeToggle.addEventListener('click', toggleTheme);
359
+
360
+ // Drag and drop events
361
+ uploadContainer.addEventListener('dragover', handleDragOver);
362
+ uploadContainer.addEventListener('dragleave', handleDragLeave);
363
+ uploadContainer.addEventListener('drop', handleDrop);
364
+
365
+ // Paste event
366
+ document.addEventListener('paste', handlePaste);
367
+
368
+ // Sample images
369
+ sampleImages.forEach(img => {
370
+ img.addEventListener('click', () => useSampleImage(img.dataset.sample));
371
+ });
372
+
373
+ // Initialize image comparison slider
374
+ initImageComparison();
375
+
376
+ // Functions
377
+ function handleFileSelect(e) {
378
+ const file = e.target.files[0];
379
+ if (file && file.type.match('image.*')) {
380
+ if (file.size > 10 * 1024 * 1024) {
381
+ showError("File size exceeds 10MB limit");
382
+ return;
383
+ }
384
+ processImage(file);
385
+ }
386
+ }
387
+
388
+ function handleDragOver(e) {
389
+ e.preventDefault();
390
+ e.stopPropagation();
391
+ uploadContainer.classList.add('dragover');
392
+ }
393
+
394
+ function handleDragLeave(e) {
395
+ e.preventDefault();
396
+ e.stopPropagation();
397
+ uploadContainer.classList.remove('dragover');
398
+ }
399
+
400
+ function handleDrop(e) {
401
+ e.preventDefault();
402
+ e.stopPropagation();
403
+ uploadContainer.classList.remove('dragover');
404
+
405
+ const file = e.dataTransfer.files[0];
406
+ if (file && file.type.match('image.*')) {
407
+ if (file.size > 10 * 1024 * 1024) {
408
+ showError("File size exceeds 10MB limit");
409
+ return;
410
+ }
411
+ processImage(file);
412
+ }
413
+ }
414
+
415
+ function handlePaste(e) {
416
+ const items = e.clipboardData.items;
417
+ for (let i = 0; i < items.length; i++) {
418
+ if (items[i].type.indexOf('image') !== -1) {
419
+ const blob = items[i].getAsFile();
420
+ if (blob.size > 10 * 1024 * 1024) {
421
+ showError("File size exceeds 10MB limit");
422
+ return;
423
+ }
424
+ processImage(blob);
425
+ break;
426
+ }
427
+ }
428
+ }
429
+
430
+ function useSampleImage(sample) {
431
+ let sampleUrl = '';
432
+ switch(sample) {
433
+ case 'watch':
434
+ sampleUrl = 'https://images.unsplash.com/photo-1523275335684-37898b6baf30';
435
+ break;
436
+ case 'shoes':
437
+ sampleUrl = 'https://images.unsplash.com/photo-1491553895911-0055eca6402d';
438
+ break;
439
+ case 'sunglasses':
440
+ sampleUrl = 'https://images.unsplash.com/photo-1572635196237-14b3f281503f';
441
+ break;
442
+ case 'portrait':
443
+ sampleUrl = 'https://images.unsplash.com/photo-1529626455594-4ff0802cfb7e';
444
+ break;
445
+ }
446
+
447
+ // Show processing state
448
+ uploadContent.classList.add('hidden');
449
+ processingContainer.classList.remove('hidden');
450
+ errorContainer.classList.add('hidden');
451
+
452
+ // Create a promise to call the real API
453
+ controller = new AbortController();
454
+ const signal = controller.signal;
455
+
456
+ // First fetch the sample image
457
+ fetch(sampleUrl + '?w=800&h=800&fit=crop')
458
+ .then(response => response.blob())
459
+ .then(blob => {
460
+ // Set original image preview
461
+ const url = URL.createObjectURL(blob);
462
+ originalImage.src = url;
463
+
464
+ // Create FormData for API
465
+ const formData = new FormData();
466
+ formData.append('image_file', blob, 'sample.jpg');
467
+
468
+ // Call remove.bg API
469
+ return fetch('https://api.remove.bg/v1.0/removebg', {
470
+ method: 'POST',
471
+ headers: {
472
+ 'X-Api-Key': API_KEY
473
+ },
474
+ body: formData,
475
+ signal: signal
476
+ });
477
+ })
478
+ .then(response => {
479
+ if (!response.ok) {
480
+ throw new Error('API request failed');
481
+ }
482
+ return response.blob();
483
+ })
484
+ .then(blob => {
485
+ const url = URL.createObjectURL(blob);
486
+ resultImage.src = url;
487
+ processedImageUrl = url;
488
+
489
+ // Show result
490
+ processingContainer.classList.add('hidden');
491
+ resultContainer.classList.remove('hidden');
492
+ })
493
+ .catch(err => {
494
+ if (err.name === 'AbortError') {
495
+ console.log('Request was aborted');
496
+ return;
497
+ }
498
+ showError("Failed to process image. Please try again.");
499
+ resetUpload();
500
+ });
501
+ }
502
+
503
+ function processImage(file) {
504
+ currentFile = file;
505
+
506
+ // Show processing state
507
+ uploadContent.classList.add('hidden');
508
+ processingContainer.classList.remove('hidden');
509
+ errorContainer.classList.add('hidden');
510
+ progressBar.style.width = '0%';
511
+
512
+ // Create preview of original image
513
+ const reader = new FileReader();
514
+ reader.onload = function(e) {
515
+ originalImage.src = e.target.result;
516
+
517
+ // Create FormData for API
518
+ const formData = new FormData();
519
+ formData.append('image_file', file);
520
+
521
+ // Create AbortController for cancelling
522
+ controller = new AbortController();
523
+ const signal = controller.signal;
524
+
525
+ // Call remove.bg API
526
+ fetch('https://api.remove.bg/v1.0/removebg', {
527
+ method: 'POST',
528
+ headers: {
529
+ 'X-Api-Key': API_KEY
530
+ },
531
+ body: formData,
532
+ signal: signal
533
+ })
534
+ .then(response => {
535
+ if (!response.ok) {
536
+ throw new Error('API request failed');
537
+ }
538
+ return response.blob();
539
+ })
540
+ .then(blob => {
541
+ const url = URL.createObjectURL(blob);
542
+ resultImage.src = url;
543
+ processedImageUrl = url;
544
+
545
+ // Show result
546
+ processingContainer.classList.add('hidden');
547
+ resultContainer.classList.remove('hidden');
548
+ })
549
+ .catch(err => {
550
+ if (err.name === 'AbortError') {
551
+ console.log('Request was aborted');
552
+ return;
553
+ }
554
+ showError("Failed to process image. Please try again.");
555
+ resetUpload();
556
+ });
557
+
558
+ // Simulate progress (API doesn't provide progress events)
559
+ let progress = 0;
560
+ const progressInterval = setInterval(() => {
561
+ progress += Math.random() * 10;
562
+ if (progress > 90) {
563
+ clearInterval(progressInterval);
564
+ return;
565
+ }
566
+ progressBar.style.width = `${progress}%`;
567
+ }, 300);
568
+ };
569
+ reader.readAsDataURL(file);
570
+ }
571
+
572
+ function cancelProcessing() {
573
+ // Cancel the API request if it exists
574
+ if (controller) {
575
+ controller.abort();
576
+ controller = null;
577
+ }
578
+
579
+ // Reset to upload state
580
+ resetUpload();
581
+ }
582
+
583
+ function resetUpload() {
584
+ // Reset all states
585
+ uploadContent.classList.remove('hidden');
586
+ processingContainer.classList.add('hidden');
587
+ resultContainer.classList.add('hidden');
588
+ errorContainer.classList.add('hidden');
589
+
590
+ // Reset file input
591
+ fileInput.value = '';
592
+ currentFile = null;
593
+ processedImageUrl = null;
594
+ controller = null;
595
+ }
596
+
597
+ function downloadImage() {
598
+ if (!processedImageUrl) return;
599
+
600
+ const link = document.createElement('a');
601
+ link.href = processedImageUrl;
602
+ link.download = 'nobg-ai-' + (currentFile?.name || 'image') + '.png';
603
+ document.body.appendChild(link);
604
+ link.click();
605
+ document.body.removeChild(link);
606
+ }
607
+
608
+ function showError(message) {
609
+ errorText.textContent = message;
610
+ errorContainer.classList.remove('hidden');
611
+ }
612
+
613
+ function toggleTheme() {
614
+ const html = document.documentElement;
615
+ if (html.classList.contains('dark')) {
616
+ html.classList.remove('dark');
617
+ localStorage.setItem('theme', 'light');
618
+ } else {
619
+ html.classList.add('dark');
620
+ localStorage.setItem('theme', 'dark');
621
+ }
622
+ }
623
+
624
+ function initImageComparison() {
625
+ const slider = document.querySelector('.comparison-slider');
626
+ const before = document.querySelector('.before');
627
+ let isDragging = false;
628
+
629
+ slider.addEventListener('mousedown', () => {
630
+ isDragging = true;
631
+ });
632
+
633
+ document.addEventListener('mouseup', () => {
634
+ isDragging = false;
635
+ });
636
+
637
+ document.addEventListener('mousemove', (e) => {
638
+ if (!isDragging) return;
639
+
640
+ const containerRect = uploadContainer.getBoundingClientRect();
641
+ const x = e.clientX - containerRect.left;
642
+ const percent = Math.min(Math.max(0, x / containerRect.width), 1) * 100;
643
+
644
+ before.style.width = `${percent}%`;
645
+ slider.style.left = `${percent}%`;
646
+ });
647
+
648
+ // Touch support
649
+ slider.addEventListener('touchstart', () => {
650
+ isDragging = true;
651
+ });
652
+
653
+ document.addEventListener('touchend', () => {
654
+ isDragging = false;
655
+ });
656
+
657
+ document.addEventListener('touchmove', (e) => {
658
+ if (!isDragging) return;
659
+
660
+ const containerRect = uploadContainer.getBoundingClientRect();
661
+ const x = e.touches[0].clientX - containerRect.left;
662
+ const percent = Math.min(Math.max(0, x / containerRect.width), 1) * 100;
663
+
664
+ before.style.width = `${percent}%`;
665
+ slider.style.left = `${percent}%`;
666
+ });
667
+ }
668
+
669
+ // Check for saved theme preference
670
+ if (localStorage.getItem('theme') === 'dark' ||
671
+ (!localStorage.getItem('theme') && window.matchMedia('(prefers-color-scheme: dark)').matches)) {
672
+ document.documentElement.classList.add('dark');
673
+ } else {
674
+ document.documentElement.classList.remove('dark');
675
+ }
676
+ </script>
677
+ <p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=DAOUED31/nobg-ai" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
678
+ </html>
prompts.txt CHANGED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ Act like a senior UI/UX designer and front-end developer who specializes in modern web apps using HTML, CSS, JavaScript, and Tailwind CSS. You’ve built over 50 SaaS applications with a focus on clean user interfaces and instant interaction. Your task is to build the front-end layout for an AI-powered web app named NoBG.AI. This app allows users to upload any image, remove its background instantly with one click, and then download the transparent image. Objective: Build a fully responsive, modern, and minimal user interface for the NoBG.AI background remover app. Focus on simplicity, elegance, and fast user experience. Include the following components: ________________________________________ Step-by-step Features to Include: 1. Header o App name: NoBG.AI o Navigation menu: Remove Background, Photo Editing Services, Tools & API, How To Use, Pricing, Login, Sign Up 2. Hero Section o Big bold title: “AI Background Remover” o Subtext: “Remove background from image instantly, fully automated and FREE.” o Upload Box with drag & drop enabled. Also support copy-paste image upload (Ctrl + V). o Button label: Upload Your Image o Below upload box, write: “Or drop an image, paste image with Ctrl + V” 3. After Upload o Show an interactive "Remove Background" button o After clicking it, display the "before and after" image in a side-by-side layout with a knowledge scale (labeled “Before removing background” / “After removing background”). o Provide a Download Image button that downloads the image with a transparent background 4. Quick Test Section o Show 4 mini sample images in small square thumbnails below the upload box o Label: “No image? Try one of these to test instantly” o Clicking one loads the sample into the workspace 5. Dark/Light Mode Toggle o Add a floating animated toggle icon (like a sun/moon animation) in the bottom-right corner o Allows switching between light and dark theme of the app in real-time 6. Encouraging Description Text o Below the hero section, include this motivating message: “Tired of messy backgrounds? Try NoBG.AI and remove them in seconds. No login required, just upload and click! Perfect for product shots, profile pictures, and marketing designs.” 7. Styling Suggestions o Use clean sans-serif fonts (e.g., Inter or Poppins) o Buttons should have subtle hover transitions o Use white background with soft shadows, and support dark mode with dark gray tones o Upload area should have dashed borders with a light blue glow effect on hover o Animate the “Remove Background” button on hover for feedback 8. Tech Stack o HTML, TailwindCSS for layout and responsiveness o Vanilla JavaScript or React for interactions (you choose) o Ensure accessibility: proper alt tags, focus states, and ARIA labels Take a deep breath and work on this problem step-by-step. Activate the application when I drag or upload the image to the application, a button appears to remove the background, and when I click on it, it automatically removes the background professionally Add the download button after i delete the background and reduce the size of the images below. Make them smaller than this. Add a button called remove background after I upload the image to the application, and also a download button after I delete the background. When I click on the upload image button, it transfers me to my device to upload my image, work on it, and remove its background. Add this key to make the application interactive and remove the background CHLEvtuxaKf9d72Jqerc3ExQ " Also make a button to cancel the process and start again or start a new project
2
+ Add this key to make the application interactive and remove the backgroundCHLEvtuxaKf9d72Jqerc3ExQ" Also make a button to cancel the process and start again or start a new project
3
+ Why is the app not working? I want an app that erases the background of photos. Why is the app not working?
4
+ Change the background to a clear and modern background, and correct my text.