bolajiev commited on
Commit
d8f1c3d
Β·
1 Parent(s): 025d6d0

UI fixes: example list, code scroll, header containment

Browse files

- Examples: replaced mushroom + diamond with wireframe-spheres; reordered
to lead with badge/trophy/coins templates then hero visuals (8 total)
- Code tab: added max-height:480px + overflow:auto on #tg-code and .cm-scroller
so the Three.js output scrolls internally instead of growing the page
- Header: moved border-bottom/margin-bottom to inline styles on the inner <div>
so they survive Gradio's block wrapper; cleaned up #tg-header CSS to just
zero out any Gradio chrome (background/border/shadow)

Files changed (1) hide show
  1. app.py +32 -17
app.py CHANGED
@@ -41,16 +41,14 @@ def _generate_json(prompt: str) -> str:
41
 
42
 
43
  EXAMPLES = [
44
- "a faceted crystal β€” one large icosahedron, electric blue, metallic",
45
- "a glowing wireframe torus knot on a black background",
46
- "a chunky cartoon mushroom: red dome sphere on a white cylinder stem",
47
- "a molten-gold torus knot, high metalness, low roughness",
48
- "three glowing neon-green cubes stacked into a tower",
49
- "a chrome icosahedron orbited by small glowing purple spheres",
50
- "a row of three gold coins side by side",
51
- "a tall trophy: a star on top of a golden column",
52
  "a star badge with the text PRO",
53
  "a shield badge with the text NEW",
 
 
 
 
 
 
54
  ]
55
 
56
  _NESTED_SPHERE_PATTERNS = ("wireframe sphere inside", "sphere inside", "nested sphere")
@@ -336,15 +334,15 @@ footer { display: none !important; }
336
  padding: 0 28px !important;
337
  }
338
 
339
- /* ── Header ── */
340
- #tg-header {
 
341
  background: transparent !important;
342
- border-bottom: 1px solid var(--tg-border) !important;
343
- margin-bottom: 28px !important;
344
  padding: 0 !important;
 
 
345
  }
346
- #tg-header > * { background: transparent !important; border: none !important; }
347
- #tg-header .prose, #tg-header .block { background: transparent !important; }
348
 
349
  /* ── Card groups ── */
350
  .tg-card {
@@ -533,6 +531,21 @@ input[type="range"]::-moz-range-thumb {
533
  }
534
  #tg-json > * { background: transparent !important; }
535
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
536
  /* ── Code block ── */
537
  .codemirror-wrapper, .cm-editor {
538
  background: #08081a !important;
@@ -558,13 +571,14 @@ input[type="range"]::-moz-range-thumb {
558
  # ---- HTML fragments -------------------------------------------------------
559
 
560
  _HEADER_HTML = """
561
- <div id="tg-header" style="display:flex;align-items:center;gap:18px;padding:28px 0 24px;">
 
 
 
562
  <svg width="42" height="42" viewBox="0 0 42 42" fill="none" xmlns="http://www.w3.org/2000/svg">
563
  <rect width="42" height="42" rx="11" fill="url(#hg)"/>
564
- <!-- hexagon representing a cube face -->
565
  <polygon points="21,7 34,14.5 34,27.5 21,35 8,27.5 8,14.5"
566
  fill="none" stroke="rgba(255,255,255,0.85)" stroke-width="1.8"/>
567
- <!-- inner depth lines -->
568
  <line x1="21" y1="7" x2="21" y2="21" stroke="rgba(255,255,255,0.45)" stroke-width="1.4"/>
569
  <line x1="34" y1="14.5" x2="21" y2="21" stroke="rgba(255,255,255,0.45)" stroke-width="1.4"/>
570
  <line x1="8" y1="14.5" x2="21" y2="21" stroke="rgba(255,255,255,0.45)" stroke-width="1.4"/>
@@ -660,6 +674,7 @@ with gr.Blocks(title="ThreeGen", theme=_build_theme(), css=_CSS) as demo:
660
  language="html",
661
  label="",
662
  show_label=False,
 
663
  )
664
 
665
  # Scene JSON (collapsed)
 
41
 
42
 
43
  EXAMPLES = [
 
 
 
 
 
 
 
 
44
  "a star badge with the text PRO",
45
  "a shield badge with the text NEW",
46
+ "a row of three gold coins side by side",
47
+ "a tall trophy: a star on top of a golden column",
48
+ "a molten-gold torus knot, high metalness, low roughness",
49
+ "a faceted crystal β€” one large icosahedron, electric blue, metallic",
50
+ "three glowing neon-green cubes stacked into a tower",
51
+ "a red wireframe sphere inside a larger blue wireframe sphere",
52
  ]
53
 
54
  _NESTED_SPHERE_PATTERNS = ("wireframe sphere inside", "sphere inside", "nested sphere")
 
334
  padding: 0 28px !important;
335
  }
336
 
337
+ /* ── Header wrapper (Gradio block containing the header HTML) ── */
338
+ #tg-header,
339
+ #tg-header > * {
340
  background: transparent !important;
341
+ border: none !important;
 
342
  padding: 0 !important;
343
+ margin: 0 !important;
344
+ box-shadow: none !important;
345
  }
 
 
346
 
347
  /* ── Card groups ── */
348
  .tg-card {
 
531
  }
532
  #tg-json > * { background: transparent !important; }
533
 
534
+ /* ── Code tab: fixed height, internal scroll ── */
535
+ #tg-code,
536
+ #tg-code .code-wrap,
537
+ #tg-code .cm-editor,
538
+ #tg-code .codemirror-wrapper {
539
+ max-height: 480px !important;
540
+ overflow: auto !important;
541
+ }
542
+ /* Fallback: any code editor inside the preview column tabs */
543
+ #tg-preview-col .code-wrap,
544
+ #tg-preview-col .cm-scroller {
545
+ max-height: 480px !important;
546
+ overflow: auto !important;
547
+ }
548
+
549
  /* ── Code block ── */
550
  .codemirror-wrapper, .cm-editor {
551
  background: #08081a !important;
 
571
  # ---- HTML fragments -------------------------------------------------------
572
 
573
  _HEADER_HTML = """
574
+ <div style="display:flex;align-items:center;gap:18px;
575
+ padding:28px 0 24px;
576
+ border-bottom:1px solid rgba(255,255,255,0.07);
577
+ margin-bottom:28px;">
578
  <svg width="42" height="42" viewBox="0 0 42 42" fill="none" xmlns="http://www.w3.org/2000/svg">
579
  <rect width="42" height="42" rx="11" fill="url(#hg)"/>
 
580
  <polygon points="21,7 34,14.5 34,27.5 21,35 8,27.5 8,14.5"
581
  fill="none" stroke="rgba(255,255,255,0.85)" stroke-width="1.8"/>
 
582
  <line x1="21" y1="7" x2="21" y2="21" stroke="rgba(255,255,255,0.45)" stroke-width="1.4"/>
583
  <line x1="34" y1="14.5" x2="21" y2="21" stroke="rgba(255,255,255,0.45)" stroke-width="1.4"/>
584
  <line x1="8" y1="14.5" x2="21" y2="21" stroke="rgba(255,255,255,0.45)" stroke-width="1.4"/>
 
674
  language="html",
675
  label="",
676
  show_label=False,
677
+ elem_id="tg-code",
678
  )
679
 
680
  # Scene JSON (collapsed)