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

Move js/head to launch() — Gradio 6 ignores them on Blocks

Browse files

Gradio 6.0 relocated the js and head parameters from the gr.Blocks
constructor to launch(). They were silently dropped (UserWarning only),
so the force-dark-mode redirect never ran and light-mode visitors still
got washed-out theme tokens.

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

Files changed (1) hide show
  1. app.py +3 -5
app.py CHANGED
@@ -1439,11 +1439,7 @@ 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)
@@ -1476,4 +1472,6 @@ if __name__ == "__main__":
1476
  show_error=True,
1477
  css=CSS,
1478
  theme=gr.themes.Base(),
 
 
1479
  )
 
1439
 
1440
 
1441
  def build_app() -> gr.Blocks:
1442
+ with gr.Blocks(title="NV-Generate") as app:
 
 
 
 
1443
  hero_group, hero_buttons = render_hero()
1444
  ct_group, ct_back = workspace_ct.build(spaces_gpu_ct)
1445
  mr_group, mr_back = workspace_mr.build(spaces_gpu_mr)
 
1472
  show_error=True,
1473
  css=CSS,
1474
  theme=gr.themes.Base(),
1475
+ js=FORCE_DARK_JS,
1476
+ head=FORCE_DARK_HEAD,
1477
  )