File size: 21,503 Bytes
38fe268
 
 
 
 
0649407
38fe268
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0649407
 
 
 
 
 
 
 
 
 
 
 
38fe268
 
 
 
 
 
 
0649407
 
 
 
 
 
 
38fe268
 
0649407
38fe268
0649407
 
 
 
38fe268
 
 
 
 
0649407
 
38fe268
0649407
 
38fe268
0649407
 
 
 
38fe268
 
 
0649407
 
 
38fe268
 
0649407
38fe268
0649407
 
 
 
38fe268
0649407
38fe268
0649407
38fe268
 
0649407
 
38fe268
0649407
38fe268
0649407
38fe268
 
0649407
 
38fe268
0649407
38fe268
0649407
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
38fe268
 
 
 
 
 
0649407
38fe268
 
 
 
0649407
 
38fe268
 
 
 
 
 
0649407
 
38fe268
 
0649407
38fe268
 
0649407
38fe268
 
 
 
0649407
38fe268
 
 
0649407
 
38fe268
 
 
 
 
 
 
 
 
0649407
 
 
38fe268
 
 
 
 
0649407
 
38fe268
0649407
38fe268
0649407
 
38fe268
 
0649407
38fe268
0649407
 
38fe268
 
0649407
38fe268
0649407
 
38fe268
 
0649407
38fe268
0649407
 
38fe268
 
 
 
0649407
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
38fe268
 
 
 
 
 
0649407
 
 
38fe268
 
 
 
0649407
38fe268
 
 
 
 
 
 
 
 
0649407
38fe268
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0649407
38fe268
 
 
 
 
 
 
 
 
 
 
 
 
 
0649407
 
38fe268
 
 
0649407
 
38fe268
 
 
 
 
0649407
 
 
 
 
 
 
38fe268
 
 
 
 
 
 
 
 
 
 
 
0649407
38fe268
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0649407
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
38fe268
 
0649407
 
 
 
 
 
 
 
 
 
38fe268
0649407
 
38fe268
 
 
 
 
0649407
38fe268
0649407
 
