Spaces:
Running

File size: 15,707 Bytes
3fbc906
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0cd7053
 
3fbc906
 
 
 
0cd7053
3fbc906
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0cd7053
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3fbc906
 
 
 
 
 
 
 
 
 
 
 
 
0cd7053
3fbc906
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
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
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>AI Photo Editor - PixelWizard</title>
    <link rel="icon" type="image/x-icon" href="/static/favicon.ico">
    <script src="https://cdn.tailwindcss.com"></script>
    <script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
    <script src="https://unpkg.com/feather-icons"></script>
    <style>
        @import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');
        
        body {
            font-family: 'Inter', sans-serif;
        }
        
        .editor-bg {
            background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
        }
        
        .glass-panel {
            background: rgba(255, 255, 255, 0.08);
            backdrop-filter: blur(15px);
            border: 1px solid rgba(255, 255, 255, 0.15);
        }
        
        .tool-button {
            transition: all 0.3s ease;
        }
        
        .tool-button:hover {
            background: rgba(255, 255, 255, 0.15);
            transform: translateY(-2px);
        }
        
        .slider-track {
            background: rgba(255, 255, 255, 0.2);
        }
        
        .slider-thumb {
            background: #fff;
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
        }
        
        .preview-container {
            background: rgba(0, 0, 0, 0.3);
            border-radius: 12px;
        }
    </style>
</head>
<body class="min-h-screen editor-bg text-white">
    <!-- Navigation -->
    <nav class="glass-panel rounded-2xl mx-4 mt-4 md:mx-8">
        <div class="container mx-auto px-6 py-4">
            <div class="flex items-center justify-between">
                <div class="flex items-center space-x-3">
                    <a href="index.html" class="flex items-center space-x-2">
                        <div class="w-6 h-6 bg-white rounded-full flex items-center justify-center">
                            <i data-feather="arrow-left" class="text-blue-600 w-3 h-3"></i>
                        </div>
                        <span class="text-lg font-semibold">PixelWizard Editor</span>
                    </a>
                </div>
                
                <div class="flex items-center space-x-4">
                    <button class="px-4 py-2 glass-panel rounded-lg hover:bg-white/10 transition-colors">
                        <i data-feather="save" class="w-4 h-4"></i>
                        Save
                    </button>
                    <button class="px-4 py-2 bg-white text-blue-600 rounded-lg font-semibold hover:bg-blue-50 transition-colors">
                        <i data-feather="download" class="w-4 h-4"></i>
                        Export
                    </button>
                </div>
            </div>
        </div>
    </nav>

    <!-- Main Editor Layout -->
    <div class="container mx-auto px-4 py-8">
        <div class="grid lg:grid-cols-4 gap-6">
            <!-- Left Sidebar - Tools -->
            <div class="lg:col-span-1">
                <div class="glass-panel rounded-2xl p-6">
                    <h3 class="text-lg font-semibold mb-4">AI Tools</h3>
                    
                    <div class="space-y-3">
                        <div class="tool-button glass-panel rounded-xl p-4 flex items-center space-x-3 cursor-pointer">
                            <i data-feather="zap" class="w-5 h-5 text-yellow-400"></i>
                            <span>Enhance Quality</span>
                        </div>
                        
                        <div class="tool-button glass-panel rounded-xl p-4 flex items-center space-x-3 cursor-pointer">
                            <i data-feather="edit-3" class="w-5 h-5 text-green-400"></i>
                            <span>Style Transfer</span>
                        </div>
                        
                        <div class="tool-button glass-panel rounded-xl p-4 flex items-center space-x-3 cursor-pointer">
                            <i data-feather="image" class="w-5 h-5 text-purple-400"></i>
                            <span>Background Change</span>
                        </div>
                        
                        <div class="tool-button glass-panel rounded-xl p-4 flex items-center space-x-3 cursor-pointer">
                            <i data-feather="sparkles" class="w-5 h-5 text-pink-400"></i>
                            <span>Magic AI Effects</span>
                        </div>
                        
                        <div class="tool-button glass-panel rounded-xl p-4 flex items-center space-x-3 cursor-pointer">
                            <i data-feather="cpu" class="w-5 h-5 text-blue-400"></i>
                            <span>Advanced Diffusion</span>
                        </div>
                    </div>
                    
                    <h3 class="text-lg font-semibold mt-8 mb-4">AI Models</h3>
                    
                    <div class="space-y-2">
                        <label class="flex items-center space-x-3 p-3 rounded-lg hover:bg-white/5 cursor-pointer">
                                <input type="radio" name="model" class="text-blue-500" checked>
                                <span>Flux 1.0 Pro</span>
                            </label>
                            
                            <label class="flex items-center space-x-3 p-3 rounded-lg hover:bg-white/5 cursor-pointer">
                                <input type="radio" name="model" class="text-blue-500">
                                <span>Stable Diffusion XL</span>
                            </label>
                            
                            <label class="flex items-center space-x-3 p-3 rounded-lg hover:bg-white/5 cursor-pointer">
                                <input type="radio" name="model" class="text-blue-500">
                                <span>DALL-E Enhanced</span>
                        </label>
                    </div>
                </div>
            </div>

            <!-- Center - Image Preview -->
            <div class="lg:col-span-2">
                <div class="glass-panel rounded-2xl p-6 h-full">
                    <div class="flex justify-between items-center mb-6">
                    <h3 class="text-lg font-semibold">Image Preview</h3>
                    <div class="flex space-x-2">
                        <button class="p-2 rounded-lg glass-panel hover:bg-white/10">
                        <i data-feather="zoom-in" class="w-4 h-4"></i>
                    </button>
                    <button class="p-2 rounded-lg glass-panel hover:bg-white/10">
                        <i data-feather="rotate-cw" class="w-4 h-4"></i>
                    </button>
                </div>
                <div class="preview-container p-4 flex items-center justify-center min-h-96" id="image-preview">
                    <div class="text-center" id="placeholder-content">
                        <i data-feather="image" class="w-16 h-16 mx-auto mb-4 text-blue-200"></i>
                        <p class="text-blue-200">Upload an image to start editing</p>
                    </div>
                </div>
