AndrewRqy commited on
Commit ·
c38b046
1
Parent(s): 9233b44
Address Gradio 6 deprecation: set theme+css as Blocks attrs, not constructor args
Browse files4407 unmodified lines440844094410441144124413441444154411441244134414441544174418441644174418421 unmodified lines4840484148424843484448454846484748484849485048514407 unmodified lines input_background_fill="#251d2e", )
# Gradio 6 prefers theme + css on launch(), but HF Space's launcher # imports the module and runs its own launch() with defaults — anything # we set on our own launch() call is bypassed there. So we pass these # to gr.Blocks() despite the deprecation warning; that's the only path # Gradio actually reads on HF Space. # Gradio 6 moved theme + css from Blocks() to launch(). They're set as # attributes on the Blocks instance after construction so HF Space's # own launcher (which calls .launch() with defaults, ignoring any args # we pass to our own launch()) still picks them up. with gr.Blocks( theme=_apprentice_theme, css=composed_css, title="The Apprentice", analytics_enabled=False, ) as demo:421 unmodified lines show_progress="hidden", )
# Gradio 6: theme + css are launch() params, not Blocks() params. But # HF Space's launcher calls .launch() itself with defaults — so we # attach them as attributes on the Blocks instance. Gradio reads # demo.theme and demo.css at launch time regardless of who calls launch. demo.theme = _apprentice_theme demo.css = composed_css return demo
app.py+10-7