Chipema commited on
Commit
60d9994
·
verified ·
1 Parent(s): ab4df1e

Crie um fluxo onde:

Browse files

1. O usuário envia uma foto.


2. O sistema pergunta se deseja gerar um ambiente infantil ou adulto.


3. A IA transforma a foto em uma ilustração ou cena correspondente ao ambiente escolhido (ex.: estilo infantil lúdico ou estilo adulto elegante).


4. O sistema adiciona trechos de texto fornecidos pelo usuário (por exemplo, uma frase curta ou dedicatória) sobre a imagem final.


5. O resultado (imagem final com texto) deve ser disponibilizado em um link ou arquivo para download ou compartilhamento. - Initial Deployment

Files changed (3) hide show
  1. README.md +7 -5
  2. index.html +344 -18
  3. prompts.txt +15 -0
README.md CHANGED
@@ -1,10 +1,12 @@
1
  ---
2
- title: Transforme
3
- emoji: 🌍
4
- colorFrom: gray
5
- colorTo: gray
6
  sdk: static
7
  pinned: false
 
 
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
  ---
2
+ title: transforme
3
+ emoji: 🐳
4
+ colorFrom: blue
5
+ colorTo: yellow
6
  sdk: static
7
  pinned: false
8
+ tags:
9
+ - deepsite
10
  ---
11
 
12
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
index.html CHANGED
@@ -1,19 +1,345 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  </html>
 
