Petr Tsvetkov commited on
Commit
0151d66
1 Parent(s): bb67cef

Try to force the light theme

Browse files
Files changed (1) hide show
  1. app.py +13 -1
app.py CHANGED
@@ -94,7 +94,19 @@ def next_sample(current_sample_ind, shuffled_idx):
94
  with open("head.html") as head_file:
95
  head_html = head_file.read()
96
 
97
- with gr.Blocks(theme=gr.themes.Soft(), head=head_html, css="style_overrides.css") as application:
 
 
 
 
 
 
 
 
 
 
 
 
98
  repo_val = gr.Textbox(interactive=False, label='repo', visible=False)
99
  hash_val = gr.Textbox(interactive=False, label='hash', visible=False)
100
  shuffled_idx_val = gr.JSON(visible=False)
 
94
  with open("head.html") as head_file:
95
  head_html = head_file.read()
96
 
97
+ force_light_theme_js_func = """
98
+ function refresh() {
99
+ const url = new URL(window.location);
100
+
101
+ if (url.searchParams.get('__theme') !== 'light') {
102
+ url.searchParams.set('__theme', 'light');
103
+ window.location.href = url.href;
104
+ }
105
+ }
106
+ """
107
+
108
+ with gr.Blocks(theme=gr.themes.Soft(), head=head_html, css="style_overrides.css",
109
+ js=force_light_theme_js_func) as application:
110
  repo_val = gr.Textbox(interactive=False, label='repo', visible=False)
111
  hash_val = gr.Textbox(interactive=False, label='hash', visible=False)
112
  shuffled_idx_val = gr.JSON(visible=False)