Spaces:
Running
on
Zero
Running
on
Zero
Update ui_manager.py
Browse files- ui_manager.py +19 -6
ui_manager.py
CHANGED
|
@@ -245,11 +245,24 @@ class UIManager:
|
|
| 245 |
|
| 246 |
css = CSSStyles.get_main_css()
|
| 247 |
|
| 248 |
-
|
| 249 |
-
|
| 250 |
-
title
|
| 251 |
-
theme
|
| 252 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 253 |
|
| 254 |
# Header
|
| 255 |
gr.HTML("""
|
|
@@ -510,4 +523,4 @@ class UIManager:
|
|
| 510 |
favicon_path=None,
|
| 511 |
ssl_verify=False,
|
| 512 |
quiet=False
|
| 513 |
-
)
|
|
|
|
| 245 |
|
| 246 |
css = CSSStyles.get_main_css()
|
| 247 |
|
| 248 |
+
# Gradio 4.x/5.x compatible initialization
|
| 249 |
+
blocks_kwargs = {
|
| 250 |
+
"title": "SceneWeaver - AI Background Generator",
|
| 251 |
+
"theme": gr.themes.Soft()
|
| 252 |
+
}
|
| 253 |
+
|
| 254 |
+
# Check Gradio version for css parameter compatibility
|
| 255 |
+
gradio_version = gr.__version__
|
| 256 |
+
major_version = int(gradio_version.split('.')[0])
|
| 257 |
+
|
| 258 |
+
if major_version >= 5:
|
| 259 |
+
# Gradio 5.x: use head parameter for CSS injection
|
| 260 |
+
blocks_kwargs["head"] = f"<style>{css}</style>"
|
| 261 |
+
else:
|
| 262 |
+
# Gradio 4.x: use css parameter directly
|
| 263 |
+
blocks_kwargs["css"] = css
|
| 264 |
+
|
| 265 |
+
with gr.Blocks(**blocks_kwargs) as interface:
|
| 266 |
|
| 267 |
# Header
|
| 268 |
gr.HTML("""
|
|
|
|
| 523 |
favicon_path=None,
|
| 524 |
ssl_verify=False,
|
| 525 |
quiet=False
|
| 526 |
+
)
|