1
+ <!DOCTYPE html>
2
+ <html lang="pt-BR">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Magic Scene Creator</title>
7
+ <script src="https://cdn.tailwindcss.com"></script>
8
+ <link href="https://unpkg.com/aos@2.3.1/dist/aos.css" rel="stylesheet">
9
+ <script src="https://unpkg.com/aos@2.3.1/dist/aos.js"></script>
10
+ <script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
11
+ <script src="https://unpkg.com/feather-icons"></script>
12
+ <style>
13
+ .file-input-label:hover .file-input-icon {
14
+ transform: translateY(-5px);
15
+ transition: all 0.3s ease;
16
+ }
17
+ .result-card {
18
+ box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
19
+ }
20
+ .animate-pulse-slow {
21
+ animation: pulse 3s cubic-bezier(0.4, 0, 0.6, 1) infinite;
22
+ }
23
+ @keyframes pulse {
24
+ 0%, 100% { opacity: 1; }
25
+ 50% { opacity: 0.5; }
26
+ }
27
+ </style>
28
+ </head>
29
+ <body class="bg-gradient-to-br from-indigo-50 to-purple-50 min-h-screen">
30
+ <div class="container mx-auto px-4 py-12">
31
+ <!-- Header -->
32
+ <header class="text-center mb-16" data-aos="fade-down">
33
+ <h1 class="text-4xl md:text-5xl font-bold text-indigo-900 mb-4">Magic Scene Creator</h1>
34
+ <p class="text-lg text-indigo-700 max-w-2xl mx-auto">Transforme suas fotos em ilustrações mágicas com um toque pessoal</p>
35
+ </header>
36
+
37
+ <!-- Main Flow -->
38
+ <div class="max-w-3xl mx-auto bg-white rounded-2xl shadow-xl overflow-hidden">
39
+ <!-- Step 1: Upload Photo -->
40
+ <div id="step-1" class="p-8" data-aos="fade-up">
41
+ <div class="flex items-center mb-6">
42
+ <div class="flex items-center justify-center w-10 h-10 rounded-full bg-indigo-600 text-white font-bold mr-4">1</div>
43
+ <h2 class="text-2xl font-semibold text-gray-800">Envie sua foto</h2>
44
+ </div>
45
+
46
+ <div class="mt-6">
47
+ <label for="photo-upload" class="file-input-label cursor-pointer flex flex-col items-center justify-center border-2 border-dashed border-indigo-300 rounded-xl p-12 text-center hover:border-indigo-400 transition-colors duration-300">
48
+ <div class="file-input-icon mb-4">
49
+ <i data-feather="upload" class="w-12 h-12 text-indigo-500"></i>
50
+ </div>
51
+ <span class="text-lg font-medium text-indigo-700 mb-2">Clique para selecionar uma foto</span>
52
+ <span class="text-sm text-gray-500">Formatos suportados: JPG, PNG (até 5MB)</span>
53
+ <input id="photo-upload" type="file" accept="image/*" class="hidden">
54
+ </label>
55
+ </div>
56
+
57
+ <div id="preview-container" class="mt-6 hidden">
58
+ <h3 class="text-lg font-medium text-gray-700 mb-3">Pré-visualização:</h3>
59
+ <div class="relative">
60
+ <img id="image-preview" src="" alt="Preview" class="rounded-lg w-full max-h-80 object-contain border border-gray-200">
61
+ <button id="change-photo" class="absolute top-2 right-2 bg-white rounded-full p-2 shadow-md hover:bg-gray-100">
62
+ <i data-feather="x" class="w-4 h-4 text-gray-600"></i>
63
+ </button>
64
+ </div>
65
+ </div>
66
+
67
+ <div class="mt-8 flex justify-end">
68
+ <button id="next-step-1" class="px-6 py-3 bg-indigo-600 text-white rounded-lg font-medium hover:bg-indigo-700 transition-colors duration-300 disabled:opacity-50 disabled:cursor-not-allowed" disabled>
69
+ Próximo <i data-feather="arrow-right" class="w-4 h-4 ml-2 inline"></i>
70
+ </button>
71
+ </div>
72
+ </div>
73
+
74
+ <!-- Step 2: Choose Style -->
75
+ <div id="step-2" class="p-8 border-t border-gray-200 hidden" data-aos="fade-up">
76
+ <div class="flex items-center mb-6">
77
+ <div class="flex items-center justify-center w-10 h-10 rounded-full bg-indigo-600 text-white font-bold mr-4">2</div>
78
+ <h2 class="text-2xl font-semibold text-gray-800">Escolha o estilo</h2>
79
+ </div>
80
+
81
+ <p class="text-gray-600 mb-8">Como você gostaria que sua foto fosse transformada?</p>
82
+
83
+ <div class="grid grid-cols-1 md:grid-cols-2 gap-6">
84
+ <div class="style-option cursor-pointer group relative overflow-hidden rounded-xl border-2 border-transparent hover:border-indigo-400 transition-all duration-300">
85
+ <input type="radio" name="style" id="childish" value="childish" class="hidden peer">
86
+ <label for="childish" class="block">
87
+ <div class="relative">
88
+ <img src="http://static.photos/education/640x360/1" alt="Estilo Infantil" class="w-full h-48 object-cover">
89
+ <div class="absolute inset-0 bg-gradient-to-t from-black/60 to-transparent"></div>
90
+ <div class="absolute bottom-0 left-0 p-4">
91
+ <h3 class="text-xl font-bold text-white">Infantil Lúdico</h3>
92
+ <p class="text-indigo-100">Cores vibrantes, elementos mágicos</p>
93
+ </div>
94
+ </div>
95
+ </label>
96
+ <div class="absolute top-4 right-4 w-6 h-6 rounded-full border-2 border-white bg-white peer-checked:bg-indigo-600 peer-checked:border-indigo-600 transition-colors duration-300"></div>
97
+ </div>
98
+
99
+ <div class="style-option cursor-pointer group relative overflow-hidden rounded-xl border-2 border-transparent hover:border-indigo-400 transition-all duration-300">
100
+ <input type="radio" name="style" id="elegant" value="elegant" class="hidden peer">
101
+ <label for="elegant" class="block">
102
+ <div class="relative">
103
+ <img src="http://static.photos/minimal/640x360/2" alt="Estilo Adulto" class="w-full h-48 object-cover">
104
+ <div class="absolute inset-0 bg-gradient-to-t from-black/60 to-transparent"></div>
105
+ <div class="absolute bottom-0 left-0 p-4">
106
+ <h3 class="text-xl font-bold text-white">Adulto Elegante</h3>
107
+ <p class="text-indigo-100">Linhas limpas, tons sofisticados</p>
108
+ </div>
109
+ </div>
110
+ </label>
111
+ <div class="absolute top-4 right-4 w-6 h-6 rounded-full border-2 border-white bg-white peer-checked:bg-indigo-600 peer-checked:border-indigo-600 transition-colors duration-300"></div>
112
+ </div>
113
+ </div>
114
+
115
+ <div class="mt-8 flex justify-between">
116
+ <button id="prev-step-2" class="px-6 py-3 bg-gray-200 text-gray-700 rounded-lg font-medium hover:bg-gray-300 transition-colors duration-300">
117
+ <i data-feather="arrow-left" class="w-4 h-4 mr-2 inline"></i> Voltar
118
+ </button>
119
+ <button id="next-step-2" class="px-6 py-3 bg-indigo-600 text-white rounded-lg font-medium hover:bg-indigo-700 transition-colors duration-300 disabled:opacity-50 disabled:cursor-not-allowed" disabled>
120
+ Próximo <i data-feather="arrow-right" class="w-4 h-4 ml-2 inline"></i>
121
+ </button>
122
+ </div>
123
+ </div>
124
+
125
+ <!-- Step 3: Add Text -->
126
+ <div id="step-3" class="p-8 border-t border-gray-200 hidden" data-aos="fade-up">
127
+ <div class="flex items-center mb-6">
128
+ <div class="flex items-center justify-center w-10 h-10 rounded-full bg-indigo-600 text-white font-bold mr-4">3</div>
129
+ <h2 class="text-2xl font-semibold text-gray-800">Adicione um texto</h2>
130
+ </div>
131
+
132
+ <p class="text-gray-600 mb-6">Insira uma frase ou dedicatória para aparecer na imagem final:</p>
133
+
134
+ <div class="mb-6">
135
+ <textarea id="custom-text" rows="3" class="w-full px-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 transition-all duration-300" placeholder="Ex: Feliz aniversário! Que seu dia seja mágico como essa ilustração"></textarea>
136
+ <p class="text-sm text-gray-500 mt-2">Máximo de 120 caracteres</p>
137
+ </div>
138
+
139
+ <div class="flex items-center mb-6">
140
+ <input type="checkbox" id="add-watermark" class="w-4 h-4 text-indigo-600 rounded focus:ring-indigo-500">
141
+ <label for="add-watermark" class="ml-2 text-gray-700">Adicionar marca d'água "Criado com Magic Scene"</label>
142
+ </div>
143
+
144
+ <div class="mt-8 flex justify-between">
145
+ <button id="prev-step-3" class="px-6 py-3 bg-gray-200 text-gray-700 rounded-lg font-medium hover:bg-gray-300 transition-colors duration-300">
146
+ <i data-feather="arrow-left" class="w-4 h-4 mr-2 inline"></i> Voltar
147
+ </button>
148
+ <button id="generate-btn" class="px-6 py-3 bg-gradient-to-r from-indigo-600 to-purple-600 text-white rounded-lg font-medium hover:from-indigo-700 hover:to-purple-700 transition-colors duration-300 flex items-center">
149
+ <span id="generate-text">Gerar Imagem</span>
150
+ <span id="generating-spinner" class="hidden ml-2">
151
+ <svg class="animate-spin h-5 w-5 text-white" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24">
152
+ <circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle>
153
+ <path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path>
154
+ </svg>
155
+ </span>
156
+ </button>
157
+ </div>
158
+ </div>
159
+ </div>
160
+
161
+ <!-- Result Section (hidden initially) -->
162
+ <div id="result-section" class="max-w-3xl mx-auto mt-12 hidden" data-aos="fade-up">
163
+ <div class="bg-white rounded-2xl shadow-xl overflow-hidden">
164
+ <div class="p-8">
165
+ <div class="flex items-center mb-6">
166
+ <div class="flex items-center justify-center w-10 h-10 rounded-full bg-green-600 text-white font-bold mr-4">
167
+ <i data-feather="check" class="w-5 h-5"></i>
168
+ </div>
169
+ <h2 class="text-2xl font-semibold text-gray-800">Sua imagem está pronta!</h2>
170
+ </div>
171
+
172
+ <div class="result-card bg-gray-50 rounded-xl p-6 mb-8">
173
+ <div class="relative">
174
+ <img id="final-image" src="" alt="Imagem Final" class="w-full rounded-lg border border-gray-200">
175
+ <div id="final-text-overlay" class="absolute bottom-0 left-0 right-0 p-4 text-center text-white font-medium text-shadow" style="text-shadow: 1px 1px 3px rgba(0,0,0,0.8);"></div>
176
+ </div>
177
+ </div>
178
+
179
+ <div class="flex flex-col sm:flex-row gap-4 justify-center">
180
+ <button id="download-btn" class="px-6 py-3 bg-green-600 text-white rounded-lg font-medium hover:bg-green-700 transition-colors duration-300 flex items-center justify-center">
181
+ <i data-feather="download" class="w-4 h-4 mr-2"></i> Baixar Imagem
182
+ </button>
183
+ <button id="share-btn" class="px-6 py-3 bg-blue-600 text-white rounded-lg font-medium hover:bg-blue-700 transition-colors duration-300 flex items-center justify-center">
184
+ <i data-feather="share-2" class="w-4 h-4 mr-2"></i> Compartilhar
185
+ </button>
186
+ <button id="new-creation-btn" class="px-6 py-3 bg-indigo-600 text-white rounded-lg font-medium hover:bg-indigo-700 transition-colors duration-300 flex items-center justify-center">
187
+ <i data-feather="plus" class="w-4 h-4 mr-2"></i> Nova Criação
188
+ </button>
189
+ </div>
190
+ </div>
191
+ </div>
192
+ </div>
193
+ </div>
194
+
195
+ <script>
196
+ document.addEventListener('DOMContentLoaded', function() {
197
+ // Initialize AOS and Feather Icons
198
+ AOS.init({
199
+ duration: 800,
200
+ once: true
201
+ });
202
+ feather.replace();
203
+
204
+ // DOM Elements
205
+ const photoUpload = document.getElementById('photo-upload');
206
+ const previewContainer = document.getElementById('preview-container');
207
+ const imagePreview = document.getElementById('image-preview');
208
+ const changePhotoBtn = document.getElementById('change-photo');
209
+ const nextStep1Btn = document.getElementById('next-step-1');
210
+ const step1 = document.getElementById('step-1');
211
+ const step2 = document.getElementById('step-2');
212
+ const step3 = document.getElementById('step-3');
213
+ const prevStep2Btn = document.getElementById('prev-step-2');
214
+ const nextStep2Btn = document.getElementById('next-step-2');
215
+ const prevStep3Btn = document.getElementById('prev-step-3');
216
+ const generateBtn = document.getElementById('generate-btn');
217
+ const generateText = document.getElementById('generate-text');
218
+ const generatingSpinner = document.getElementById('generating-spinner');
219
+ const resultSection = document.getElementById('result-section');
220
+ const finalImage = document.getElementById('final-image');
221
+ const finalTextOverlay = document.getElementById('final-text-overlay');
222
+ const downloadBtn = document.getElementById('download-btn');
223
+ const shareBtn = document.getElementById('share-btn');
224
+ const newCreationBtn = document.getElementById('new-creation-btn');
225
+ const customText = document.getElementById('custom-text');
226
+
227
+ // Variables to store user selections
228
+ let uploadedImage = null;
229
+ let selectedStyle = null;
230
+
231
+ // Event Listeners
232
+ photoUpload.addEventListener('change', function(e) {
233
+ if (e.target.files && e.target.files[0]) {
234
+ const reader = new FileReader();
235
+ reader.onload = function(event) {
236
+ imagePreview.src = event.target.result;
237
+ previewContainer.classList.remove('hidden');
238
+ uploadedImage = event.target.result;
239
+ nextStep1Btn.disabled = false;
240
+ };
241
+ reader.readAsDataURL(e.target.files[0]);
242
+ }
243
+ });
244
+
245
+ changePhotoBtn.addEventListener('click', function() {
246
+ photoUpload.value = '';
247
+ previewContainer.classList.add('hidden');
248
+ nextStep1Btn.disabled = true;
249
+ uploadedImage = null;
250
+ });
251
+
252
+ nextStep1Btn.addEventListener('click', function() {
253
+ step1.classList.add('hidden');
254
+ step2.classList.remove('hidden');
255
+ window.scrollTo({ top: 0, behavior: 'smooth' });
256
+ });
257
+
258
+ document.querySelectorAll('input[name="style"]').forEach(radio => {
259
+ radio.addEventListener('change', function() {
260
+ selectedStyle = this.value;
261
+ nextStep2Btn.disabled = false;
262
+ });
263
+ });
264
+
265
+ prevStep2Btn.addEventListener('click', function() {
266
+ step2.classList.add('hidden');
267
+ step1.classList.remove('hidden');
268
+ window.scrollTo({ top: 0, behavior: 'smooth' });
269
+ });
270
+
271
+ nextStep2Btn.addEventListener('click', function() {
272
+ step2.classList.add('hidden');
273
+ step3.classList.remove('hidden');
274
+ window.scrollTo({ top: 0, behavior: 'smooth' });
275
+ });
276
+
277
+ prevStep3Btn.addEventListener('click', function() {
278
+ step3.classList.add('hidden');
279
+ step2.classList.remove('hidden');
280
+ window.scrollTo({ top: 0, behavior: 'smooth' });
281
+ });
282
+
283
+ generateBtn.addEventListener('click', function() {
284
+ // Simulate processing
285
+ generateText.classList.add('hidden');
286
+ generatingSpinner.classList.remove('hidden');
287
+ generateBtn.disabled = true;
288
+
289
+ // In a real app, this would call an API to process the image
290
+ setTimeout(() => {
291
+ // For demo purposes, we'll just use the uploaded image with some text
292
+ finalImage.src = uploadedImage;
293
+ finalTextOverlay.textContent = customText.value || '';
294
+
295
+ // Show result
296
+ step3.classList.add('hidden');
297
+ resultSection.classList.remove('hidden');
298
+ generateText.classList.remove('hidden');
299
+ generatingSpinner.classList.add('hidden');
300
+ generateBtn.disabled = false;
301
+
302
+ window.scrollTo({ top: 0, behavior: 'smooth' });
303
+ }, 2000);
304
+ });
305
+
306
+ downloadBtn.addEventListener('click', function() {
307
+ // In a real app, this would download the processed image
308
+ alert('Download iniciado! (simulação)');
309
+ });
310
+
311
+ shareBtn.addEventListener('click', function() {
312
+ // In a real app, this would implement sharing functionality
313
+ alert('Compartilhando... (simulação)');
314
+ });
315
+
316
+ newCreationBtn.addEventListener('click', function() {
317
+ // Reset the flow
318
+ photoUpload.value = '';
319
+ previewContainer.classList.add('hidden');
320
+ nextStep1Btn.disabled = true;
321
+ uploadedImage = null;
322
+ document.querySelector('input[name="style"]:checked')?.checked = false;
323
+ selectedStyle = null;
324
+ nextStep2Btn.disabled = true;
325
+ customText.value = '';
326
+ document.getElementById('add-watermark').checked = false;
327
+ resultSection.classList.add('hidden');
328
+ step1.classList.remove('hidden');
329
+
330
+ window.scrollTo({ top: 0, behavior: 'smooth' });
331
+ });
332
+
333
+ // Character counter for text input
334
+ customText.addEventListener('input', function() {
335
+ const maxLength = 120;
336
+ const currentLength = this.value.length;
337
+
338
+ if (currentLength > maxLength) {
339
+ this.value = this.value.substring(0, maxLength);
340
+ }
341
+ });
342
+ });
343
+ </script>
344
+ </body>
345
  </html>
prompts.txt ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Crie um fluxo onde:
2
+
3
+ 1. O usuário envia uma foto.
4
+
5
+
6
+ 2. O sistema pergunta se deseja gerar um ambiente infantil ou adulto.
7
+
8
+
9
+ 3. A IA transforma a foto em uma ilustração ou cena correspondente ao ambiente escolhido (ex.: estilo infantil lúdico ou estilo adulto elegante).
10
+
11
+
12
+ 4. O sistema adiciona trechos de texto fornecidos pelo usuário (por exemplo, uma frase curta ou dedicatória) sobre a imagem final.
13
+
14
+
15
+ 5. O resultado (imagem final com texto) deve ser disponibilizado em um link ou arquivo para download ou compartilhamento.