zephyrie Claude Opus 4.7 commited on
Commit
5f11b27
·
1 Parent(s): e4d3e7e

Force dark mode site-wide and cap CT GPU duration

Browse files

- Force ?__theme=dark via gr.Blocks js= so light-mode visitors get the
intended dark "MAISI Console" aesthetic instead of washed-out light tokens.
- Add <meta name="color-scheme" content="dark"> via head= so native browser
chrome paints dark before hydration.
- Reduce CT @spaces.GPU duration 300s -> 180s; 300s exceeded the ZeroGPU
maximum allowed (180s) and rejected CT generations upfront.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

Files changed (1) hide show
  1. app.py +19 -2
app.py CHANGED
@@ -44,7 +44,7 @@ _ensure_upstream()
44
  # ZeroGPU decorator — present on HF Spaces, optional locally.
45
  try:
46
  import spaces # type: ignore
47
- spaces_gpu_ct = spaces.GPU(duration=300)
48
  spaces_gpu_mr = spaces.GPU(duration=180)
49
  spaces_gpu_mr_brain = spaces.GPU(duration=180)
50
  except (ImportError, AttributeError):
@@ -1425,8 +1425,25 @@ footer { display: none !important; }
1425
  """
1426
 
1427
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1428
  def build_app() -> gr.Blocks:
1429
- with gr.Blocks(title="NV-Generate") as app:
 
 
 
 
1430
  hero_group, hero_buttons = render_hero()
1431
  ct_group, ct_back = workspace_ct.build(spaces_gpu_ct)
1432
  mr_group, mr_back = workspace_mr.build(spaces_gpu_mr)
 
44
  # ZeroGPU decorator — present on HF Spaces, optional locally.
45
  try:
46
  import spaces # type: ignore
47
+ spaces_gpu_ct = spaces.GPU(duration=180)
48
  spaces_gpu_mr = spaces.GPU(duration=180)
49
  spaces_gpu_mr_brain = spaces.GPU(duration=180)
50
  except (ImportError, AttributeError):
 
1425
  """
1426
 
1427
 
1428
+ FORCE_DARK_JS = """
1429
+ () => {
1430
+ const url = new URL(window.location);
1431
+ if (url.searchParams.get('__theme') !== 'dark') {
1432
+ url.searchParams.set('__theme', 'dark');
1433
+ window.location.replace(url.href);
1434
+ }
1435
+ }
1436
+ """
1437
+
1438
+ FORCE_DARK_HEAD = '<meta name="color-scheme" content="dark">'
1439
+
1440
+
1441
  def build_app() -> gr.Blocks:
1442
+ with gr.Blocks(
1443
+ title="NV-Generate",
1444
+ js=FORCE_DARK_JS,
1445
+ head=FORCE_DARK_HEAD,
1446
+ ) as app:
1447
  hero_group, hero_buttons = render_hero()
1448
  ct_group, ct_back = workspace_ct.build(spaces_gpu_ct)
1449
  mr_group, mr_back = workspace_mr.build(spaces_gpu_mr)