Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -59,336 +59,329 @@ examples = [
|
|
| 59 |
]
|
| 60 |
|
| 61 |
css = """
|
| 62 |
-
/*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 63 |
#col-container {
|
| 64 |
margin: 0 auto;
|
| 65 |
max-width: 900px;
|
| 66 |
-
padding: 20px;
|
| 67 |
-
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
| 68 |
-
border-radius: 20px;
|
| 69 |
-
box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
|
| 70 |
-
backdrop-filter: blur(10px);
|
| 71 |
-
}
|
| 72 |
-
|
| 73 |
-
/* Global styling */
|
| 74 |
-
.gradio-container {
|
| 75 |
-
background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
|
| 76 |
-
font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
|
| 77 |
-
min-height: 100vh;
|
| 78 |
-
padding: 20px;
|
| 79 |
}
|
| 80 |
|
| 81 |
/* Title styling */
|
| 82 |
.gradio-container h1 {
|
| 83 |
-
text-
|
| 84 |
-
|
| 85 |
-
-
|
| 86 |
-
-webkit-text-fill-color: transparent;
|
| 87 |
-
background-clip: text;
|
| 88 |
-
font-size: 2.5rem;
|
| 89 |
-
font-weight: 800;
|
| 90 |
margin-bottom: 30px;
|
| 91 |
-
text-
|
|
|
|
| 92 |
}
|
| 93 |
|
| 94 |
-
/*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 95 |
.gradio-container .gradio-textbox input,
|
| 96 |
-
.gradio-container .gradio-textbox textarea
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
}
|
| 106 |
|
| 107 |
.gradio-container .gradio-textbox input:focus,
|
| 108 |
.gradio-container .gradio-textbox textarea:focus {
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 125 |
cursor: pointer;
|
| 126 |
-
transition: all 0.
|
| 127 |
-
box-shadow:
|
| 128 |
-
text-transform: uppercase;
|
| 129 |
-
letter-spacing: 1px;
|
| 130 |
}
|
| 131 |
|
| 132 |
-
.gradio-container button:hover
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
}
|
| 137 |
|
| 138 |
.gradio-container button:active {
|
| 139 |
-
transform: translateY(
|
| 140 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 141 |
}
|
| 142 |
|
| 143 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 144 |
.gradio-container .gradio-image {
|
| 145 |
-
|
|
|
|
|
|
|
| 146 |
overflow: hidden;
|
| 147 |
-
box-shadow: 0
|
| 148 |
-
background: rgba(255, 255, 255, 0.9);
|
| 149 |
-
backdrop-filter: blur(10px);
|
| 150 |
-
border: 2px solid rgba(255, 255, 255, 0.3);
|
| 151 |
-
margin: 20px 0;
|
| 152 |
}
|
| 153 |
|
| 154 |
-
/* Accordion
|
| 155 |
.gradio-container .gradio-accordion {
|
| 156 |
-
background:
|
| 157 |
-
border
|
| 158 |
-
border:
|
| 159 |
-
backdrop-filter: blur(10px);
|
| 160 |
margin: 20px 0;
|
| 161 |
-
overflow: hidden;
|
| 162 |
}
|
| 163 |
|
| 164 |
.gradio-container .gradio-accordion summary {
|
| 165 |
-
background:
|
| 166 |
-
|
| 167 |
-
|
|
|
|
| 168 |
cursor: pointer;
|
| 169 |
-
|
| 170 |
-
border: none;
|
| 171 |
-
color: #2d3748;
|
| 172 |
}
|
| 173 |
|
| 174 |
.gradio-container .gradio-accordion[open] summary {
|
| 175 |
-
|
| 176 |
-
border-bottom: 1px solid rgba(255, 255, 255, 0.2);
|
| 177 |
}
|
| 178 |
|
| 179 |
-
|
| 180 |
-
|
|
|
|
| 181 |
}
|
| 182 |
|
| 183 |
-
/* Slider styling */
|
| 184 |
.gradio-container .gradio-slider input[type="range"] {
|
| 185 |
-webkit-appearance: none;
|
| 186 |
appearance: none;
|
| 187 |
-
height:
|
| 188 |
-
border-radius:
|
| 189 |
-
background:
|
| 190 |
outline: none;
|
| 191 |
-
cursor: pointer;
|
| 192 |
}
|
| 193 |
|
| 194 |
.gradio-container .gradio-slider input[type="range"]::-webkit-slider-thumb {
|
| 195 |
-webkit-appearance: none;
|
| 196 |
appearance: none;
|
| 197 |
-
width:
|
| 198 |
-
height:
|
| 199 |
border-radius: 50%;
|
| 200 |
-
background:
|
| 201 |
cursor: pointer;
|
| 202 |
-
|
| 203 |
-
transition: all 0.3s ease;
|
| 204 |
}
|
| 205 |
|
| 206 |
.gradio-container .gradio-slider input[type="range"]::-webkit-slider-thumb:hover {
|
| 207 |
-
transform: scale(1.
|
| 208 |
-
box-shadow: 0 4px
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 209 |
}
|
| 210 |
|
| 211 |
-
/*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 212 |
.gradio-container .gradio-checkbox input[type="checkbox"] {
|
| 213 |
-
width:
|
| 214 |
-
height:
|
| 215 |
border-radius: 4px;
|
| 216 |
-
border: 2px solid
|
| 217 |
-
background:
|
| 218 |
cursor: pointer;
|
| 219 |
-
transition: all 0.3s ease;
|
| 220 |
}
|
| 221 |
|
| 222 |
.gradio-container .gradio-checkbox input[type="checkbox"]:checked {
|
| 223 |
-
background:
|
| 224 |
-
border-color:
|
|
|
|
|
|
|
|
|
|
|
|
|
| 225 |
}
|
| 226 |
|
| 227 |
/* Examples section */
|
| 228 |
.gradio-container .gradio-examples {
|
| 229 |
-
background:
|
| 230 |
-
border
|
|
|
|
| 231 |
padding: 20px;
|
| 232 |
margin: 20px 0;
|
| 233 |
-
backdrop-filter: blur(10px);
|
| 234 |
-
border: 1px solid rgba(255, 255, 255, 0.2);
|
| 235 |
}
|
| 236 |
|
| 237 |
-
.gradio-container .gradio-examples .
|
| 238 |
-
|
| 239 |
-
|
|
|
|
| 240 |
}
|
| 241 |
|
| 242 |
-
|
| 243 |
-
|
| 244 |
-
|
| 245 |
-
color: #2d3748;
|
| 246 |
-
font-weight: 500;
|
| 247 |
-
text-transform: none;
|
| 248 |
-
letter-spacing: 0;
|
| 249 |
-
padding: 12px 18px;
|
| 250 |
}
|
| 251 |
|
| 252 |
-
|
| 253 |
-
|
| 254 |
-
|
|
|
|
|
|
|
| 255 |
}
|
| 256 |
|
| 257 |
-
|
| 258 |
-
|
| 259 |
-
font-weight: 600;
|
| 260 |
-
color: #2d3748;
|
| 261 |
-
margin-bottom: 8px;
|
| 262 |
-
display: block;
|
| 263 |
-
text-transform: uppercase;
|
| 264 |
-
letter-spacing: 0.5px;
|
| 265 |
-
font-size: 14px;
|
| 266 |
}
|
| 267 |
|
| 268 |
-
/*
|
| 269 |
-
.gradio-container .gradio-
|
| 270 |
-
|
|
|
|
|
|
|
|
|
|
| 271 |
}
|
| 272 |
|
| 273 |
-
/*
|
| 274 |
-
|
| 275 |
-
|
| 276 |
-
|
| 277 |
-
background: rgba(255, 255, 255, 0.2);
|
| 278 |
-
backdrop-filter: blur(10px);
|
| 279 |
}
|
| 280 |
|
| 281 |
-
|
| 282 |
-
background:
|
| 283 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 284 |
}
|
| 285 |
|
| 286 |
/* Responsive design */
|
| 287 |
@media (max-width: 768px) {
|
| 288 |
#col-container {
|
| 289 |
-
|
| 290 |
-
padding: 15px;
|
| 291 |
-
margin: 10px auto;
|
| 292 |
}
|
| 293 |
|
| 294 |
.gradio-container h1 {
|
| 295 |
-
font-size:
|
| 296 |
-
margin-bottom: 20px;
|
| 297 |
}
|
| 298 |
|
| 299 |
.gradio-container .gradio-row {
|
| 300 |
flex-direction: column;
|
| 301 |
-
gap: 15px;
|
| 302 |
-
}
|
| 303 |
-
|
| 304 |
-
.gradio-container button {
|
| 305 |
-
padding: 12px 20px;
|
| 306 |
-
font-size: 14px;
|
| 307 |
-
}
|
| 308 |
-
}
|
| 309 |
-
|
| 310 |
-
/* Animations */
|
| 311 |
-
@keyframes fadeInUp {
|
| 312 |
-
from {
|
| 313 |
-
opacity: 0;
|
| 314 |
-
transform: translateY(20px);
|
| 315 |
}
|
| 316 |
-
to {
|
| 317 |
-
opacity: 1;
|
| 318 |
-
transform: translateY(0);
|
| 319 |
-
}
|
| 320 |
-
}
|
| 321 |
-
|
| 322 |
-
.gradio-container > * {
|
| 323 |
-
animation: fadeInUp 0.6s ease forwards;
|
| 324 |
-
}
|
| 325 |
-
|
| 326 |
-
/* Loading state */
|
| 327 |
-
.gradio-container .loading {
|
| 328 |
-
position: relative;
|
| 329 |
-
overflow: hidden;
|
| 330 |
-
}
|
| 331 |
-
|
| 332 |
-
.gradio-container .loading::after {
|
| 333 |
-
content: '';
|
| 334 |
-
position: absolute;
|
| 335 |
-
top: 0;
|
| 336 |
-
left: -100%;
|
| 337 |
-
width: 100%;
|
| 338 |
-
height: 100%;
|
| 339 |
-
background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
|
| 340 |
-
animation: shimmer 1.5s infinite;
|
| 341 |
}
|
| 342 |
|
| 343 |
-
|
| 344 |
-
|
| 345 |
-
|
| 346 |
-
}
|
| 347 |
-
100% {
|
| 348 |
-
left: 100%;
|
| 349 |
-
}
|
| 350 |
}
|
| 351 |
"""
|
| 352 |
|
| 353 |
-
with gr.Blocks(css=css, title="AI Image Generator", theme=gr.themes.
|
| 354 |
with gr.Column(elem_id="col-container"):
|
| 355 |
-
gr.Markdown("#
|
| 356 |
|
| 357 |
with gr.Row():
|
| 358 |
prompt = gr.Text(
|
| 359 |
-
label="
|
| 360 |
show_label=True,
|
| 361 |
max_lines=1,
|
| 362 |
-
placeholder="Describe your
|
| 363 |
container=True,
|
| 364 |
scale=4
|
| 365 |
)
|
| 366 |
|
| 367 |
-
run_button = gr.Button("
|
| 368 |
|
| 369 |
-
result = gr.Image(label="
|
| 370 |
|
| 371 |
-
with gr.Accordion("
|
| 372 |
negative_prompt = gr.Text(
|
| 373 |
-
label="
|
| 374 |
max_lines=1,
|
| 375 |
-
placeholder="What
|
| 376 |
visible=True,
|
| 377 |
)
|
| 378 |
|
| 379 |
seed = gr.Slider(
|
| 380 |
-
label="
|
| 381 |
minimum=0,
|
| 382 |
maximum=MAX_SEED,
|
| 383 |
step=1,
|
| 384 |
value=0,
|
| 385 |
)
|
| 386 |
|
| 387 |
-
randomize_seed = gr.Checkbox(label="
|
| 388 |
|
| 389 |
with gr.Row():
|
| 390 |
width = gr.Slider(
|
| 391 |
-
label="
|
| 392 |
minimum=256,
|
| 393 |
maximum=MAX_IMAGE_SIZE,
|
| 394 |
step=32,
|
|
@@ -396,7 +389,7 @@ with gr.Blocks(css=css, title="AI Image Generator", theme=gr.themes.Soft()) as d
|
|
| 396 |
)
|
| 397 |
|
| 398 |
height = gr.Slider(
|
| 399 |
-
label="
|
| 400 |
minimum=256,
|
| 401 |
maximum=MAX_IMAGE_SIZE,
|
| 402 |
step=32,
|
|
@@ -405,25 +398,25 @@ with gr.Blocks(css=css, title="AI Image Generator", theme=gr.themes.Soft()) as d
|
|
| 405 |
|
| 406 |
with gr.Row():
|
| 407 |
guidance_scale = gr.Slider(
|
| 408 |
-
label="
|
| 409 |
minimum=0.0,
|
| 410 |
maximum=10.0,
|
| 411 |
step=0.1,
|
| 412 |
-
value=7.5,
|
| 413 |
)
|
| 414 |
|
| 415 |
num_inference_steps = gr.Slider(
|
| 416 |
-
label="
|
| 417 |
minimum=1,
|
| 418 |
maximum=50,
|
| 419 |
step=1,
|
| 420 |
-
value=20,
|
| 421 |
)
|
| 422 |
|
| 423 |
gr.Examples(
|
| 424 |
examples=examples,
|
| 425 |
inputs=[prompt],
|
| 426 |
-
label="
|
| 427 |
)
|
| 428 |
|
| 429 |
gr.on(
|
|
|
|
| 59 |
]
|
| 60 |
|
| 61 |
css = """
|
| 62 |
+
/* ChatGPT-inspired Dark Theme */
|
| 63 |
+
:root {
|
| 64 |
+
--bg-primary: #0D0D0D;
|
| 65 |
+
--bg-secondary: #171717;
|
| 66 |
+
--bg-tertiary: #212121;
|
| 67 |
+
--text-primary: #ECECEC;
|
| 68 |
+
--text-secondary: #9B9B9B;
|
| 69 |
+
--accent: #10A37F;
|
| 70 |
+
--accent-hover: #0E8C6F;
|
| 71 |
+
--border-color: #2D2D2D;
|
| 72 |
+
--input-bg: #2D2D2D;
|
| 73 |
+
}
|
| 74 |
+
|
| 75 |
+
/* Global container */
|
| 76 |
+
.gradio-container {
|
| 77 |
+
background: var(--bg-primary) !important;
|
| 78 |
+
font-family: 'Söhne', 'Segoe UI', 'Helvetica Neue', sans-serif;
|
| 79 |
+
color: var(--text-primary) !important;
|
| 80 |
+
}
|
| 81 |
+
|
| 82 |
+
/* Main content area */
|
| 83 |
#col-container {
|
| 84 |
margin: 0 auto;
|
| 85 |
max-width: 900px;
|
| 86 |
+
padding: 40px 20px;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 87 |
}
|
| 88 |
|
| 89 |
/* Title styling */
|
| 90 |
.gradio-container h1 {
|
| 91 |
+
color: var(--text-primary) !important;
|
| 92 |
+
font-size: 2rem;
|
| 93 |
+
font-weight: 600;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 94 |
margin-bottom: 30px;
|
| 95 |
+
text-align: center;
|
| 96 |
+
letter-spacing: -0.5px;
|
| 97 |
}
|
| 98 |
|
| 99 |
+
/* All text and labels */
|
| 100 |
+
.gradio-container label,
|
| 101 |
+
.gradio-container .label,
|
| 102 |
+
.gradio-container p {
|
| 103 |
+
color: var(--text-primary) !important;
|
| 104 |
+
font-size: 14px;
|
| 105 |
+
font-weight: 500;
|
| 106 |
+
margin-bottom: 8px;
|
| 107 |
+
}
|
| 108 |
+
|
| 109 |
+
/* Input fields */
|
| 110 |
.gradio-container .gradio-textbox input,
|
| 111 |
+
.gradio-container .gradio-textbox textarea,
|
| 112 |
+
.gradio-container input[type="text"] {
|
| 113 |
+
background: var(--input-bg) !important;
|
| 114 |
+
border: 1px solid var(--border-color) !important;
|
| 115 |
+
border-radius: 8px !important;
|
| 116 |
+
color: var(--text-primary) !important;
|
| 117 |
+
padding: 12px 16px !important;
|
| 118 |
+
font-size: 15px;
|
| 119 |
+
transition: all 0.2s ease;
|
| 120 |
}
|
| 121 |
|
| 122 |
.gradio-container .gradio-textbox input:focus,
|
| 123 |
.gradio-container .gradio-textbox textarea:focus {
|
| 124 |
+
outline: none !important;
|
| 125 |
+
border-color: var(--accent) !important;
|
| 126 |
+
box-shadow: 0 0 0 3px rgba(16, 163, 127, 0.1) !important;
|
| 127 |
+
}
|
| 128 |
+
|
| 129 |
+
.gradio-container .gradio-textbox input::placeholder,
|
| 130 |
+
.gradio-container .gradio-textbox textarea::placeholder {
|
| 131 |
+
color: var(--text-secondary) !important;
|
| 132 |
+
}
|
| 133 |
+
|
| 134 |
+
/* Buttons */
|
| 135 |
+
.gradio-container button,
|
| 136 |
+
.gradio-container .gradio-button {
|
| 137 |
+
background: var(--accent) !important;
|
| 138 |
+
border: none !important;
|
| 139 |
+
border-radius: 8px !important;
|
| 140 |
+
color: white !important;
|
| 141 |
+
font-weight: 500 !important;
|
| 142 |
+
font-size: 14px !important;
|
| 143 |
+
padding: 12px 24px !important;
|
| 144 |
cursor: pointer;
|
| 145 |
+
transition: all 0.2s ease;
|
| 146 |
+
box-shadow: none !important;
|
|
|
|
|
|
|
| 147 |
}
|
| 148 |
|
| 149 |
+
.gradio-container button:hover,
|
| 150 |
+
.gradio-container .gradio-button:hover {
|
| 151 |
+
background: var(--accent-hover) !important;
|
| 152 |
+
transform: translateY(-1px);
|
| 153 |
}
|
| 154 |
|
| 155 |
.gradio-container button:active {
|
| 156 |
+
transform: translateY(0);
|
| 157 |
+
}
|
| 158 |
+
|
| 159 |
+
/* Secondary buttons (examples) */
|
| 160 |
+
.gradio-container .gradio-examples button {
|
| 161 |
+
background: var(--bg-tertiary) !important;
|
| 162 |
+
border: 1px solid var(--border-color) !important;
|
| 163 |
+
color: var(--text-primary) !important;
|
| 164 |
}
|
| 165 |
|
| 166 |
+
.gradio-container .gradio-examples button:hover {
|
| 167 |
+
background: var(--input-bg) !important;
|
| 168 |
+
border-color: var(--accent) !important;
|
| 169 |
+
}
|
| 170 |
+
|
| 171 |
+
/* Image container */
|
| 172 |
.gradio-container .gradio-image {
|
| 173 |
+
background: var(--bg-secondary) !important;
|
| 174 |
+
border: 1px solid var(--border-color) !important;
|
| 175 |
+
border-radius: 12px !important;
|
| 176 |
overflow: hidden;
|
| 177 |
+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4) !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 178 |
}
|
| 179 |
|
| 180 |
+
/* Accordion */
|
| 181 |
.gradio-container .gradio-accordion {
|
| 182 |
+
background: var(--bg-secondary) !important;
|
| 183 |
+
border: 1px solid var(--border-color) !important;
|
| 184 |
+
border-radius: 10px !important;
|
|
|
|
| 185 |
margin: 20px 0;
|
|
|
|
| 186 |
}
|
| 187 |
|
| 188 |
.gradio-container .gradio-accordion summary {
|
| 189 |
+
background: transparent !important;
|
| 190 |
+
color: var(--text-primary) !important;
|
| 191 |
+
padding: 16px 20px !important;
|
| 192 |
+
font-weight: 500;
|
| 193 |
cursor: pointer;
|
| 194 |
+
border: none !important;
|
|
|
|
|
|
|
| 195 |
}
|
| 196 |
|
| 197 |
.gradio-container .gradio-accordion[open] summary {
|
| 198 |
+
border-bottom: 1px solid var(--border-color) !important;
|
|
|
|
| 199 |
}
|
| 200 |
|
| 201 |
+
/* Sliders */
|
| 202 |
+
.gradio-container .gradio-slider {
|
| 203 |
+
background: transparent !important;
|
| 204 |
}
|
| 205 |
|
|
|
|
| 206 |
.gradio-container .gradio-slider input[type="range"] {
|
| 207 |
-webkit-appearance: none;
|
| 208 |
appearance: none;
|
| 209 |
+
height: 4px;
|
| 210 |
+
border-radius: 2px;
|
| 211 |
+
background: var(--input-bg) !important;
|
| 212 |
outline: none;
|
|
|
|
| 213 |
}
|
| 214 |
|
| 215 |
.gradio-container .gradio-slider input[type="range"]::-webkit-slider-thumb {
|
| 216 |
-webkit-appearance: none;
|
| 217 |
appearance: none;
|
| 218 |
+
width: 18px;
|
| 219 |
+
height: 18px;
|
| 220 |
border-radius: 50%;
|
| 221 |
+
background: var(--accent) !important;
|
| 222 |
cursor: pointer;
|
| 223 |
+
transition: all 0.2s ease;
|
|
|
|
| 224 |
}
|
| 225 |
|
| 226 |
.gradio-container .gradio-slider input[type="range"]::-webkit-slider-thumb:hover {
|
| 227 |
+
transform: scale(1.1);
|
| 228 |
+
box-shadow: 0 0 0 4px rgba(16, 163, 127, 0.2);
|
| 229 |
+
}
|
| 230 |
+
|
| 231 |
+
.gradio-container .gradio-slider input[type="range"]::-moz-range-thumb {
|
| 232 |
+
width: 18px;
|
| 233 |
+
height: 18px;
|
| 234 |
+
border-radius: 50%;
|
| 235 |
+
background: var(--accent) !important;
|
| 236 |
+
border: none;
|
| 237 |
+
cursor: pointer;
|
| 238 |
}
|
| 239 |
|
| 240 |
+
/* Slider number display */
|
| 241 |
+
.gradio-container .gradio-slider input[type="number"] {
|
| 242 |
+
background: var(--input-bg) !important;
|
| 243 |
+
border: 1px solid var(--border-color) !important;
|
| 244 |
+
color: var(--text-primary) !important;
|
| 245 |
+
border-radius: 6px !important;
|
| 246 |
+
}
|
| 247 |
+
|
| 248 |
+
/* Checkbox */
|
| 249 |
.gradio-container .gradio-checkbox input[type="checkbox"] {
|
| 250 |
+
width: 18px;
|
| 251 |
+
height: 18px;
|
| 252 |
border-radius: 4px;
|
| 253 |
+
border: 2px solid var(--border-color) !important;
|
| 254 |
+
background: var(--input-bg) !important;
|
| 255 |
cursor: pointer;
|
|
|
|
| 256 |
}
|
| 257 |
|
| 258 |
.gradio-container .gradio-checkbox input[type="checkbox"]:checked {
|
| 259 |
+
background: var(--accent) !important;
|
| 260 |
+
border-color: var(--accent) !important;
|
| 261 |
+
}
|
| 262 |
+
|
| 263 |
+
.gradio-container .gradio-checkbox label {
|
| 264 |
+
color: var(--text-primary) !important;
|
| 265 |
}
|
| 266 |
|
| 267 |
/* Examples section */
|
| 268 |
.gradio-container .gradio-examples {
|
| 269 |
+
background: var(--bg-secondary) !important;
|
| 270 |
+
border: 1px solid var(--border-color) !important;
|
| 271 |
+
border-radius: 10px;
|
| 272 |
padding: 20px;
|
| 273 |
margin: 20px 0;
|
|
|
|
|
|
|
| 274 |
}
|
| 275 |
|
| 276 |
+
.gradio-container .gradio-examples .label {
|
| 277 |
+
color: var(--text-primary) !important;
|
| 278 |
+
font-weight: 500;
|
| 279 |
+
margin-bottom: 12px;
|
| 280 |
}
|
| 281 |
|
| 282 |
+
/* Rows */
|
| 283 |
+
.gradio-container .gradio-row {
|
| 284 |
+
gap: 16px;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 285 |
}
|
| 286 |
|
| 287 |
+
/* Progress bar */
|
| 288 |
+
.gradio-container .gradio-progress {
|
| 289 |
+
background: var(--bg-secondary) !important;
|
| 290 |
+
border-radius: 8px;
|
| 291 |
+
overflow: hidden;
|
| 292 |
}
|
| 293 |
|
| 294 |
+
.gradio-container .gradio-progress-bar {
|
| 295 |
+
background: var(--accent) !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 296 |
}
|
| 297 |
|
| 298 |
+
/* Remove default Gradio backgrounds */
|
| 299 |
+
.gradio-container .gradio-box,
|
| 300 |
+
.gradio-container .gradio-form,
|
| 301 |
+
.gradio-container .gradio-group {
|
| 302 |
+
background: transparent !important;
|
| 303 |
+
border: none !important;
|
| 304 |
}
|
| 305 |
|
| 306 |
+
/* Scrollbar styling */
|
| 307 |
+
::-webkit-scrollbar {
|
| 308 |
+
width: 8px;
|
| 309 |
+
height: 8px;
|
|
|
|
|
|
|
| 310 |
}
|
| 311 |
|
| 312 |
+
::-webkit-scrollbar-track {
|
| 313 |
+
background: var(--bg-secondary);
|
| 314 |
+
}
|
| 315 |
+
|
| 316 |
+
::-webkit-scrollbar-thumb {
|
| 317 |
+
background: var(--input-bg);
|
| 318 |
+
border-radius: 4px;
|
| 319 |
+
}
|
| 320 |
+
|
| 321 |
+
::-webkit-scrollbar-thumb:hover {
|
| 322 |
+
background: var(--border-color);
|
| 323 |
}
|
| 324 |
|
| 325 |
/* Responsive design */
|
| 326 |
@media (max-width: 768px) {
|
| 327 |
#col-container {
|
| 328 |
+
padding: 20px 15px;
|
|
|
|
|
|
|
| 329 |
}
|
| 330 |
|
| 331 |
.gradio-container h1 {
|
| 332 |
+
font-size: 1.5rem;
|
|
|
|
| 333 |
}
|
| 334 |
|
| 335 |
.gradio-container .gradio-row {
|
| 336 |
flex-direction: column;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 337 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 338 |
}
|
| 339 |
|
| 340 |
+
/* Smooth animations */
|
| 341 |
+
* {
|
| 342 |
+
transition: background-color 0.2s ease, border-color 0.2s ease;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 343 |
}
|
| 344 |
"""
|
| 345 |
|
| 346 |
+
with gr.Blocks(css=css, title="AI Image Generator", theme=gr.themes.Base()) as demo:
|
| 347 |
with gr.Column(elem_id="col-container"):
|
| 348 |
+
gr.Markdown("# AI Image Generator")
|
| 349 |
|
| 350 |
with gr.Row():
|
| 351 |
prompt = gr.Text(
|
| 352 |
+
label="Prompt",
|
| 353 |
show_label=True,
|
| 354 |
max_lines=1,
|
| 355 |
+
placeholder="Describe your image...",
|
| 356 |
container=True,
|
| 357 |
scale=4
|
| 358 |
)
|
| 359 |
|
| 360 |
+
run_button = gr.Button("Generate", scale=1, variant="primary")
|
| 361 |
|
| 362 |
+
result = gr.Image(label="Generated Image", show_label=True, height=400)
|
| 363 |
|
| 364 |
+
with gr.Accordion("Advanced Settings", open=False):
|
| 365 |
negative_prompt = gr.Text(
|
| 366 |
+
label="Negative Prompt",
|
| 367 |
max_lines=1,
|
| 368 |
+
placeholder="What to exclude from the image...",
|
| 369 |
visible=True,
|
| 370 |
)
|
| 371 |
|
| 372 |
seed = gr.Slider(
|
| 373 |
+
label="Seed",
|
| 374 |
minimum=0,
|
| 375 |
maximum=MAX_SEED,
|
| 376 |
step=1,
|
| 377 |
value=0,
|
| 378 |
)
|
| 379 |
|
| 380 |
+
randomize_seed = gr.Checkbox(label="Randomize seed", value=True)
|
| 381 |
|
| 382 |
with gr.Row():
|
| 383 |
width = gr.Slider(
|
| 384 |
+
label="Width",
|
| 385 |
minimum=256,
|
| 386 |
maximum=MAX_IMAGE_SIZE,
|
| 387 |
step=32,
|
|
|
|
| 389 |
)
|
| 390 |
|
| 391 |
height = gr.Slider(
|
| 392 |
+
label="Height",
|
| 393 |
minimum=256,
|
| 394 |
maximum=MAX_IMAGE_SIZE,
|
| 395 |
step=32,
|
|
|
|
| 398 |
|
| 399 |
with gr.Row():
|
| 400 |
guidance_scale = gr.Slider(
|
| 401 |
+
label="Guidance Scale",
|
| 402 |
minimum=0.0,
|
| 403 |
maximum=10.0,
|
| 404 |
step=0.1,
|
| 405 |
+
value=7.5,
|
| 406 |
)
|
| 407 |
|
| 408 |
num_inference_steps = gr.Slider(
|
| 409 |
+
label="Inference Steps",
|
| 410 |
minimum=1,
|
| 411 |
maximum=50,
|
| 412 |
step=1,
|
| 413 |
+
value=20,
|
| 414 |
)
|
| 415 |
|
| 416 |
gr.Examples(
|
| 417 |
examples=examples,
|
| 418 |
inputs=[prompt],
|
| 419 |
+
label="Example Prompts"
|
| 420 |
)
|
| 421 |
|
| 422 |
gr.on(
|