Dyra1204 commited on
Commit
a23cca0
·
verified ·
1 Parent(s): 5e6a8eb

Upload main.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. main.py +31 -0
main.py CHANGED
@@ -1228,8 +1228,39 @@ class BiasGuardDashboard:
1228
  }
1229
  """
1230
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1231
  with gr.Blocks(
1232
  css=custom_css,
 
1233
  title="BiasGuard Pro",
1234
  theme=gr.themes.Base(),
1235
  ) as demo:
 
1228
  }
1229
  """
1230
 
1231
+ force_light_js = """
1232
+ () => {
1233
+ const applyLight = () => {
1234
+ const elements = [
1235
+ document.documentElement,
1236
+ document.body,
1237
+ document.querySelector('.gradio-root'),
1238
+ document.querySelector('.gradio-container')
1239
+ ].filter(Boolean);
1240
+
1241
+ for (const el of elements) {
1242
+ el.classList && el.classList.remove('dark');
1243
+ if (el.dataset) el.dataset.theme = 'light';
1244
+ if (el.style) el.style.colorScheme = 'light';
1245
+ }
1246
+ };
1247
+
1248
+ applyLight();
1249
+
1250
+ const observer = new MutationObserver(() => applyLight());
1251
+ observer.observe(document.documentElement, { attributes: true, attributeFilter: ['class', 'data-theme'] });
1252
+
1253
+ try {
1254
+ window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', () => applyLight());
1255
+ } catch (e) {
1256
+ /* no-op */
1257
+ }
1258
+ }
1259
+ """
1260
+
1261
  with gr.Blocks(
1262
  css=custom_css,
1263
+ js=force_light_js,
1264
  title="BiasGuard Pro",
1265
  theme=gr.themes.Base(),
1266
  ) as demo: