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59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>RemoveMe - Effortless Background Removal</title>
    <script src="https://cdn.tailwindcss.com"></script>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <style>
        @keyframes pulse {
            0% { transform: scale(1); }
            50% { transform: scale(1.05); }
            100% { transform: scale(1); }
        }
        .animate-pulse-slow {
            animation: pulse 4s infinite;
        }
        .drop-zone {
            border: 3px dashed #9ca3af;
            transition: all 0.3s;
        }
        .drop-zone.active {
            border-color: #3b82f6;
            background-color: #f0f7ff;
        }
        .result-container {
            opacity: 0;
            transform: translateY(20px);
            transition: all 0.5s ease-out;
        }
        .result-container.show {
            opacity: 1;
            transform: translateY(0);
        }
        .image-mask {
            mask-image: linear-gradient(to right, rgba(0,0,0,1) 85%, rgba(0,0,0,0));
        }
    </style>
</head>
<body class="bg-gray-50 min-h-screen font-sans">
    <div class="bg-white shadow-sm sticky top-0 z-50">
        <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
            <div class="flex justify-between h-16 items-center">
                <div class="flex items-center">
                    <div class="flex-shrink-0 flex items-center">
                        <i class="fas fa-magic text-blue-500 text-2xl mr-2"></i>
                        <h1 class="text-xl font-bold text-blue-600">Remove<span class="text-gray-800">Me</span></h1>
                    </div>
                </div>
                <div>
                    <button id="try-demo" class="bg-blue-500 hover:bg-blue-600 text-white px-4 py-2 rounded-md transition duration-200 hidden md:block">
                        Try Demo Image
                    </button>
                </div>
            </div>
        </div>
    </div>

    <main class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-12">
        <div class="text-center mb-12">
            <h1 class="text-4xl md:text-5xl font-bold text-gray-900 mb-4">Remove Backgrounds in <span class="bg-clip-text text-transparent bg-gradient-to-r from-blue-500 to-purple-600">One Click</span></h1>
            <p class="text-xl text-gray-600 max-w-2xl mx-auto">AI-powered background removal that works instantly. No skills needed.</p>
        </div>

        <div class="bg-white rounded-xl shadow-lg overflow-hidden max-w-4xl mx-auto">
            <div class="flex flex-col md:flex-row">
                <div id="upload-container" class="p-8 w-full md:w-1/2">
                    <div id="drop-zone" class="drop-zone rounded-lg p-8 text-center cursor-pointer hover:border-blue-400 hover:bg-blue-50 transition duration-200 h-full flex flex-col items-center justify-center">
                        <i class="fas fa-cloud-upload-alt text-4xl text-blue-400 mb-4"></i>
                        <h3 class="text-lg font-medium text-gray-900 mb-2">Drag & Drop your image here</h3>
                        <p class="text-gray-500 text-sm mb-4">or click to browse files</p>
                        <input type="file" id="file-upload" accept="image/*" class="hidden">
                        <button id="upload-btn" class="bg-blue-500 hover:bg-blue-600 text-white px-6 py-2 rounded-md transition duration-200 text-sm">
                            Select Image
                        </button>
                        <p class="text-gray-400 text-xs mt-4">Supports JPG, PNG up to 10MB</p>
                    </div>
                    <div id="upload-preview" class="hidden h-full flex items-center justify-center relative">
                        <img id="preview-image" src="" class="max-h-80 max-w-full rounded-lg object-contain" alt="Preview">
                        <button id="remove-preview" class="absolute top-2 right-2 bg-white rounded-full p-2 shadow-md hover:bg-gray-100 transition">
                            <i class="fas fa-times text-gray-600"></i>
                        </button>
                        <button id="process-btn" class="animate-pulse-slow absolute bottom-4 bg-gradient-to-r from-blue-500 to-purple-600 text-white px-6 py-3 rounded-md shadow-lg hover:shadow-xl transition-all duration-300 transform hover:scale-105">
                            <i class="fas fa-magic mr-2"></i> Remove Background
                        </button>
                    </div>
                </div>

                <div class="w-full md:w-1/2 bg-gray-50 p-8 flex items-center justify-center">
                    <div id="result-container" class="result-container text-center w-full">
                        <div id="result-placeholder" class="flex flex-col items-center justify-center">
                            <div class="w-24 h-24 rounded-full bg-blue-50 flex items-center justify-center mb-4">
                                <i class="fas fa-image text-blue-300 text-3xl"></i>
                            </div>
                            <h3 class="text-lg font-medium text-gray-700 mb-2">Your result will appear here</h3>
                            <p class="text-gray-500 text-sm">AI magic at work!</p>
                        </div>
                        <div id="result-content" class="hidden">
                            <div class="relative">
                                <img id="result-image" src="" class="max-h-80 w-full rounded-lg object-contain" alt="Result">
                                <div id="download-options" class="flex gap-2 justify-center mt-4">
                                    <button id="download-png" class="bg-white border border-gray-300 hover:bg-gray-50 text-gray-700 px-4 py-2 rounded-md text-sm flex items-center gap-1">
                                        <i class="fas fa-download"></i> PNG
                                    </button>
                                    <button id="download-jpg" class="bg-white border border-gray-300 hover:bg-gray-50 text-gray-700 px-4 py-2 rounded-md text-sm flex items-center gap-1">
                                        <i class="fas fa-download"></i> JPG
                                    </button>
                                    <button id="download-transparent" class="bg-blue-500 hover:bg-blue-600 text-white px-4 py-2 rounded-md text-sm flex items-center gap-1">
                                        <i class="fas fa-file-image"></i> Transparent
                                    </button>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <div class="mt-16 mb-12">
            <h2 class="text-3xl text-center font-bold text-gray-900 mb-8">How it works</h2>
            <div class="grid grid-cols-1 md:grid-cols-3 gap-8">
                <div class="bg-white p-6 rounded-xl shadow-sm flex flex-col items-center text-center">
                    <div class="w-16 h-16 rounded-full bg-blue-50 flex items-center justify-center mb-4">
                        <i class="fas fa-upload text-blue-500 text-xl"></i>
                    </div>
                    <h3 class="font-medium text-lg text-gray-900 mb-2">Upload Image</h3>
                    <p class="text-gray-600">Drag & drop or select a photo from your device</p>
                </div>
                <div class="bg-white p-6 rounded-xl shadow-sm flex flex-col items-center text-center">
                    <div class="w-16 h-16 rounded-full bg-purple-50 flex items-center justify-center mb-4">
                        <i class="fas fa-magic text-purple-500 text-xl"></i>
                    </div>
                    <h3 class="font-medium text-lg text-gray-900 mb-2">AI Processing</h3>
                    <p class="text-gray-600">Our AI automatically removes the background instantly</p>
                </div>
                <div class="bg-white p-6 rounded-xl shadow-sm flex flex-col items-center text-center">
                    <div class="w-16 h-16 rounded-full bg-green-50 flex items-center justify-center mb-4">
                        <i class="fas fa-download text-green-500 text-xl"></i>
                    </div>
                    <h3 class="font-medium text-lg text-gray-900 mb-2">Download</h3>
                    <p class="text-gray-600">Save your image with transparent background</p>
                </div>
            </div>
        </div>

        <div class="bg-gradient-to-r from-blue-500 to-purple-600 rounded-2xl p-8 md:p-12 text-white mt-12 mb-12 overflow-hidden relative">
            <div class="grid grid-cols-1 md:grid-cols-2 gap-8 relative z-10">
                <div>
                    <h2 class="text-3xl font-bold mb-4">Instant background removal for everyone</h2>
                    <p class="text-blue-100 mb-6 text-lg">Perfect for creators, marketers, small businesses and anyone who needs professional-looking images.</p>
                    <div class="flex flex-col gap-3">
                        <div class="flex items-start gap-3">
                            <i class="fas fa-check-circle mt-1"></i>
                            <p>No Photoshop skills required</p>
                        </div>
                        <div class="flex items-start gap-3">
                            <i class="fas fa-check-circle mt-1"></i>
                            <p>Process multiple images at once</p>
                        </div>
                        <div class="flex items-start gap-3">
                            <i class="fas fa-check-circle mt-1"></i>
                            <p>High-resolution downloads</p>
                        </div>
                    </div>
                </div>
                <div class="hidden md:flex items-center justify-end">
                    <div class="relative">
                        <div class="bg-white/20 backdrop-blur-sm rounded-xl p-4 w-64 h-64 flex items-center justify-center transform rotate-3">
                            <div class="bg-white/30 backdrop-blur-sm rounded-lg p-3 w-56 h-56 flex items-center justify-center transform -rotate-6">
                                <i class="fas fa-image text-white/60 text-5xl"></i>
                            </div>
                        </div>
                        <img src="https://images.unsplash.com/photo-1655720827868-a8f394ffc11e?w=400&auto=format" class="absolute inset-0 w-full h-full object-cover rounded-lg shadow-xl" alt="Example">
                    </div>
                </div>
            </div>
            <div class="absolute -right-20 -top-20 w-64 h-64 rounded-full bg-white/10 backdrop-blur-sm"></div>
            <div class="absolute -left-20 -bottom-20 w-64 h-64 rounded-full bg-white/10 backdrop-blur-sm"></div>
        </div>
    </main>

    <footer class="bg-gray-900 text-white py-12">
        <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
            <div class="grid grid-cols-1 md:grid-cols-4 gap-8">
                <div>
                    <h3 class="text-xl font-semibold mb-4 flex items-center">
                        <i class="fas fa-magic text-blue-400 mr-2"></i> RemoveMe
                    </h3>
                    <p class="text-gray-400">Making professional image editing accessible to everyone.</p>
                </div>
                <div>
                    <h4 class="text-md font-semibold mb-4">Product</h4>
                    <ul class="space-y-2">
                        <li><a href="#" class="text-gray-400 hover:text-white">Features</a></li>
                        <li><a href="#" class="text-gray-400 hover:text-white">Pricing</a></li>
                        <li><a href="#" class="text-gray-400 hover:text-white">API</a></li>
                    </ul>
                </div>
                <div>
                    <h4 class="text-md font-semibold mb-4">Resources</h4>
                    <ul class="space-y-2">
                        <li><a href="#" class="text-gray-400 hover:text-white">Help Center</a></li>
                        <li><a href="#" class="text-gray-400 hover:text-white">Tutorials</a></li>
                        <li><a href="#" class="text-gray-400 hover:text-white">Blog</a></li>
                    </ul>
                </div>
                <div>
                    <h4 class="text-md font-semibold mb-4">Company</h4>
                    <ul class="space-y-2">
                        <li><a href="#" class="text-gray-400 hover:text-white">About</a></li>
                        <li><a href="#" class="text-gray-400 hover:text-white">Careers</a></li>
                        <li><a href="#" class="text-gray-400 hover:text-white">Contact</a></li>
                    </ul>
                </div>
            </div>
            <div class="border-t border-gray-800 mt-8 pt-8 flex flex-col md:flex-row justify-between items-center">
                <p class="text-gray-400 text-sm mb-4 md:mb-0">© 2023 RemoveMe. All rights reserved.</p>
                <div class="flex space-x-6">
                    <a href="#" class="text-gray-400 hover:text-white">
                        <span class="sr-only">Facebook</span>
                        <i class="fab fa-facebook"></i>
                    </a>
                    <a href="#" class="text-gray-400 hover:text-white">
                        <span class="sr-only">Instagram</span>
                        <i class="fab fa-instagram"></i>
                    </a>
                    <a href="#" class="text-gray-400 hover:text-white">
                        <span class="sr-only">Twitter</span>
                        <i class="fab fa-twitter"></i>
                    </a>
                    <a href="#" class="text-gray-400 hover:text-white">
                        <span class="sr-only">GitHub</span>
                        <i class="fab fa-github"></i>
                    </a>
                </div>
            </div>
        </div>
    </footer>

    <div id="loading-modal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 hidden">
        <div class="bg-white rounded-xl p-8 max-w-md w-full mx-4 text-center">
            <div class="w-20 h-20 mx-auto mb-6 flex items-center justify-center">
                <div class="animate-spin rounded-full h-16 w-16 border-t-2 border-b-2 border-blue-500"></div>
                <i class="fas fa-magic text-blue-500 text-2xl absolute"></i>
            </div>
            <h3 class="text-xl font-medium text-gray-900 mb-2">Working Magic...</h3>
            <p class="text-gray-500 mb-6">Our AI is removing your background. This usually takes just a few seconds.</p>
            <div class="w-full bg-gray-200 rounded-full h-2.5">
                <div id="progress-bar" class="bg-blue-600 h-2.5 rounded-full w-0 transition-all duration-300"></div>
            </div>
        </div>
    </div>

    <script>
        // API Configuration
        const API_KEY = 'sk_e28ca3ad376b43d59e14c9844d179126';
        const API_URL = 'https://developer.pixelcut.ai/remove-background';
        
        // DOM Elements
        const uploadBtn = document.getElementById('upload-btn');
        const fileUpload = document.getElementById('file-upload');
        const dropZone = document.getElementById('drop-zone');
        const uploadPreview = document.getElementById('upload-preview');
        const previewImage = document.getElementById('preview-image');
        const removePreview = document.getElementById('remove-preview');
        const processBtn = document.getElementById('process-btn');
        const resultPlaceholder = document.getElementById('result-placeholder');
        const resultContent = document.getElementById('result-content');
        const resultImage = document.getElementById('result-image');
        const resultContainer = document.getElementById('result-container');
        const loadingModal = document.getElementById('loading-modal');
        const progressBar = document.getElementById('progress-bar');
        const tryDemoBtn = document.getElementById('try-demo');
        const downloadPng = document.getElementById('download-png');
        const downloadJpg = document.getElementById('download-jpg');
        const downloadTransparent = document.getElementById('download-transparent');
        
        // Event Listeners
        uploadBtn.addEventListener('click', () => fileUpload.click());
        fileUpload.addEventListener('change', handleFileSelect);
        dropZone.addEventListener('dragover', handleDragOver);
        dropZone.addEventListener('dragleave', handleDragLeave);
        dropZone.addEventListener('drop', handleDrop);
        removePreview.addEventListener('click', resetUpload);
        processBtn.addEventListener('click', processImage);
        tryDemoBtn.addEventListener('click', useDemoImage);
        downloadPng.addEventListener('click', () => downloadImage('png'));
        downloadJpg.addEventListener('click', () => downloadImage('jpg'));
        downloadTransparent.addEventListener('click', () => downloadImage('transparent'));
        
        // Functions
        function handleFileSelect(e) {
            const file = e.target.files[0];
            if (file) {
                validateAndPreview(file);
            }
        }
        
        function handleDragOver(e) {
            e.preventDefault();
            e.stopPropagation();
            dropZone.classList.add('active');
        }
        
        function handleDragLeave(e) {
            e.preventDefault();
            e.stopPropagation();
            dropZone.classList.remove('active');
        }
        
        function handleDrop(e) {
            e.preventDefault();
            e.stopPropagation();
            dropZone.classList.remove('active');
            
            const file = e.dataTransfer.files[0];
            if (file) {
                validateAndPreview(file);
            }
        }
        
        function validateAndPreview(file) {
            // Check if file is an image
            if (!file.type.match('image.*')) {
                showError('Please upload an image file (JPG, PNG)');
                return;
            }
            
            // Check file size (10MB max)
            if (file.size > 10 * 1024 * 1024) {
                showError('File is too large. Maximum size is 10MB.');
                return;
            }
            
            // Preview the image
            const reader = new FileReader();
            reader.onload = function(e) {
                previewImage.src = e.target.result;
                uploadPreview.classList.remove('hidden');
                dropZone.classList.add('hidden');
            };
            reader.readAsDataURL(file);
        }
        
        function showError(message) {
            alert(message);
        }
        
        function resetUpload() {
            fileUpload.value = '';
            uploadPreview.classList.add('hidden');
            dropZone.classList.remove('hidden');
            resultContent.classList.add('hidden');
            resultPlaceholder.classList.remove('hidden');
        }
        
        function useDemoImage() {
            // Using a sample image URL for demo
            previewImage.src = 'https://images.unsplash.com/photo-1517486808906-6ca8b3f6ea1d?w=500&auto=format';
            uploadPreview.classList.remove('hidden');
            dropZone.classList.add('hidden');
        }
        
        async function processImage() {
            if (!previewImage.src) {
                showError('Please upload an image first');
                return;
            }
            
            // Show loading modal
            loadingModal.classList.remove('hidden');
            
            // Simulate progress for UX (in real app, this would be actual API progress)
            let progress = 0;
            const progressInterval = setInterval(() => {
                progress += Math.random() * 10;
                if (progress > 80) clearInterval(progressInterval);
                progressBar.style.width = `${progress}%`;
            }, 300);
            
            try {
                // Prepare the request
                const formData = new FormData();
                const response = await fetch(previewImage.src);
                const blob = await response.blob();
                formData.append('image_file', blob, 'uploaded_image.jpg');
                
                // Make API request
                const apiResponse = await fetch(API_URL, {
                    method: 'POST',
                    headers: {
                        'X-API-Key': API_KEY
                    },
                    body: formData
                });
                
                if (!apiResponse.ok) throw new Error('API request failed');
                
                // In a real app, we would use the actual API response
                // For this demo, we'll simulate a processed image
                clearInterval(progressInterval);
                progressBar.style.width = '100%';
                
                setTimeout(() => {
                    loadingModal.classList.add('hidden');
                    
                    // This is where you would use the actual API response
                    // For demo purposes, we'll just show the same image but with a "processed" effect
                    resultImage.src = previewImage.src + '?processed=true';
                    
                    // Show results with animation
                    resultPlaceholder.classList.add('hidden');
                    resultContent.classList.remove('hidden');
                    resultContainer.classList.add('show');
                }, 800);
                
            } catch (error) {
                console.error('Error processing image:', error);
                clearInterval(progressInterval);
                loadingModal.classList.add('hidden');
                showError('Failed to process image. Please try again.');
            }
        }
        
        function downloadImage(format) {
            if (!resultImage.src || resultImage.src === '') {
                showError('No processed image to download');
                return;
            }
            
            // In a real app, this would use the actual processed image from the API
            const link = document.createElement('a');
            link.href = resultImage.src;
            link.download = `removed-background.${format}`;
            document.body.appendChild(link);
            link.click();
            document.body.removeChild(link);
        }
    </script>
<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=LuHof/removeme1" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html>