OmniSVG commited on
Commit
667aca3
Β·
verified Β·
1 Parent(s): 2c00667

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +41 -92
app.py CHANGED
@@ -108,7 +108,7 @@ MAX_LENGTH = model_config.get('max_length', 1024)
108
  # Max length limits for UI
109
  MAX_LENGTH_MIN = 256
110
  MAX_LENGTH_MAX = 2048
111
- MAX_LENGTH_DEFAULT = MAX_LENGTH
112
 
113
  # ============================================================
114
  # Task configurations with defaults from config (shared)
@@ -140,7 +140,7 @@ TASK_CONFIGS = {
140
  # Generation parameters from config (shared)
141
  # ============================================================
142
  gen_config = config.get('generation', {})
143
- DEFAULT_NUM_CANDIDATES = gen_config.get('default_num_candidates', 4)
144
  MAX_NUM_CANDIDATES = gen_config.get('max_num_candidates', 8)
145
  EXTRA_CANDIDATES_BUFFER = gen_config.get('extra_candidates_buffer', 4)
146
 
@@ -346,7 +346,7 @@ CUSTOM_CSS = """
346
  }
347
  """
348
 
349
- # Enhanced Tips HTML
350
  TIPS_HTML = """
351
  <div class="tips-box">
352
  <h3>Prompting Guide & Best Practices</h3>
@@ -356,16 +356,16 @@ TIPS_HTML = """
356
  <strong>CRITICAL: Tips That WILL Improve Your Results</strong>
357
  <ul style="margin: 8px 0 0 0; padding-left: 20px;">
358
  <li style="color: #dc3545; font-weight: 600;">
359
- <strong>Generate 4-8 candidates and pick the best one!</strong> Results vary significantly between generations - this is NORMAL!
360
  </li>
361
  <li style="color: #dc3545; font-weight: 600;">
362
- <strong>Use GEOMETRIC descriptions:</strong> "triangular roof", "circular head", "rectangular body", "curved tail"
363
  </li>
364
  <li style="color: #dc3545; font-weight: 600;">
365
- <strong>ALWAYS specify colors for EACH element:</strong> "black outline", "red roof", "blue shirt", "green grass"
366
  </li>
367
  <li style="color: #dc3545; font-weight: 600;">
368
- <strong>Describe position & orientation:</strong> "centrally positioned", "pointing upward", "facing right", "at the bottom"
369
  </li>
370
  <li style="color: #dc3545; font-weight: 600;">
371
  <strong>Keep it SIMPLE:</strong> Avoid complex sentences. Use short, clear phrases connected by commas.
@@ -394,51 +394,6 @@ TIPS_HTML = """
394
  </ul>
395
  </div>
396
 
397
- <!-- Parameter Tuning Tips -->
398
- <div class="orange-box">
399
- <strong>Parameter Tuning Guide</strong>
400
- <table style="width: 100%; margin-top: 10px; border-collapse: collapse;">
401
- <tr style="background: rgba(255,255,255,0.5);">
402
- <th style="padding: 8px; text-align: left; border-bottom: 1px solid #ddd;">Scenario</th>
403
- <th style="padding: 8px; text-align: center; border-bottom: 1px solid #ddd;">Temperature</th>
404
- <th style="padding: 8px; text-align: center; border-bottom: 1px solid #ddd;">Top-P</th>
405
- <th style="padding: 8px; text-align: center; border-bottom: 1px solid #ddd;">Top-K</th>
406
- <th style="padding: 8px; text-align: center; border-bottom: 1px solid #ddd;">Rep. Penalty</th>
407
- </tr>
408
- <tr>
409
- <td style="padding: 8px;">Simple icons/shapes</td>
410
- <td style="padding: 8px; text-align: center;">0.3 - 0.5</td>
411
- <td style="padding: 8px; text-align: center;">0.85 - 0.90</td>
412
- <td style="padding: 8px; text-align: center;">40 - 50</td>
413
- <td style="padding: 8px; text-align: center;">1.05</td>
414
- </tr>
415
- <tr style="background: rgba(255,255,255,0.3);">
416
- <td style="padding: 8px;">Characters/Avatars</td>
417
- <td style="padding: 8px; text-align: center;">0.5 - 0.7</td>
418
- <td style="padding: 8px; text-align: center;">0.88 - 0.92</td>
419
- <td style="padding: 8px; text-align: center;">50 - 70</td>
420
- <td style="padding: 8px; text-align: center;">1.02 - 1.05</td>
421
- </tr>
422
- <tr>
423
- <td style="padding: 8px;">Landscapes/Scenes</td>
424
- <td style="padding: 8px; text-align: center;">0.5 - 0.7</td>
425
- <td style="padding: 8px; text-align: center;">0.88 - 0.92</td>
426
- <td style="padding: 8px; text-align: center;">50 - 60</td>
427
- <td style="padding: 8px; text-align: center;">1.03</td>
428
- </tr>
429
- <tr style="background: rgba(255,255,255,0.3);">
430
- <td style="padding: 8px;">Image-to-SVG</td>
431
- <td style="padding: 8px; text-align: center;">0.2 - 0.4</td>
432
- <td style="padding: 8px; text-align: center;">0.88 - 0.92</td>
433
- <td style="padding: 8px; text-align: center;">40 - 50</td>
434
- <td style="padding: 8px; text-align: center;">1.05</td>
435
- </tr>
436
- </table>
437
- <p style="margin: 10px 0 0 0; font-size: 0.9em; color: #856404;">
438
- Tip: If results are too chaotic, lower temperature. If too simple/empty, raise it slightly.
439
- </p>
440
- </div>
441
-
442
  <div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 15px; margin-top: 15px;">
443
 
444
  <div class="tip-category">
@@ -453,18 +408,6 @@ TIPS_HTML = """
453
  <p><strong>Keywords:</strong> <code>triangle</code> <code>circle</code> <code>arrow</code> <code>heart</code> <code>star</code> <code>centered</code></p>
454
  </div>
455
 
456
- <div class="tip-category">
457
- <h4>Characters & People</h4>
458
- <p>Break down into simple geometric parts. Describe each body part with shape + color.</p>
459
- <div class="example-prompt">
460
- "A simple person: round beige head, rectangular blue shirt body, two dark gray rectangular legs. Standing pose, arms at sides, flat colors."
461
- </div>
462
- <div class="example-prompt">
463
- "A girl with long black hair, pink dress with triangular skirt shape, small circular face with dot eyes and curved smile. Simple cartoon style."
464
- </div>
465
- <p class="red-tip">Keep poses SIMPLE: standing, sitting, waving. Avoid complex actions!</p>
466
- </div>
467
-
468
  <div class="tip-category">
469
  <h4>Avatars & Portraits</h4>
470
  <p>Use circular frame, focus on face and upper body only.</p>
@@ -480,7 +423,7 @@ TIPS_HTML = """
480
  <h4>Landscapes & Scenes</h4>
481
  <p>Layer elements from background to foreground. Specify color for EACH layer.</p>
482
  <div class="example-prompt">
483
- "Layered landscape: light blue sky at top, gray triangular mountains in middle, dark green triangular pine trees at bottom. Flat colors, simple shapes."
484
  </div>
485
  <div class="example-prompt">
486
  "Sunset beach: orange gradient sky at top, yellow semicircle sun on horizon, dark blue wavy ocean below, tan beach at bottom."
@@ -521,7 +464,7 @@ TIPS_HTML = """
521
  <li><strong>Wrong colors?</strong> Explicitly name EVERY color: "red roof", "blue shirt", "black outline"</li>
522
  <li><strong>Missing elements?</strong> Add position words: "at top", "in center", "at bottom left"</li>
523
  <li><strong>Repetitive patterns?</strong> Increase repetition_penalty to 1.08-1.15</li>
524
- <li><strong>Inconsistent?</strong> <span class="red-tip">Generate MORE candidates (6-8) and pick the best!</span></li>
525
  <li><strong>Too slow?</strong> Reduce max_length to 512-768 for faster generation</li>
526
  </ul>
527
  </div>
@@ -544,12 +487,12 @@ IMAGE_TIPS_HTML = """
544
  <div class="red-box">
545
  <strong>Image-to-SVG Tips</strong>
546
  <ul style="margin: 8px 0 0 0; padding-left: 20px;">
 
547
  <li><strong>Best input: Simple images with clean background</strong></li>
548
  <li><strong>PNG with transparency (RGBA) works best!</strong> We auto-convert to white background.</li>
549
  <li><strong>For complex backgrounds:</strong> Enable "Replace Background" option below.</li>
550
  <li><strong>Lower temperature (0.2-0.4)</strong> for more accurate reproduction.</li>
551
- <li><strong>Use higher max_length (1024+)</strong> for images with more detail.</li>
552
- <li style="color: #dc3545; font-weight: 600;"><strong>Generate 4-8 candidates!</strong> Pick the one that best matches your input.</li>
553
  </ul>
554
  </div>
555
  """
@@ -1076,7 +1019,7 @@ def generate_candidates(inputs, task_type, subtype, temperature, top_p, top_k, r
1076
  return all_candidates
1077
 
1078
 
1079
- @spaces.GPU(duration=300)
1080
  def gradio_text_to_svg(text_description, model_size, num_candidates, temperature, top_p, top_k,
1081
  repetition_penalty, max_length, progress=gr.Progress()):
1082
  """Gradio interface - text-to-svg with model selection"""
@@ -1146,7 +1089,7 @@ def gradio_text_to_svg(text_description, model_size, num_candidates, temperature
1146
  return gallery_html, combined_svg, model_status
1147
 
1148
 
1149
- @spaces.GPU(duration=300)
1150
  def gradio_image_to_svg(image, model_size, num_candidates, temperature, top_p, top_k, repetition_penalty,
1151
  max_length, replace_background, progress=gr.Progress()):
1152
  """Gradio interface - image-to-svg with model selection"""
@@ -1256,7 +1199,7 @@ def get_example_images():
1256
  def create_interface():
1257
  """Create Gradio interface"""
1258
 
1259
- # 30 Example prompts covering various categories
1260
  example_texts = [
1261
  # === Simple Icons (1-6) ===
1262
  "A black triangle pointing downward, centrally positioned.",
@@ -1266,21 +1209,15 @@ def create_interface():
1266
  "A green circle with a white checkmark inside, centered.",
1267
  "A black plus sign with equal length arms, thick lines, centered.",
1268
 
1269
- # === Characters & People (7-12) ===
1270
- "A simple person standing: round beige head, rectangular blue shirt body, two dark gray rectangular legs, arms at sides. Flat colors.",
1271
- "A girl with long black hair, wearing pink dress with triangular skirt, small circular face with dot eyes and curved smile. Simple cartoon style.",
1272
- "A child waving: large round head with brown messy hair, big circular eyes, small body in red t-shirt and blue shorts, one arm raised. Cheerful cartoon style.",
1273
- "A person sitting on chair: side view, round head, rectangular torso in green sweater, bent legs on simple chair shape. Relaxed pose.",
1274
- "A running person: side view silhouette in black, dynamic pose with one leg forward, arms pumping. Motion style.",
1275
-
1276
- # === Avatars & Portraits (13-17) ===
1277
  "Circular avatar: person with short black hair, round face with two dot eyes and small curved smile, wearing blue collar shirt. Minimal style, centered in circle.",
1278
  "Female avatar: oval face with long wavy brown hair, simple eyes, pink lips, wearing v-neck purple top. Soft cartoon style in circular frame.",
1279
  "Profile silhouette avatar: black side view of head with short hair and glasses outline, facing right. Simple solid shape.",
1280
  "Cute cartoon avatar: round face with big sparkly eyes, rosy cheeks, short bob haircut in orange. Kawaii style, circular frame.",
1281
  "Professional headshot avatar: person with neat hair, neutral expression, wearing suit collar. Corporate minimal style, circular frame.",
 
1282
 
1283
- # === Landscapes & Scenes (18-23) ===
1284
  "Layered mountain landscape: light blue sky at top, gray triangular snow-capped mountains in middle, dark green triangular pine trees at bottom. Flat colors.",
1285
  "Sunset beach scene: orange gradient sky at top, yellow semicircle sun on horizon, dark blue wavy ocean, tan beach strip at bottom. Simple shapes.",
1286
  "Forest scene: light blue sky, row of 5 dark green triangular pine trees of varying heights on brown trunks, light green grass at bottom.",
@@ -1288,16 +1225,21 @@ def create_interface():
1288
  "Desert landscape: light orange sky with white circle sun, tan sand dunes as curved shapes, one green cactus with arms on the right side.",
1289
  "Countryside scene: blue sky with white fluffy clouds, green rolling hills, small red barn with white door in the center, yellow hay bales.",
1290
 
1291
- # === Animals (24-27) ===
1292
  "Cute orange cat sitting: round head with two triangular ears, oval body, curved tail. Black outline cartoon style, facing forward.",
1293
  "Simple black bird: oval body, round head, pointed triangular beak facing right, triangular tail, two stick legs. Silhouette style.",
1294
  "Friendly cartoon dog: brown oval body, round head with floppy ears, black dot nose, wagging curved tail, four short legs. Sitting pose.",
1295
  "Red fox logo: triangular orange face with pointed ears, white chest marking, bushy tail. Minimalist style, facing right, centered.",
 
 
1296
 
1297
- # === Objects & Misc (28-30) ===
1298
  "Simple house icon: red triangular roof, beige rectangular walls, brown door in center, two blue square windows, green ground at bottom.",
1299
  "Coffee mug: brown cylindrical cup with curved handle on right, three wavy steam lines rising from top. Flat style.",
1300
- "Open book: two rectangular white pages spread open, black text lines on each page, brown spine in center. Simple top-down view."
 
 
 
1301
  ]
1302
 
1303
  example_images = get_example_images()
@@ -1311,17 +1253,18 @@ def create_interface():
1311
  </div>
1312
  """)
1313
 
1314
- # Queue status
1315
  gr.HTML("""
 
 
 
 
1316
  <div style="background: #e7f3ff; border: 1px solid #b3d7ff; border-radius: 8px; padding: 12px 15px; margin: 15px 0;">
1317
  <span style="font-size: 1.5em;">ℹ️</span>
1318
  <strong>Queue System Active</strong> - Requests processed one at a time. First generation with a new model may take longer to load.
1319
  </div>
1320
  """)
1321
 
1322
- # Tips section
1323
- gr.HTML(TIPS_HTML)
1324
-
1325
  with gr.Tabs():
1326
  # ==================== Image-to-SVG Tab ====================
1327
  with gr.TabItem("Image-to-SVG", id="image-tab"):
@@ -1352,7 +1295,8 @@ def create_interface():
1352
 
1353
  img_num_candidates = gr.Slider(
1354
  minimum=1, maximum=MAX_NUM_CANDIDATES, value=DEFAULT_NUM_CANDIDATES, step=1,
1355
- label="Number of Candidates"
 
1356
  )
1357
  img_replace_bg = gr.Checkbox(
1358
  label="Replace non-white background",
@@ -1442,7 +1386,8 @@ def create_interface():
1442
  gr.Markdown("### Description")
1443
  gr.HTML("""
1444
  <div style="background: #fff5f5; padding: 10px; border-radius: 8px; border-left: 4px solid #dc3545; margin-bottom: 10px;">
1445
- <strong style="color: #dc3545;">Generate 4-8 candidates and pick the best!</strong>
 
1446
  </div>
1447
  """)
1448
  text_input = gr.Textbox(
@@ -1463,9 +1408,9 @@ def create_interface():
1463
  )
1464
 
1465
  text_num_candidates = gr.Slider(
1466
- minimum=1, maximum=MAX_NUM_CANDIDATES, value=6, step=1,
1467
  label="Number of Candidates",
1468
- info="More = better chances!"
1469
  )
1470
 
1471
  # Max Length slider
@@ -1548,12 +1493,16 @@ def create_interface():
1548
  outputs=[text_gallery, text_svg_output, text_model_status],
1549
  queue=True
1550
  )
 
 
 
 
1551
 
1552
  # Footer
1553
  gr.HTML(f"""
1554
  <div class="footer">
1555
  <p>Built with OmniSVG | Available models: {', '.join(AVAILABLE_MODEL_SIZES)}</p>
1556
- <p style="color: #dc3545; font-weight: 600;">Remember: Generate 4-8 candidates and pick the best!</p>
1557
  </div>
1558
  """)
1559
 
 
108
  # Max length limits for UI
109
  MAX_LENGTH_MIN = 256
110
  MAX_LENGTH_MAX = 2048
111
+ MAX_LENGTH_DEFAULT = 1024
112
 
113
  # ============================================================
114
  # Task configurations with defaults from config (shared)
 
140
  # Generation parameters from config (shared)
141
  # ============================================================
142
  gen_config = config.get('generation', {})
143
+ DEFAULT_NUM_CANDIDATES = 2 # Changed to 2 for faster generation
144
  MAX_NUM_CANDIDATES = gen_config.get('max_num_candidates', 8)
145
  EXTRA_CANDIDATES_BUFFER = gen_config.get('extra_candidates_buffer', 4)
146
 
 
346
  }
347
  """
348
 
349
+ # Enhanced Tips HTML (simplified version)
350
  TIPS_HTML = """
351
  <div class="tips-box">
352
  <h3>Prompting Guide & Best Practices</h3>
 
356
  <strong>CRITICAL: Tips That WILL Improve Your Results</strong>
357
  <ul style="margin: 8px 0 0 0; padding-left: 20px;">
358
  <li style="color: #dc3545; font-weight: 600;">
359
+ <strong>πŸš€ First time using?</strong> Set candidates to 1 for faster model download. Increase to 2-4 after the model is loaded!
360
  </li>
361
  <li style="color: #dc3545; font-weight: 600;">
362
+ <strong>Generate 2-4 candidates and pick the best one!</strong> Results vary significantly between generations - this is NORMAL!
363
  </li>
364
  <li style="color: #dc3545; font-weight: 600;">
365
+ <strong>Use GEOMETRIC descriptions:</strong> "triangular roof", "circular head", "rectangular body", "curved tail"
366
  </li>
367
  <li style="color: #dc3545; font-weight: 600;">
368
+ <strong>ALWAYS specify colors for EACH element:</strong> "black outline", "red roof", "blue shirt", "green grass"
369
  </li>
370
  <li style="color: #dc3545; font-weight: 600;">
371
  <strong>Keep it SIMPLE:</strong> Avoid complex sentences. Use short, clear phrases connected by commas.
 
394
  </ul>
395
  </div>
396
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
397
  <div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 15px; margin-top: 15px;">
398
 
399
  <div class="tip-category">
 
408
  <p><strong>Keywords:</strong> <code>triangle</code> <code>circle</code> <code>arrow</code> <code>heart</code> <code>star</code> <code>centered</code></p>
409
  </div>
410
 
 
 
 
 
 
 
 
 
 
 
 
 
411
  <div class="tip-category">
412
  <h4>Avatars & Portraits</h4>
413
  <p>Use circular frame, focus on face and upper body only.</p>
 
423
  <h4>Landscapes & Scenes</h4>
424
  <p>Layer elements from background to foreground. Specify color for EACH layer.</p>
425
  <div class="example-prompt">
426
+ "Layered landscape: light blue sky at top, gray triangular mountains in middle, dark green triangular pine trees at bottom. Flat colors."
427
  </div>
428
  <div class="example-prompt">
429
  "Sunset beach: orange gradient sky at top, yellow semicircle sun on horizon, dark blue wavy ocean below, tan beach at bottom."
 
464
  <li><strong>Wrong colors?</strong> Explicitly name EVERY color: "red roof", "blue shirt", "black outline"</li>
465
  <li><strong>Missing elements?</strong> Add position words: "at top", "in center", "at bottom left"</li>
466
  <li><strong>Repetitive patterns?</strong> Increase repetition_penalty to 1.08-1.15</li>
467
+ <li><strong>Inconsistent?</strong> <span class="red-tip">Generate MORE candidates (2-4) and pick the best!</span></li>
468
  <li><strong>Too slow?</strong> Reduce max_length to 512-768 for faster generation</li>
469
  </ul>
470
  </div>
 
487
  <div class="red-box">
488
  <strong>Image-to-SVG Tips</strong>
489
  <ul style="margin: 8px 0 0 0; padding-left: 20px;">
490
+ <li><strong>πŸš€ First time?</strong> Set candidates to 1 for faster model download!</li>
491
  <li><strong>Best input: Simple images with clean background</strong></li>
492
  <li><strong>PNG with transparency (RGBA) works best!</strong> We auto-convert to white background.</li>
493
  <li><strong>For complex backgrounds:</strong> Enable "Replace Background" option below.</li>
494
  <li><strong>Lower temperature (0.2-0.4)</strong> for more accurate reproduction.</li>
495
+ <li style="color: #dc3545; font-weight: 600;"><strong>Generate 2-4 candidates!</strong> Pick the one that best matches your input.</li>
 
496
  </ul>
497
  </div>
498
  """
 
1019
  return all_candidates
1020
 
1021
 
1022
+ @spaces.GPU(duration=180)
1023
  def gradio_text_to_svg(text_description, model_size, num_candidates, temperature, top_p, top_k,
1024
  repetition_penalty, max_length, progress=gr.Progress()):
1025
  """Gradio interface - text-to-svg with model selection"""
 
1089
  return gallery_html, combined_svg, model_status
1090
 
1091
 
1092
+ @spaces.GPU(duration=180)
1093
  def gradio_image_to_svg(image, model_size, num_candidates, temperature, top_p, top_k, repetition_penalty,
1094
  max_length, replace_background, progress=gr.Progress()):
1095
  """Gradio interface - image-to-svg with model selection"""
 
1199
  def create_interface():
1200
  """Create Gradio interface"""
1201
 
1202
+ # Example prompts covering: icons, avatars, scenes, animals, buildings
1203
  example_texts = [
1204
  # === Simple Icons (1-6) ===
1205
  "A black triangle pointing downward, centrally positioned.",
 
1209
  "A green circle with a white checkmark inside, centered.",
1210
  "A black plus sign with equal length arms, thick lines, centered.",
1211
 
1212
+ # === Avatars & Portraits (7-12) ===
 
 
 
 
 
 
 
1213
  "Circular avatar: person with short black hair, round face with two dot eyes and small curved smile, wearing blue collar shirt. Minimal style, centered in circle.",
1214
  "Female avatar: oval face with long wavy brown hair, simple eyes, pink lips, wearing v-neck purple top. Soft cartoon style in circular frame.",
1215
  "Profile silhouette avatar: black side view of head with short hair and glasses outline, facing right. Simple solid shape.",
1216
  "Cute cartoon avatar: round face with big sparkly eyes, rosy cheeks, short bob haircut in orange. Kawaii style, circular frame.",
1217
  "Professional headshot avatar: person with neat hair, neutral expression, wearing suit collar. Corporate minimal style, circular frame.",
1218
+ "A girl with long black hair, wearing pink dress with triangular skirt, small circular face with dot eyes and curved smile. Simple cartoon style.",
1219
 
1220
+ # === Landscapes & Scenes (13-18) ===
1221
  "Layered mountain landscape: light blue sky at top, gray triangular snow-capped mountains in middle, dark green triangular pine trees at bottom. Flat colors.",
1222
  "Sunset beach scene: orange gradient sky at top, yellow semicircle sun on horizon, dark blue wavy ocean, tan beach strip at bottom. Simple shapes.",
1223
  "Forest scene: light blue sky, row of 5 dark green triangular pine trees of varying heights on brown trunks, light green grass at bottom.",
 
1225
  "Desert landscape: light orange sky with white circle sun, tan sand dunes as curved shapes, one green cactus with arms on the right side.",
1226
  "Countryside scene: blue sky with white fluffy clouds, green rolling hills, small red barn with white door in the center, yellow hay bales.",
1227
 
1228
+ # === Animals (19-24) ===
1229
  "Cute orange cat sitting: round head with two triangular ears, oval body, curved tail. Black outline cartoon style, facing forward.",
1230
  "Simple black bird: oval body, round head, pointed triangular beak facing right, triangular tail, two stick legs. Silhouette style.",
1231
  "Friendly cartoon dog: brown oval body, round head with floppy ears, black dot nose, wagging curved tail, four short legs. Sitting pose.",
1232
  "Red fox logo: triangular orange face with pointed ears, white chest marking, bushy tail. Minimalist style, facing right, centered.",
1233
+ "Cute rabbit: white oval body, long upright ears, round fluffy tail, pink inner ears. Simple cartoon style.",
1234
+ "Yellow duck: round body, orange beak, small wing, floating on blue wavy water. Cute simple style.",
1235
 
1236
+ # === Buildings & Objects (25-30) ===
1237
  "Simple house icon: red triangular roof, beige rectangular walls, brown door in center, two blue square windows, green ground at bottom.",
1238
  "Coffee mug: brown cylindrical cup with curved handle on right, three wavy steam lines rising from top. Flat style.",
1239
+ "Open book: two rectangular white pages spread open, black text lines on each page, brown spine in center. Simple top-down view.",
1240
+ "Tall office building: gray rectangular tower with rows of small blue windows, entrance door at bottom. Modern minimal style.",
1241
+ "Church icon: white rectangular building with tall pointed steeple, cross on top, arched doorway, two small windows. Simple flat style.",
1242
+ "Lighthouse: white and red striped cylindrical tower, yellow light beam at top, standing on gray rocks, blue ocean waves. Simple illustration."
1243
  ]
1244
 
1245
  example_images = get_example_images()
 
1253
  </div>
1254
  """)
1255
 
1256
+ # Queue status and first-time tip
1257
  gr.HTML("""
1258
+ <div style="background: #fff5f5; border: 1px solid #ffcccc; border-radius: 8px; padding: 12px 15px; margin: 15px 0;">
1259
+ <span style="font-size: 1.5em;">πŸš€</span>
1260
+ <strong style="color: #dc3545;">First time using?</strong> Set <strong>Candidates = 1</strong> for faster model download. After the model is loaded, increase to 2-4 for better results!
1261
+ </div>
1262
  <div style="background: #e7f3ff; border: 1px solid #b3d7ff; border-radius: 8px; padding: 12px 15px; margin: 15px 0;">
1263
  <span style="font-size: 1.5em;">ℹ️</span>
1264
  <strong>Queue System Active</strong> - Requests processed one at a time. First generation with a new model may take longer to load.
1265
  </div>
1266
  """)
1267
 
 
 
 
1268
  with gr.Tabs():
1269
  # ==================== Image-to-SVG Tab ====================
1270
  with gr.TabItem("Image-to-SVG", id="image-tab"):
 
1295
 
1296
  img_num_candidates = gr.Slider(
1297
  minimum=1, maximum=MAX_NUM_CANDIDATES, value=DEFAULT_NUM_CANDIDATES, step=1,
1298
+ label="Number of Candidates",
1299
+ info="πŸš€ Set to 1 for first-time model download!"
1300
  )
1301
  img_replace_bg = gr.Checkbox(
1302
  label="Replace non-white background",
 
1386
  gr.Markdown("### Description")
1387
  gr.HTML("""
1388
  <div style="background: #fff5f5; padding: 10px; border-radius: 8px; border-left: 4px solid #dc3545; margin-bottom: 10px;">
1389
+ <strong style="color: #dc3545;">πŸš€ First time?</strong> Set candidates to 1 for faster download!<br>
1390
+ <strong style="color: #dc3545;">Generate 2-4 candidates and pick the best!</strong>
1391
  </div>
1392
  """)
1393
  text_input = gr.Textbox(
 
1408
  )
1409
 
1410
  text_num_candidates = gr.Slider(
1411
+ minimum=1, maximum=MAX_NUM_CANDIDATES, value=DEFAULT_NUM_CANDIDATES, step=1,
1412
  label="Number of Candidates",
1413
+ info="πŸš€ Set to 1 for first-time model download!"
1414
  )
1415
 
1416
  # Max Length slider
 
1493
  outputs=[text_gallery, text_svg_output, text_model_status],
1494
  queue=True
1495
  )
1496
+
1497
+ # ==================== Tips Tab ====================
1498
+ with gr.TabItem("Tips & Guide", id="tips-tab"):
1499
+ gr.HTML(TIPS_HTML)
1500
 
1501
  # Footer
1502
  gr.HTML(f"""
1503
  <div class="footer">
1504
  <p>Built with OmniSVG | Available models: {', '.join(AVAILABLE_MODEL_SIZES)}</p>
1505
+ <p style="color: #dc3545; font-weight: 600;">Remember: Generate 2-4 candidates and pick the best!</p>
1506
  </div>
1507
  """)
1508