38fe268
 
 
 
 
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
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
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>UNO-FLUX Retro Cartoon Transformer</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>
        .dropzone {
            border: 3px dashed #9ca3af;
            transition: all 0.3s ease;
        }
        .dropzone.active {
            border-color: #3b82f6;
            background-color: rgba(59, 130, 246, 0.05);
        }
        .filter-option {
            transition: all 0.2s ease;
        }
        .filter-option:hover {
            transform: scale(1.05);
        }
        .filter-option.selected {
            box-shadow: 0 0 0 3px #3b82f6;
        }
        .progress-bar {
            transition: width 0.5s ease;
        }
        .retro-filter {
            background: linear-gradient(135deg, #ff9a9e 0%, #fad0c4 100%);
            border: 3px solid #ff6b6b;
        }
        .hanna-filter {
            background: linear-gradient(135deg, #a1c4fd 0%, #c2e9fb 100%);
            border: 3px solid #4facfe;
        }
        .flintstones-filter {
            background: linear-gradient(135deg, #f6d365 0%, #fda085 100%);
            border: 3px solid #f6d365;
        }
        .jetsons-filter {
            background: linear-gradient(135deg, #84fab0 0%, #8fd3f4 100%);
            border: 3px solid #84fab0;
        }
        @keyframes pulse {
            0%, 100% { transform: scale(1); }
            50% { transform: scale(1.05); }
        }
        .processing-animation {
            animation: pulse 1.5s infinite;
        }
        .neon-text {
            text-shadow: 0 0 5px #fff, 0 0 10px #fff, 0 0 15px #ff00de, 0 0 20px #ff00de;
        }
        .retro-border {
            border: 4px solid;
            border-image: linear-gradient(45deg, #ff00de, #00ffea, #ff00de) 1;
        }
    </style>
</head>
<body class="bg-gray-900 min-h-screen">
    <div class="container mx-auto px-4 py-8">
        <!-- Header with UNO-FLUX integration -->
        <header class="text-center mb-12 retro-border p-4 bg-black">
            <h1 class="text-5xl font-bold neon-text text-white mb-2">UNO-FLUX Retro Cartoon</h1>
            <p class="text-xl text-gray-300">Powered by <span class="text-blue-400">UNO-FLUX AI</span> - Transform images into Hanna-Barbera style cartoons</p>
        </header>

        <!-- Main Content -->
        <div class="grid grid-cols-1 lg:grid-cols-2 gap-8">
            <!-- Upload Section -->
            <div class="bg-gray-800 rounded-xl shadow-lg p-6">
                <h2 class="text-2xl font-semibold text-white mb-4">Upload Your Image</h2>
                
                <!-- Image Dropzone -->
                <div id="dropzone" class="dropzone rounded-lg p-8 text-center cursor-pointer mb-6 bg-gray-700">
                    <div class="flex flex-col items-center justify-center space-y-3">
                        <i class="fas fa-image text-4xl text-indigo-400"></i>
                        <p class="text-gray-300">Drag & drop your image here</p>
                        <p class="text-sm text-gray-400">or click to browse files</p>
                        <input type="file" id="image-upload" class="hidden" accept="image/*">
                    </div>
                </div>
                
                <!-- Image Preview -->
                <div id="image-preview-container" class="hidden mb-6">
                    <img id="image-preview" class="w-full rounded-lg shadow">
                </div>
                
                <!-- Style Selection -->
                <div class="mb-6">
                    <h3 class="text-lg font-medium text-gray-300 mb-3">Select Cartoon Style</h3>
                    <div class="grid grid-cols-2 gap-3">
                        <!-- Hanna-Barbera Style -->
                        <div class="filter-option hanna-filter rounded-lg p-3 text-center cursor-pointer" data-filter="hanna">
                            <div class="bg-white rounded-md p-2 mb-2">
                                <i class="fas fa-tv-retro text-2xl text-blue-600"></i>
                            </div>
                            <span class="text-sm font-medium text-white">Hanna-Barbera</span>
                        </div>
                        
                        <!-- Flintstones Style -->
                        <div class="filter-option flintstones-filter rounded-lg p-3 text-center cursor-pointer" data-filter="flintstones">
                            <div class="bg-white rounded-md p-2 mb-2">
                                <i class="fas fa-drumstick-bite text-2xl text-orange-600"></i>
                            </div>
                            <span class="text-sm font-medium text-white">Flintstones</span>
                        </div>
                        
                        <!-- Jetsons Style -->
                        <div class="filter-option jetsons-filter rounded-lg p-3 text-center cursor-pointer" data-filter="jetsons">
                            <div class="bg-white rounded-md p-2 mb-2">
                                <i class="fas fa-rocket text-2xl text-green-600"></i>
                            </div>
                            <span class="text-sm font-medium text-white">Jetsons</span>
                        </div>
                        
                        <!-- UNO-FLUX Default -->
                        <div class="filter-option bg-gray-700 rounded-lg p-3 text-center cursor-pointer" data-filter="uno">
                            <div class="bg-white rounded-md p-2 mb-2">
                                <i class="fas fa-robot text-2xl text-purple-600"></i>
                            </div>
                            <span class="text-sm font-medium text-white">UNO-FLUX</span>
                        </div>
                    </div>
                </div>
                
                <!-- Advanced Options -->
                <div class="mb-6">
                    <h3 class="text-lg font-medium text-gray-300 mb-3">Advanced Options</h3>
                    <div class="space-y-4">
                        <div>
                            <label class="block text-sm font-medium text-gray-400 mb-1">Style Strength</label>
                            <input type="range" min="0" max="100" value="70" class="w-full h-2 bg-gray-600 rounded-lg appearance-none cursor-pointer">
                        </div>
                        <div>
                            <label class="block text-sm font-medium text-gray-400 mb-1">Detail Preservation</label>
                            <input type="range" min="0" max="100" value="50" class="w-full h-2 bg-gray-600 rounded-lg appearance-none cursor-pointer">
                        </div>
                    </div>
                </div>
                
                <!-- Process Button -->
                <button id="process-btn" class="w-full bg-indigo-600 hover:bg-indigo-700 text-white py-3 px-4 rounded-lg font-medium disabled:opacity-50 disabled:cursor-not-allowed" disabled>
                    <i class="fas fa-magic mr-2"></i> Transform Image
                </button>
            </div>
            
            <!-- Results Section -->
            <div class="bg-gray-800 rounded-xl shadow-lg p-6">
                <h2 class="text-2xl font-semibold text-white mb-4">Your Cartoon Image</h2>
                
                <!-- Processing State -->
                <div id="processing-state" class="hidden text-center py-12">
                    <div class="processing-animation inline-block mb-6">
                        <i class="fas fa-magic text-6xl text-indigo-500"></i>
                    </div>
                    <h3 class="text-xl font-medium text-gray-300 mb-2">Creating Your Retro Cartoon</h3>
                    <p class="text-gray-400 mb-4">Powered by UNO-FLUX AI technology...</p>
                    
                    <!-- Progress Bar -->
                    <div class="w-full bg-gray-700 rounded-full h-4 mb-4">
                        <div id="progress-bar" class="progress-bar bg-indigo-600 h-4 rounded-full" style="width: 0%"></div>
                    </div>
                    <p id="progress-text" class="text-sm text-gray-400">0% complete</p>
                </div>
                
                <!-- Result Preview -->
                <div id="result-container" class="hidden">
                    <img id="result-image" class="w-full rounded-lg shadow mb-6">
                    
                    <div class="flex justify-between items-center">
                        <div>
                            <h3 class="text-lg font-medium text-gray-300">Your Retro Cartoon</h3>
                            <p class="text-sm text-gray-400">Ready to download</p>
                        </div>
                        <button id="download-btn" class="bg-green-600 hover:bg-green-700 text-white py-2 px-4 rounded-lg font-medium flex items-center">
                            <i class="fas fa-download mr-2"></i> Download
                        </button>
                    </div>
                </div>
                
                <!-- Empty State -->
                <div id="empty-state" class="text-center py-12">
                    <i class="fas fa-image text-5xl text-gray-600 mb-4"></i>
                    <h3 class="text-xl font-medium text-gray-400 mb-2">No Image Yet</h3>
                    <p class="text-gray-500">Upload an image and select a style to see your cartoon transformation</p>
                </div>
            </div>
        </div>
        
        <!-- Style Samples -->
        <div class="mt-16 bg-gray-800 rounded-xl shadow-lg p-6">
            <h2 class="text-2xl font-semibold text-white mb-6">Retro Cartoon Style Samples</h2>
            <div class="grid grid-cols-2 md:grid-cols-4 gap-6">
                <div class="overflow-hidden rounded-lg shadow-md bg-gray-700">
                    <img src="https://images.unsplash.com/photo-1637858868799-7f26a0640eb6?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=880&q=80" alt="Original" class="w-full h-48 object-cover">
                    <div class="p-3 bg-gray-700">
                        <p class="text-sm font-medium text-center text-white">Original</p>
                    </div>
                </div>
                <div class="overflow-hidden rounded-lg shadow-md hanna-filter">
                    <img src="https://images.unsplash.com/photo-1637858868799-7f26a0640eb6?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=880&q=80" alt="Hanna-Barbera Style" class="w-full h-48 object-cover" style="filter: sepia(0.5) saturate(2) hue-rotate(-10deg) contrast(1.2)">
                    <div class="p-3 bg-gray-700">
                        <p class="text-sm font-medium text-center text-white">Hanna-Barbera</p>
                    </div>
                </div>
                <div class="overflow-hidden rounded-lg shadow-md flintstones-filter">
                    <img src="https://images.unsplash.com/photo-1637858868799-7f26a0640eb6?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=880&q=80" alt="The Flintstones" class="w-full h-48 object-cover" style="filter: sepia(0.3) saturate(2.5) hue-rotate(20deg) contrast(1.1)">
                    <div class="p-3 bg-gray-700">
                        <p class="text-sm font-medium text-center text-white">Flintstones</p>
                    </div>
                </div>
                <div class="overflow-hidden rounded-lg shadow-md jetsons-filter">
                    <img src="https://images.unsplash.com/photo-1637858868799-7f26a0640eb6?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=880&q=80" alt="The Jetsons" class="w-full h-48 object-cover" style="filter: hue-rotate(200deg) saturate(2) brightness(1.1)">
                    <div class="p-3 bg-gray-700">
                        <p class="text-sm font-medium text-center text-white">Jetsons</p>
                    </div>
                </div>
            </div>
        </div>

        <!-- UNO-FLUX Info Section -->
        <div class="mt-16 bg-black rounded-xl shadow-lg p-6 retro-border">
            <div class="flex flex-col md:flex-row items-center">
                <div class="md:w-1/3 mb-6 md:mb-0">
                    <img src="https://huggingface.co/spaces/bytedance-research/UNO-FLUX/resolve/main/assets/logo.png" alt="UNO-FLUX Logo" class="w-full max-w-xs mx-auto">
                </div>
                <div class="md:w-2/3 md:pl-8">
                    <h2 class="text-3xl font-bold text-white mb-4">About UNO-FLUX</h2>
                    <p class="text-gray-300 mb-4">
                        UNO-FLUX is an advanced image-to-image diffusion model developed by ByteDance Research. 
                        It specializes in high-quality image transformation while preserving details and structure.
                    </p>
                    <p class="text-gray-300 mb-4">
                        Our retro cartoon styles are built on top of UNO-FLUX's powerful architecture, 
                        combining classic Hanna-Barbera aesthetics with modern AI capabilities.
                    </p>
                    <a href="https://huggingface.co/spaces/bytedance-research/UNO-FLUX" target="_blank" class="inline-block bg-blue-600 hover:bg-blue-700 text-white py-2 px-4 rounded-lg font-medium">
                        <i class="fas fa-external-link-alt mr-2"></i> Visit UNO-FLUX
                    </a>
                </div>
            </div>
        </div>
    </div>

    <script>
        document.addEventListener('DOMContentLoaded', function() {
            // DOM Elements
            const dropzone = document.getElementById('dropzone');
            const imageUpload = document.getElementById('image-upload');
            const imagePreviewContainer = document.getElementById('image-preview-container');
            const imagePreview = document.getElementById('image-preview');
            const processBtn = document.getElementById('process-btn');
            const processingState = document.getElementById('processing-state');
            const resultContainer = document.getElementById('result-container');
            const emptyState = document.getElementById('empty-state');
            const resultImage = document.getElementById('result-image');
            const downloadBtn = document.getElementById('download-btn');
            const progressBar = document.getElementById('progress-bar');
            const progressText = document.getElementById('progress-text');
            const filterOptions = document.querySelectorAll('.filter-option');
            
            let selectedFile = null;
            let selectedFilter = null;
            
            // Event Listeners
            dropzone.addEventListener('click', () => imageUpload.click());
            dropzone.addEventListener('dragover', (e) => {
                e.preventDefault();
                dropzone.classList.add('active');
            });
            dropzone.addEventListener('dragleave', () => {
                dropzone.classList.remove('active');
            });
            dropzone.addEventListener('drop', (e) => {
                e.preventDefault();
                dropzone.classList.remove('active');
                if (e.dataTransfer.files.length) {
                    handleFileUpload(e.dataTransfer.files[0]);
                }
            });
            
            imageUpload.addEventListener('change', (e) => {
                if (e.target.files.length) {
                    handleFileUpload(e.target.files[0]);
                }
            });
            
            filterOptions.forEach(option => {
                option.addEventListener('click', () => {
                    filterOptions.forEach(opt => opt.classList.remove('selected'));
                    option.classList.add('selected');
                    selectedFilter = option.getAttribute('data-filter');
                    updateProcessButton();
                });
            });
            
            processBtn.addEventListener('click', processImage);
            downloadBtn.addEventListener('click', downloadImage);
            
            // Functions
            function handleFileUpload(file) {
                if (!file.type.includes('image/')) {
                    alert('Please upload an image file (JPEG, PNG, etc.).');
                    return;
                }
                
                selectedFile = file;
                
                // Show image preview
                imagePreviewContainer.classList.remove('hidden');
                const reader = new FileReader();
                reader.onload = function(e) {
                    imagePreview.src = e.target.result;
                };
                reader.readAsDataURL(file);
                
                updateProcessButton();
            }
            
            function updateProcessButton() {
                if (selectedFile && selectedFilter) {
                    processBtn.disabled = false;
                } else {
                    processBtn.disabled = true;
                }
            }
            
            function processImage() {
                // Show processing state
                processingState.classList.remove('hidden');
                emptyState.classList.add('hidden');
                resultContainer.classList.add('hidden');
                
                // Simulate processing with progress updates
                let progress = 0;
                const interval = setInterval(() => {
                    progress += Math.random() * 10;
                    if (progress > 100) progress = 100;
                    
                    progressBar.style.width = `${progress}%`;
                    progressText.textContent = `${Math.round(progress)}% complete`;
                    
                    if (progress === 100) {
                        clearInterval(interval);
                        setTimeout(showResult, 500);
                    }
                }, 500);
            }
            
            function showResult() {
                processingState.classList.add('hidden');
                resultContainer.classList.remove('hidden');
                
                // Apply different filters based on selected style
                let filter = '';
                switch(selectedFilter) {
                    case 'hanna':
                        filter = 'sepia(0.5) saturate(2) hue-rotate(-10deg) contrast(1.2)';
                        break;
                    case 'flintstones':
                        filter = 'sepia(0.3) saturate(2.5) hue-rotate(20deg) contrast(1.1)';
                        break;
                    case 'jetsons':
                        filter = 'hue-rotate(200deg) saturate(2) brightness(1.1)';
                        break;
                    case 'uno':
                    default:
                        filter = 'contrast(1.1) brightness(1.05) saturate(1.5)';
                }
                
                // For demo purposes, we'll use the original image with CSS filters
                // In a real app, this would be the processed image from the API
                resultImage.src = imagePreview.src;
                resultImage.style.filter = filter;
            }
            
            function downloadImage() {
                const canvas = document.createElement('canvas');
                const ctx = canvas.getContext('2d');
                canvas.width = resultImage.naturalWidth;
                canvas.height = resultImage.naturalHeight;
                
                // Apply the same filter to the canvas
                ctx.filter = resultImage.style.filter;
                ctx.drawImage(resultImage, 0, 0, canvas.width, canvas.height);
                
                const a = document.createElement('a');
                a.href = canvas.toDataURL('image/jpeg');
                a.download = `cartoon-${selectedFilter}-${selectedFile.name.replace(/\.[^/.]+$/, '')}.jpg`;
                document.body.appendChild(a);
                a.click();
                document.body.removeChild(a);
            }
            
            // Demo: Auto-select the hanna filter
            setTimeout(() => {
                const hannaOption = document.querySelector('.filter-option[data-filter="hanna"]');
                hannaOption.click();
            }, 500);
        });
    </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=MarcRyan/rcvt" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html>