sush0401 commited on
Commit
f029f5f
·
verified ·
1 Parent(s): 5648373

Upgrade Space to gradio 6 so voxcpm==2.0.3 (VoxCPM2) installs; move theme/css/js/head to launch(); fix removed show_copy_button

Browse files
Files changed (4) hide show
  1. README.md +1 -1
  2. app.py +2 -1
  3. requirements.txt +1 -1
  4. ui/layout.py +19 -7
README.md CHANGED
@@ -4,7 +4,7 @@ emoji: 📚
4
  colorFrom: yellow
5
  colorTo: red
6
  sdk: gradio
7
- sdk_version: "5.50.0"
8
  app_file: app.py
9
  pinned: false
10
  tags:
 
4
  colorFrom: yellow
5
  colorTo: red
6
  sdk: gradio
7
+ sdk_version: "6.18.0"
8
  app_file: app.py
9
  pinned: false
10
  tags:
app.py CHANGED
@@ -694,4 +694,5 @@ if __name__ == "__main__":
694
  create_book_fn=create_book,
695
  )
696
  demo.queue(default_concurrency_limit=2, max_size=8)
697
- demo.launch(share=False, allowed_paths=[tempfile.gettempdir()])
 
 
694
  create_book_fn=create_book,
695
  )
696
  demo.queue(default_concurrency_limit=2, max_size=8)
697
+ # design_kwargs (theme/css/js/head) is non-empty on gradio 6 (moved to launch)
698
+ demo.launch(share=False, allowed_paths=[tempfile.gettempdir()], **demo.design_kwargs)
requirements.txt CHANGED
@@ -1,6 +1,6 @@
1
  # DoodleBook — Dependencies (ZeroGPU Version)
2
  # Core
3
- gradio>=5.0
4
  python-dotenv
5
  spaces
6
 
 
1
  # DoodleBook — Dependencies (ZeroGPU Version)
2
  # Core
3
+ gradio>=6,<7
4
  python-dotenv
5
  spaces
6
 
ui/layout.py CHANGED
@@ -556,13 +556,21 @@ FORCE_LIGHT_JS = """
556
  def create_layout(load_sample_fn=None, create_book_fn=None):
557
  """Build the scrapbook-styled Gradio Blocks layout."""
558
 
559
- with gr.Blocks(
 
 
 
 
560
  css=CSS,
561
  head=HEAD,
562
  js=FORCE_LIGHT_JS, # lock to light mode (scrapbook design is light-only)
563
- title="DoodleBook",
564
  theme=gr.themes.Base(), # Base, not Soft — we own the styling
565
- ) as demo:
 
 
 
 
 
566
  # hidden SVG filters used by the hand-drawn frames
567
  gr.HTML(SVG_DEFS)
568
 
@@ -691,10 +699,12 @@ FLUX is the printer. **Tiny Titan.**
691
  """
692
  )
693
  with gr.Tab("Trace"):
694
- trace_info = gr.Textbox(
695
- label="Generation trace (Open Trace)",
696
- interactive=False, lines=8, show_copy_button=True,
697
- )
 
 
698
 
699
  gr.HTML(
700
  """
@@ -717,4 +727,6 @@ FLUX is the printer. **Tiny Titan.**
717
  if load_sample_fn:
718
  demo.load(fn=load_sample_fn, outputs=[book_display])
719
 
 
 
720
  return demo
 
556
  def create_layout(load_sample_fn=None, create_book_fn=None):
557
  """Build the scrapbook-styled Gradio Blocks layout."""
558
 
559
+ # Gradio 6 moved theme/css/js/head from Blocks() to launch(). Keep the
560
+ # scrapbook design working on BOTH: pass them to Blocks on gradio 5, and
561
+ # stash them on the returned demo so the caller hands them to launch() on 6.
562
+ _gr_major = int(gr.__version__.split(".")[0])
563
+ design_kwargs = dict(
564
  css=CSS,
565
  head=HEAD,
566
  js=FORCE_LIGHT_JS, # lock to light mode (scrapbook design is light-only)
 
567
  theme=gr.themes.Base(), # Base, not Soft — we own the styling
568
+ )
569
+ blocks_kwargs = dict(title="DoodleBook")
570
+ if _gr_major < 6:
571
+ blocks_kwargs.update(design_kwargs)
572
+
573
+ with gr.Blocks(**blocks_kwargs) as demo:
574
  # hidden SVG filters used by the hand-drawn frames
575
  gr.HTML(SVG_DEFS)
576
 
 
699
  """
700
  )
701
  with gr.Tab("Trace"):
702
+ # show_copy_button was removed from Textbox in gradio 6
703
+ _tb_kwargs = dict(label="Generation trace (Open Trace)",
704
+ interactive=False, lines=8)
705
+ if _gr_major < 6:
706
+ _tb_kwargs["show_copy_button"] = True
707
+ trace_info = gr.Textbox(**_tb_kwargs)
708
 
709
  gr.HTML(
710
  """
 
727
  if load_sample_fn:
728
  demo.load(fn=load_sample_fn, outputs=[book_display])
729
 
730
+ # On gradio 6 the design params go to launch(); expose them for the caller.
731
+ demo.design_kwargs = design_kwargs if _gr_major >= 6 else {}
732
  return demo