AnimeOverlord commited on
Commit
3a22cac
·
1 Parent(s): ae9ef77

Fix Gradio 6 launch styling

Browse files
Files changed (1) hide show
  1. app.py +18 -11
app.py CHANGED
@@ -618,6 +618,22 @@ _pipe_ready = False
618
 
619
  IMAGE_MODE = "Image"
620
  LIVE_MODE = "Live Camera"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
621
 
622
 
623
  def _ensure_model_files():
@@ -766,16 +782,7 @@ def stop_live():
766
  # UI
767
  # ----------------------------------------------------------------------
768
 
769
- with gr.Blocks(
770
- title="Minecraftify! ⛏️",
771
- css=CUSTOM_CSS,
772
- theme=gr.themes.Base(
773
- primary_hue="green",
774
- neutral_hue="stone",
775
- font=gr.themes.GoogleFont("VT323"),
776
- font_mono=gr.themes.GoogleFont("VT323"),
777
- ),
778
- ) as demo:
779
 
780
  # ── Title Banner ──
781
  gr.HTML("""
@@ -951,4 +958,4 @@ with gr.Blocks(
951
  concurrency_limit=1,
952
  )
953
 
954
- demo.queue(max_size=1).launch()
 
618
 
619
  IMAGE_MODE = "Image"
620
  LIVE_MODE = "Live Camera"
621
+ GRADIO_MAJOR = int(gr.__version__.split(".", 1)[0])
622
+
623
+ MC_THEME = gr.themes.Base(
624
+ primary_hue="green",
625
+ neutral_hue="stone",
626
+ font=gr.themes.GoogleFont("VT323"),
627
+ font_mono=gr.themes.GoogleFont("VT323"),
628
+ )
629
+
630
+ BLOCKS_KWARGS = {"title": "Minecraftify! ⛏️"}
631
+ LAUNCH_KWARGS = {}
632
+
633
+ if GRADIO_MAJOR >= 6:
634
+ LAUNCH_KWARGS.update({"css": CUSTOM_CSS, "theme": MC_THEME})
635
+ else:
636
+ BLOCKS_KWARGS.update({"css": CUSTOM_CSS, "theme": MC_THEME})
637
 
638
 
639
  def _ensure_model_files():
 
782
  # UI
783
  # ----------------------------------------------------------------------
784
 
785
+ with gr.Blocks(**BLOCKS_KWARGS) as demo:
 
 
 
 
 
 
 
 
 
786
 
787
  # ── Title Banner ──
788
  gr.HTML("""
 
958
  concurrency_limit=1,
959
  )
960
 
961
+ demo.queue(max_size=1).launch(**LAUNCH_KWARGS)