space: force dark theme (light mode looks bad)
Browse files
app.py
CHANGED
|
@@ -1239,11 +1239,23 @@ That's the project's central constraint and its main flex on AMD's headline GPU.
|
|
| 1239 |
"""
|
| 1240 |
|
| 1241 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1242 |
def build_ui():
|
| 1243 |
with gr.Blocks(
|
| 1244 |
theme=gr.themes.Base(primary_hue="violet", secondary_hue="pink",
|
| 1245 |
neutral_hue="slate"),
|
| 1246 |
css=CUSTOM_CSS,
|
|
|
|
| 1247 |
title="StudioMI300",
|
| 1248 |
) as demo:
|
| 1249 |
gr.HTML(HERO_HTML)
|
|
|
|
| 1239 |
"""
|
| 1240 |
|
| 1241 |
|
| 1242 |
+
FORCE_DARK_JS = """
|
| 1243 |
+
() => {
|
| 1244 |
+
const url = new URL(window.location);
|
| 1245 |
+
if (url.searchParams.get('__theme') !== 'dark') {
|
| 1246 |
+
url.searchParams.set('__theme', 'dark');
|
| 1247 |
+
window.location.href = url.href;
|
| 1248 |
+
}
|
| 1249 |
+
}
|
| 1250 |
+
"""
|
| 1251 |
+
|
| 1252 |
+
|
| 1253 |
def build_ui():
|
| 1254 |
with gr.Blocks(
|
| 1255 |
theme=gr.themes.Base(primary_hue="violet", secondary_hue="pink",
|
| 1256 |
neutral_hue="slate"),
|
| 1257 |
css=CUSTOM_CSS,
|
| 1258 |
+
js=FORCE_DARK_JS,
|
| 1259 |
title="StudioMI300",
|
| 1260 |
) as demo:
|
| 1261 |
gr.HTML(HERO_HTML)
|