<!-- Processing Controls -->
                <div class="mt-6 space-y-4">
                    <div>
                        <label class="block text-sm font-medium mb-2">AI Strength</label>
                        <div class="slider-track rounded-full h-2 relative">
                            <div class="slider-thumb w-4 h-4 rounded-full absolute -mt-1 cursor-pointer" style="left: 50%;"></div>
                        </div>
                    </div>
                    
                    <div>
                        <label class="block text-sm font-medium mb-2">Creativity Level</label>
                        <div class="slider-track rounded-full h-2 relative">
                            <div class="slider-thumb w-4 h-4 rounded-full absolute -mt-1 cursor-pointer" style="left: 70%;"></div>
                    </div>
                </div>
            </div>

            <!-- Right Sidebar - Settings -->
            <div class="lg:col-span-1">
                <div class="glass-panel rounded-2xl p-6">
                    <h3 class="text-lg font-semibold mb-4">Settings</h3>
                    
                    <div class="space-y-4">
                        <div>
                            <label class="block text-sm font-medium mb-2">Prompt Enhancement</label>
                            <textarea class="w-full glass-panel rounded-xl p-3 text-sm resize-none" placeholder="Describe the changes you want...">A young woman stands in the middle of a lively street, holding a microphone and singing her heart out. The warm glow of the sunset reflects on the faces of the crowd gathered around her...</textarea>
                        </div>
                        
                        <div>
                            <label class="block text-sm font-medium mb-2">Output Resolution</label>
                            <select class="w-full glass-panel rounded-xl p-3 text-sm">
                                <option>Original Size</option>
                                <option>1024x1024</option>
                                <option>2048x2048</option>
                            </select>
                        </div>
                        
                        <div>
                            <label class="block text-sm font-medium mb-2">Processing Steps</label>
                            <div class="flex items-center space-x-3">
                                <button class="p-2 rounded-lg glass-panel hover:bg-white/10">
                                    <i data-feather="minus" class="w-4 h-4"></i>
                                </button>
                                <span class="font-medium">20</span>
                                <button class="p-2 rounded-lg glass-panel hover:bg-white/10">
                                    <i data-feather="plus" class="w-4 h-4"></i>
                                </button>
                            </div>
                        </div>
                        
                        <div class="pt-4">
                            <button class="w-full py-3 bg-gradient-to-r from-blue-500 to-purple-600 rounded-xl font-semibold hover:opacity-90 transition-opacity">
                                <i data-feather="play" class="w-4 h-4 inline mr-2"></i>
                                Process Image
                            </button>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <!-- Processing Overlay -->
    <div id="processing-overlay" class="fixed inset-0 bg-black/50 flex items-center justify-center z-50 hidden">
                <div class="glass-panel rounded-2xl p-8 text-center max-w-md">
                    <div class="w-16 h-16 border-4 border-blue-500 border-t-transparent rounded-full animate-spin mx-auto mb-4"></div>
                    <h3 class="text-xl font-semibold mb-2">AI Processing</h3>
                    <p class="text-blue-200 mb-4">Our AI is transforming your image...</p>
                    <div class="w-full bg-white/20 rounded-full h-2">
                        <div class="bg-blue-400 h-2 rounded-full" style="width: 45%"></div>
            </div>
        </div>
        <script>
            // Initialize Feather Icons
            feather.replace();

            // Load uploaded image or sample image
            document.addEventListener('DOMContentLoaded', function() {
                const urlParams = new URLSearchParams(window.location.search);
                const isSample = urlParams.get('sample');
                
                const uploadedImage = sessionStorage.getItem('uploadedImage');
                
                if (uploadedImage) {
                    displayImage(uploadedImage);
                    sessionStorage.removeItem('uploadedImage');
                } else if (isSample) {
                    displaySampleImage();
                }
            });

            function displayImage(imageData) {
                const previewContainer = document.getElementById('image-preview');
                const placeholder = document.getElementById('placeholder-content');
                
                if (placeholder) {
                    placeholder.style.display = 'none';
                }
                
                previewContainer.innerHTML = `
                    <img src="${imageData}" alt="Uploaded Image" class="rounded-xl max-w-full max-h-80 object-contain">
                `;
            }

            function displaySampleImage() {
                const previewContainer = document.getElementById('image-preview');
                const placeholder = document.getElementById('placeholder-content');
                
                if (placeholder) {
                    placeholder.style.display = 'none';
                }
                
                previewContainer.innerHTML = `
                    <img src="http://static.photos/people/640x360/123" alt="Sample Image" class="rounded-xl max-w-full max-h-80 object-contain">
                `;
            }

            // Simple processing simulation
            document.querySelector('button:contains("Process Image")').addEventListener('click', function() {
                const overlay = document.getElementById('processing-overlay');
                overlay.classList.remove('hidden');
                
                setTimeout(() => {
                    overlay.classList.add('hidden');
                    // Show success message
                    const preview = document.querySelector('.preview-container');
                preview.innerHTML = `
                    <img src="http://static.photos/technology/640x360/42" alt="Processed Image" class="rounded-xl max-w-full">
                `;
            }, 3000);
// Tool selection
            document.querySelectorAll('.tool-button').forEach(button => {
                button.addEventListener('click', function() {
                    document.querySelectorAll('.tool-button').forEach(btn => {
                        btn.classList.remove('bg-white/20');
                    });
                    this.classList.add('bg-white/20');
                });
            });

            // Slider functionality
            document.querySelectorAll('.slider-track').forEach(track => {
                const thumb = track.querySelector('.slider-thumb');
                
                thumb.addEventListener('mousedown', function(e) {
                    e.preventDefault();
                    const trackRect = track.getBoundingClientRect();
                    
                    const moveHandler = (e) => {
                        const x = Math.max(0, Math.min(e.clientX - trackRect.left, trackRect.width));
                        const percentage = (x / trackRect.width) * 100;
                        thumb.style.left = percentage + '%';
                    };
                    
                    const upHandler = () => {
                        document.removeEventListener('mousemove', moveHandler);
                        document.removeEventListener('mouseup', upHandler);
                    };
                    
                    document.addEventListener('mousemove', moveHandler);
                    document.addEventListener('mouseup', upHandler);
                });
            });
        </script>
    </body>
    </html>