Update app.py
Browse files
app.py
CHANGED
|
@@ -5,301 +5,211 @@ import base64
|
|
| 5 |
from PIL import Image
|
| 6 |
import io
|
| 7 |
|
| 8 |
-
#
|
|
|
|
|
|
|
| 9 |
GOOGLE_API_KEY = os.environ.get("GOOGLE_API_KEY")
|
| 10 |
|
| 11 |
if GOOGLE_API_KEY:
|
| 12 |
genai.configure(api_key=GOOGLE_API_KEY)
|
| 13 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
def generate_image(prompt, negative_prompt, aspect_ratio):
|
| 15 |
-
"""
|
| 16 |
-
Gera imagem usando Nano Banana Pro (Gemini 3 Pro Image)
|
| 17 |
-
"""
|
| 18 |
if not GOOGLE_API_KEY:
|
| 19 |
-
return None, "❌ API Key do Google não configurada
|
| 20 |
-
|
| 21 |
try:
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
# Construir prompt completo
|
| 26 |
full_prompt = prompt
|
| 27 |
-
|
| 28 |
if negative_prompt:
|
| 29 |
full_prompt += f"\n\nEvitar: {negative_prompt}"
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
# Configuração de geração
|
| 35 |
generation_config = {
|
| 36 |
"temperature": 0.4,
|
| 37 |
"top_p": 0.95,
|
| 38 |
"top_k": 40,
|
| 39 |
}
|
| 40 |
-
|
| 41 |
-
# Gerar imagem
|
| 42 |
response = model.generate_content(
|
| 43 |
[full_prompt],
|
| 44 |
generation_config=generation_config
|
| 45 |
)
|
| 46 |
-
|
| 47 |
-
# Processar resposta
|
| 48 |
if response.parts:
|
| 49 |
for part in response.parts:
|
| 50 |
-
if hasattr(part,
|
| 51 |
-
# Decodificar imagem base64
|
| 52 |
image_data = base64.b64decode(part.inline_data.data)
|
| 53 |
image = Image.open(io.BytesIO(image_data))
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
return image, success_msg
|
| 65 |
-
|
| 66 |
return None, "❌ Não foi possível gerar a imagem. Tente novamente."
|
| 67 |
-
|
| 68 |
except Exception as e:
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
# Exemplos de prompts
|
| 77 |
examples = [
|
| 78 |
[
|
| 79 |
-
"A stunning portrait of a woman with flowing red hair, golden hour lighting, professional photography, bokeh background, 8k ultra detailed
|
| 80 |
-
"blurry, low quality, distorted, ugly, deformed
|
| 81 |
"1:1 (Instagram)"
|
| 82 |
],
|
| 83 |
[
|
| 84 |
-
"Futuristic cyberpunk cityscape at night, neon
|
| 85 |
-
"
|
| 86 |
"16:9 (Paisagem)"
|
| 87 |
],
|
| 88 |
[
|
| 89 |
-
"Ancient mystical forest
|
| 90 |
-
"
|
| 91 |
"4:5 (Retrato)"
|
| 92 |
],
|
| 93 |
-
[
|
| 94 |
-
"Modern luxury living room interior, minimalist Scandinavian design, floor-to-ceiling windows, natural lighting, architectural photography, 8k, ultra realistic, clean lines, warm tones",
|
| 95 |
-
"cluttered, dark, low quality, messy, old furniture, baroque style",
|
| 96 |
-
"16:9 (Paisagem)"
|
| 97 |
-
]
|
| 98 |
]
|
| 99 |
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
text-align: center;
|
| 108 |
-
font-size: 2.5em;
|
| 109 |
-
font-weight: 800;
|
| 110 |
-
margin-bottom: 0.3em;
|
| 111 |
-
background: linear-gradient(135deg, #39FF14 0%, #00CC11 100%);
|
| 112 |
-
-webkit-background-clip: text;
|
| 113 |
-
-webkit-text-fill-color: transparent;
|
| 114 |
-
letter-spacing: -0.02em;
|
| 115 |
-
}
|
| 116 |
-
.subtitle {
|
| 117 |
-
text-align: center;
|
| 118 |
-
font-size: 1.1em;
|
| 119 |
-
color: #6b7280;
|
| 120 |
-
margin-bottom: 2em;
|
| 121 |
-
}
|
| 122 |
-
.dot-indicator {
|
| 123 |
-
display: inline-block;
|
| 124 |
-
width: 8px;
|
| 125 |
-
height: 8px;
|
| 126 |
-
background: #39FF14;
|
| 127 |
-
border-radius: 50%;
|
| 128 |
-
margin-right: 6px;
|
| 129 |
-
animation: pulse 2s ease-in-out infinite;
|
| 130 |
-
}
|
| 131 |
-
@keyframes pulse {
|
| 132 |
-
0%, 100% { opacity: 1; }
|
| 133 |
-
50% { opacity: 0.5; }
|
| 134 |
-
}
|
| 135 |
-
"""
|
| 136 |
-
) as demo:
|
| 137 |
-
|
| 138 |
-
# Header
|
| 139 |
gr.HTML("""
|
| 140 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 141 |
<h1 class="title">🎨 Gerador Ultra-Realista de Imagens</h1>
|
| 142 |
<p class="subtitle">
|
| 143 |
<span class="dot-indicator"></span>
|
| 144 |
-
Powered by Nano Banana Pro
|
| 145 |
</p>
|
| 146 |
</div>
|
| 147 |
""")
|
| 148 |
-
|
|
|
|
| 149 |
with gr.Row():
|
| 150 |
-
|
|
|
|
| 151 |
gr.Markdown("## ⚙️ Configurações")
|
| 152 |
-
|
| 153 |
prompt = gr.Textbox(
|
| 154 |
-
label="📝
|
| 155 |
-
placeholder="Ex:
|
| 156 |
-
lines=5
|
| 157 |
-
info="Seja o mais detalhado possível. Descreva iluminação, cores, texturas, estilo."
|
| 158 |
)
|
| 159 |
-
|
| 160 |
negative_prompt = gr.Textbox(
|
| 161 |
-
label="🚫
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
lines=3,
|
| 165 |
-
info="Liste elementos que você NÃO quer ver na imagem"
|
| 166 |
)
|
| 167 |
-
|
| 168 |
aspect_ratio = gr.Dropdown(
|
| 169 |
-
label="📐 Formato
|
| 170 |
-
choices=[
|
| 171 |
-
|
| 172 |
-
"4:5 (Retrato)",
|
| 173 |
-
"16:9 (Paisagem)",
|
| 174 |
-
"9:16 (Stories)"
|
| 175 |
-
],
|
| 176 |
-
value="1:1 (Instagram)",
|
| 177 |
-
info="Escolha o formato ideal para sua necessidade"
|
| 178 |
-
)
|
| 179 |
-
|
| 180 |
-
generate_btn = gr.Button(
|
| 181 |
-
"✨ Gerar Imagem Ultra-Realista",
|
| 182 |
-
variant="primary",
|
| 183 |
-
size="lg"
|
| 184 |
)
|
| 185 |
-
|
| 186 |
-
gr.
|
| 187 |
-
|
| 188 |
-
|
| 189 |
-
|
| 190 |
-
- 🎯 **Texto em imagens:** Logos, pôsteres, diagramas com texto legível
|
| 191 |
-
- 🌍 **Conhecimento do mundo:** Usa Google Search para precisão factual
|
| 192 |
-
- 🎨 **Composição avançada:** Até 14 imagens de referência
|
| 193 |
-
- 📐 **Alta resolução:** Até 4K nativo
|
| 194 |
-
|
| 195 |
-
**Estrutura ideal do prompt:**
|
| 196 |
-
1. Descrição do assunto principal
|
| 197 |
-
2. Estilo de fotografia/arte
|
| 198 |
-
3. Iluminação e atmosfera
|
| 199 |
-
4. Qualidade técnica (8k, ultra detailed)
|
| 200 |
-
5. Detalhes específicos
|
| 201 |
-
|
| 202 |
-
**Exemplo:**
|
| 203 |
-
"Professional portrait, golden hour lighting, bokeh background, 8k, cinematic composition"
|
| 204 |
-
""")
|
| 205 |
-
|
| 206 |
-
with gr.Column(scale=1):
|
| 207 |
gr.Markdown("## 🖼️ Resultado")
|
| 208 |
-
|
| 209 |
output_image = gr.Image(
|
| 210 |
-
label="Imagem
|
| 211 |
type="pil",
|
| 212 |
-
height=600
|
| 213 |
-
show_label=True
|
| 214 |
)
|
| 215 |
-
|
| 216 |
output_text = gr.Textbox(
|
| 217 |
-
label="Status
|
| 218 |
lines=5,
|
| 219 |
-
interactive=False
|
| 220 |
-
show_label=True
|
| 221 |
)
|
| 222 |
-
|
| 223 |
-
|
| 224 |
-
<div style="background: #f0fdf4; border: 1px solid #86efac; border-radius: 8px; padding: 12px; margin-top: 12px;">
|
| 225 |
-
<strong>🚀 Nano Banana Pro Features:</strong><br>
|
| 226 |
-
• Texto legível em múltiplas línguas<br>
|
| 227 |
-
• Search grounding para precisão factual<br>
|
| 228 |
-
• Resolução até 4K<br>
|
| 229 |
-
• Watermark SynthID incluído<br>
|
| 230 |
-
• Pensamento iterativo para melhor composição
|
| 231 |
-
</div>
|
| 232 |
-
""")
|
| 233 |
-
|
| 234 |
-
# Exemplos
|
| 235 |
gr.Markdown("---")
|
| 236 |
-
gr.Markdown("## 📚 Exemplos
|
| 237 |
-
gr.Markdown("*Clique em um exemplo para carregar as configurações*")
|
| 238 |
-
|
| 239 |
gr.Examples(
|
| 240 |
examples=examples,
|
| 241 |
-
inputs=[prompt, negative_prompt, aspect_ratio]
|
| 242 |
-
label="Exemplos testados e aprovados"
|
| 243 |
)
|
| 244 |
-
|
| 245 |
-
#
|
| 246 |
-
gr.Markdown("---")
|
| 247 |
-
gr.Markdown("## 🎯 Casos de Uso do Nano Banana Pro")
|
| 248 |
-
|
| 249 |
-
with gr.Row():
|
| 250 |
-
with gr.Column():
|
| 251 |
-
gr.Markdown("""
|
| 252 |
-
### 🎨 Design & Marketing
|
| 253 |
-
- Pôsteres com texto legível
|
| 254 |
-
- Campanhas multilíngues
|
| 255 |
-
- Mockups de produtos
|
| 256 |
-
- Identidade visual consistente
|
| 257 |
-
""")
|
| 258 |
-
|
| 259 |
-
with gr.Column():
|
| 260 |
-
gr.Markdown("""
|
| 261 |
-
### 📊 Informação & Educação
|
| 262 |
-
- Infográficos precisos
|
| 263 |
-
- Diagramas técnicos
|
| 264 |
-
- Material didático
|
| 265 |
-
- Visualização de dados
|
| 266 |
-
""")
|
| 267 |
-
|
| 268 |
-
with gr.Column():
|
| 269 |
-
gr.Markdown("""
|
| 270 |
-
### 🎬 Criativo & Arte
|
| 271 |
-
- Storyboards
|
| 272 |
-
- Concept art
|
| 273 |
-
- Character design
|
| 274 |
-
- Edição de imagens
|
| 275 |
-
""")
|
| 276 |
-
|
| 277 |
-
# Footer
|
| 278 |
gr.HTML("""
|
| 279 |
-
<div style="text-align:
|
| 280 |
-
<div style="display:
|
| 281 |
-
<span style="width:
|
| 282 |
-
<strong
|
| 283 |
</div>
|
| 284 |
-
<p style="color
|
| 285 |
-
|
| 286 |
-
</p>
|
| 287 |
-
<p style="color: #9ca3af; font-size: 12px; margin-top: 8px;">
|
| 288 |
-
Powered by Nano Banana Pro (Gemini 3 Pro Image)
|
| 289 |
-
</p>
|
| 290 |
-
<p style="color: #9ca3af; font-size: 11px; margin-top: 12px;">
|
| 291 |
-
© 2024 Leicam. Todos os direitos reservados.
|
| 292 |
-
</p>
|
| 293 |
</div>
|
| 294 |
""")
|
| 295 |
-
|
| 296 |
-
#
|
| 297 |
generate_btn.click(
|
| 298 |
fn=generate_image,
|
| 299 |
inputs=[prompt, negative_prompt, aspect_ratio],
|
| 300 |
outputs=[output_image, output_text]
|
| 301 |
)
|
| 302 |
|
| 303 |
-
|
|
|
|
| 304 |
if __name__ == "__main__":
|
| 305 |
-
demo.launch()
|
|
|
|
| 5 |
from PIL import Image
|
| 6 |
import io
|
| 7 |
|
| 8 |
+
# ==========================
|
| 9 |
+
# CONFIG GOOGLE API KEY
|
| 10 |
+
# ==========================
|
| 11 |
GOOGLE_API_KEY = os.environ.get("GOOGLE_API_KEY")
|
| 12 |
|
| 13 |
if GOOGLE_API_KEY:
|
| 14 |
genai.configure(api_key=GOOGLE_API_KEY)
|
| 15 |
|
| 16 |
+
|
| 17 |
+
# ==========================
|
| 18 |
+
# FUNÇÃO DE GERAÇÃO
|
| 19 |
+
# ==========================
|
| 20 |
def generate_image(prompt, negative_prompt, aspect_ratio):
|
|
|
|
|
|
|
|
|
|
| 21 |
if not GOOGLE_API_KEY:
|
| 22 |
+
return None, "❌ API Key do Google não configurada no HuggingFace Spaces."
|
| 23 |
+
|
| 24 |
try:
|
| 25 |
+
model = genai.GenerativeModel("gemini-3-pro-image-preview")
|
| 26 |
+
|
|
|
|
|
|
|
| 27 |
full_prompt = prompt
|
|
|
|
| 28 |
if negative_prompt:
|
| 29 |
full_prompt += f"\n\nEvitar: {negative_prompt}"
|
| 30 |
+
|
| 31 |
+
full_prompt += "\n\nEstilo: fotografia profissional, ultrarrealista, 8k, luz natural suave, textura rica, depth of field."
|
| 32 |
+
|
|
|
|
|
|
|
| 33 |
generation_config = {
|
| 34 |
"temperature": 0.4,
|
| 35 |
"top_p": 0.95,
|
| 36 |
"top_k": 40,
|
| 37 |
}
|
| 38 |
+
|
|
|
|
| 39 |
response = model.generate_content(
|
| 40 |
[full_prompt],
|
| 41 |
generation_config=generation_config
|
| 42 |
)
|
| 43 |
+
|
|
|
|
| 44 |
if response.parts:
|
| 45 |
for part in response.parts:
|
| 46 |
+
if hasattr(part, "inline_data") and part.inline_data:
|
|
|
|
| 47 |
image_data = base64.b64decode(part.inline_data.data)
|
| 48 |
image = Image.open(io.BytesIO(image_data))
|
| 49 |
+
|
| 50 |
+
msg = f"""
|
| 51 |
+
✅ Imagem gerada com sucesso!
|
| 52 |
+
|
| 53 |
+
**Modelo:** Gemini 3 Pro Image (Nano Banana Pro)
|
| 54 |
+
**Formato:** {aspect_ratio}
|
| 55 |
+
**Prompt:** {prompt[:150]}...
|
| 56 |
+
"""
|
| 57 |
+
return image, msg
|
| 58 |
+
|
|
|
|
|
|
|
| 59 |
return None, "❌ Não foi possível gerar a imagem. Tente novamente."
|
| 60 |
+
|
| 61 |
except Exception as e:
|
| 62 |
+
return None, f"❌ Erro: {str(e)}"
|
| 63 |
+
|
| 64 |
+
|
| 65 |
+
# ==========================
|
| 66 |
+
# EXEMPLOS
|
| 67 |
+
# ==========================
|
|
|
|
|
|
|
| 68 |
examples = [
|
| 69 |
[
|
| 70 |
+
"A stunning portrait of a woman with flowing red hair, golden hour lighting, professional photography, bokeh background, 8k ultra detailed",
|
| 71 |
+
"blurry, low quality, distorted, ugly, deformed",
|
| 72 |
"1:1 (Instagram)"
|
| 73 |
],
|
| 74 |
[
|
| 75 |
+
"Futuristic cyberpunk cityscape at night, neon reflections, flying cars, Blade Runner style, rain, cinematic, ultrarealistic",
|
| 76 |
+
"low quality, cartoon, daytime",
|
| 77 |
"16:9 (Paisagem)"
|
| 78 |
],
|
| 79 |
[
|
| 80 |
+
"Ancient mystical forest, rays of god light, moss stones, fog, ethereal atmosphere, photorealistic",
|
| 81 |
+
"urban, people, cars, artificial",
|
| 82 |
"4:5 (Retrato)"
|
| 83 |
],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 84 |
]
|
| 85 |
|
| 86 |
+
|
| 87 |
+
# ==========================
|
| 88 |
+
# INTERFACE GRADIO
|
| 89 |
+
# ==========================
|
| 90 |
+
with gr.Blocks() as demo:
|
| 91 |
+
|
| 92 |
+
# CSS CUSTOMIZADO
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 93 |
gr.HTML("""
|
| 94 |
+
<style>
|
| 95 |
+
|
| 96 |
+
.gradio-container {
|
| 97 |
+
font-family: 'Inter','Manrope',sans-serif;
|
| 98 |
+
}
|
| 99 |
+
|
| 100 |
+
.title {
|
| 101 |
+
text-align: center;
|
| 102 |
+
font-size: 2.6em;
|
| 103 |
+
font-weight: 800;
|
| 104 |
+
margin-bottom: 0.3em;
|
| 105 |
+
background: linear-gradient(135deg,#39FF14 0%,#00CC11 100%);
|
| 106 |
+
-webkit-background-clip: text;
|
| 107 |
+
-webkit-text-fill-color: transparent;
|
| 108 |
+
letter-spacing:-0.02em;
|
| 109 |
+
}
|
| 110 |
+
|
| 111 |
+
.subtitle {
|
| 112 |
+
text-align: center;
|
| 113 |
+
font-size: 1.1em;
|
| 114 |
+
color:#6b7280;
|
| 115 |
+
margin-bottom: 2em;
|
| 116 |
+
}
|
| 117 |
+
|
| 118 |
+
.dot-indicator {
|
| 119 |
+
display:inline-block;width:10px;height:10px;background:#39FF14;
|
| 120 |
+
border-radius:50%;margin-right:6px;
|
| 121 |
+
animation:pulse 2s infinite;
|
| 122 |
+
}
|
| 123 |
+
|
| 124 |
+
@keyframes pulse {
|
| 125 |
+
0%,100% {opacity:1;}
|
| 126 |
+
50% {opacity:0.4;}
|
| 127 |
+
}
|
| 128 |
+
|
| 129 |
+
</style>
|
| 130 |
+
""")
|
| 131 |
+
|
| 132 |
+
# HEADER
|
| 133 |
+
gr.HTML("""
|
| 134 |
+
<div style="text-align:center;margin-bottom:30px;">
|
| 135 |
<h1 class="title">🎨 Gerador Ultra-Realista de Imagens</h1>
|
| 136 |
<p class="subtitle">
|
| 137 |
<span class="dot-indicator"></span>
|
| 138 |
+
Powered by Nano Banana Pro • Leicam Tech
|
| 139 |
</p>
|
| 140 |
</div>
|
| 141 |
""")
|
| 142 |
+
|
| 143 |
+
# LAYOUT PRINCIPAL
|
| 144 |
with gr.Row():
|
| 145 |
+
# COLUNA ESQUERDA
|
| 146 |
+
with gr.Column():
|
| 147 |
gr.Markdown("## ⚙️ Configurações")
|
| 148 |
+
|
| 149 |
prompt = gr.Textbox(
|
| 150 |
+
label="📝 Prompt (descrição da imagem)",
|
| 151 |
+
placeholder="Ex: retrato cinematográfico, luz natural, pele realista, 85mm, fundo desfocado...",
|
| 152 |
+
lines=5
|
|
|
|
| 153 |
)
|
| 154 |
+
|
| 155 |
negative_prompt = gr.Textbox(
|
| 156 |
+
label="🚫 O que evitar (Negative Prompt)",
|
| 157 |
+
value="blurry, low quality, distorted, deformed, ugly",
|
| 158 |
+
lines=3
|
|
|
|
|
|
|
| 159 |
)
|
| 160 |
+
|
| 161 |
aspect_ratio = gr.Dropdown(
|
| 162 |
+
label="📐 Formato",
|
| 163 |
+
choices=["1:1 (Instagram)", "4:5 (Retrato)", "16:9 (Paisagem)", "9:16 (Stories)"],
|
| 164 |
+
value="1:1 (Instagram)"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 165 |
)
|
| 166 |
+
|
| 167 |
+
generate_btn = gr.Button("✨ Gerar Imagem Ultra-Realista", variant="primary")
|
| 168 |
+
|
| 169 |
+
# COLUNA DIREITA
|
| 170 |
+
with gr.Column():
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 171 |
gr.Markdown("## 🖼️ Resultado")
|
| 172 |
+
|
| 173 |
output_image = gr.Image(
|
| 174 |
+
label="Imagem gerada",
|
| 175 |
type="pil",
|
| 176 |
+
height=600
|
|
|
|
| 177 |
)
|
| 178 |
+
|
| 179 |
output_text = gr.Textbox(
|
| 180 |
+
label="Status",
|
| 181 |
lines=5,
|
| 182 |
+
interactive=False
|
|
|
|
| 183 |
)
|
| 184 |
+
|
| 185 |
+
# EXEMPLOS
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 186 |
gr.Markdown("---")
|
| 187 |
+
gr.Markdown("## 📚 Exemplos prontos")
|
|
|
|
|
|
|
| 188 |
gr.Examples(
|
| 189 |
examples=examples,
|
| 190 |
+
inputs=[prompt, negative_prompt, aspect_ratio]
|
|
|
|
| 191 |
)
|
| 192 |
+
|
| 193 |
+
# FOOTER
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 194 |
gr.HTML("""
|
| 195 |
+
<div style="text-align:center;margin-top:50px;padding:20px;border-top:1px solid #e5e7eb;">
|
| 196 |
+
<div style="display:flex;align-items:center;gap:8px;justify-content:center;">
|
| 197 |
+
<span style="width:12px;height:12px;background:#39FF14;border-radius:50%;"></span>
|
| 198 |
+
<strong>Leicam · Tech</strong>
|
| 199 |
</div>
|
| 200 |
+
<p style="color:#6b7280;font-size:14px;margin:8px 0;">Ferramentas práticas para criar mais e melhor</p>
|
| 201 |
+
<p style="color:#9ca3af;font-size:12px;">© 2025 Leicam. Todos os direitos reservados.</p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 202 |
</div>
|
| 203 |
""")
|
| 204 |
+
|
| 205 |
+
# EVENTO DO BOTÃO
|
| 206 |
generate_btn.click(
|
| 207 |
fn=generate_image,
|
| 208 |
inputs=[prompt, negative_prompt, aspect_ratio],
|
| 209 |
outputs=[output_image, output_text]
|
| 210 |
)
|
| 211 |
|
| 212 |
+
|
| 213 |
+
# RODAR
|
| 214 |
if __name__ == "__main__":
|
| 215 |
+
demo.launch()
|