MichaelRKessler Claude Fable 5 commited on
Commit
38bc649
·
1 Parent(s): 7caaba9

Silence Gradio 6.0 css/head deprecation warning

Browse files

We pass css/head to gr.Blocks rather than launch() on purpose: running
via `gradio app.py` (hot-reload) ignores the __main__ launch() call, so
moving them there would drop our CSS and head scripts. Filter just that
one UserWarning.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

Files changed (1) hide show
  1. app.py +11 -0
app.py CHANGED
@@ -2,9 +2,20 @@ from __future__ import annotations
2
 
3
  import tempfile
4
  import math
 
5
  from pathlib import Path
6
  from typing import Any
7
 
 
 
 
 
 
 
 
 
 
 
8
  import gradio as gr
9
  import numpy as np
10
  from PIL import Image, ImageDraw, ImageFont
 
2
 
3
  import tempfile
4
  import math
5
+ import warnings
6
  from pathlib import Path
7
  from typing import Any
8
 
9
+ # css/head are intentionally passed to gr.Blocks rather than launch(): we run
10
+ # via `gradio app.py` (hot-reload), which ignores the __main__ launch() call,
11
+ # so moving them there would drop our CSS and head scripts. Silence the Gradio
12
+ # 6.0 deprecation notice about that.
13
+ warnings.filterwarnings(
14
+ "ignore",
15
+ message=r".*parameters have been moved from the Blocks constructor.*",
16
+ category=UserWarning,
17
+ )
18
+
19
  import gradio as gr
20
  import numpy as np
21
  from PIL import Image, ImageDraw, ImageFont