Petr Tsvetkov commited on
Commit
642fae1
β€’
1 Parent(s): 34d6af9

Force the light theme

Browse files
Files changed (1) hide show
  1. change_visualizer.py +12 -1
change_visualizer.py CHANGED
@@ -24,8 +24,19 @@ def update_synthetic_view(diff_idx):
24
  f"https://github.com/{df_synthetic.iloc[diff_idx]['repo']}/commit/{df_synthetic.iloc[diff_idx]['hash']}")
25
 
26
 
 
 
 
 
 
 
 
 
 
 
 
27
  if __name__ == '__main__':
28
- with gr.Blocks(theme=gr.themes.Soft()) as application:
29
  with gr.Tab("Manual"):
30
  slider_manual = gr.Slider(minimum=1, maximum=n_diffs_manual, step=1, value=1,
31
  label=f"Sample number (total: {n_diffs_manual})")
 
24
  f"https://github.com/{df_synthetic.iloc[diff_idx]['repo']}/commit/{df_synthetic.iloc[diff_idx]['hash']}")
25
 
26
 
27
+ force_light_theme_js_func = """
28
+ function refresh() {
29
+ const url = new URL(window.location);
30
+
31
+ if (url.searchParams.get('__theme') !== 'light') {
32
+ url.searchParams.set('__theme', 'light');
33
+ window.location.href = url.href;
34
+ }
35
+ }
36
+ """
37
+
38
  if __name__ == '__main__':
39
+ with gr.Blocks(theme=gr.themes.Soft(), js=force_light_theme_js_func) as application:
40
  with gr.Tab("Manual"):
41
  slider_manual = gr.Slider(minimum=1, maximum=n_diffs_manual, step=1, value=1,
42
  label=f"Sample number (total: {n_diffs_manual})")