datasaur-dev commited on
Commit
d62aaab
·
verified ·
1 Parent(s): ec922d3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -0
app.py CHANGED
@@ -107,12 +107,24 @@ def analyze_wod(file_obj, wod_type):
107
  print(error_msg)
108
  gr.Error(error_msg)
109
  return "", pd.DataFrame()
 
 
 
 
 
 
 
 
 
 
 
110
 
111
  # --- Gradio User Interface Definition ---
112
  # Using gr.Blocks() for a custom layout that matches the elegant design.
113
  with gr.Blocks(
114
  #theme=gr.themes.Soft(primary_hue="blue", secondary_hue="sky"),
115
  theme=gr.themes.Default(primary_hue="blue", secondary_hue="sky"),
 
116
  css=".gradio-container {max-width: 960px !important; margin: auto !important;}"
117
  ) as demo:
118
 
 
107
  print(error_msg)
108
  gr.Error(error_msg)
109
  return "", pd.DataFrame()
110
+
111
+ js_func = """
112
+ function refresh() {
113
+ const url = new URL(window.location);
114
+
115
+ if (url.searchParams.get('__theme') !== 'light') {
116
+ url.searchParams.set('__theme', 'light');
117
+ window.location.href = url.href;
118
+ }
119
+ }
120
+ """
121
 
122
  # --- Gradio User Interface Definition ---
123
  # Using gr.Blocks() for a custom layout that matches the elegant design.
124
  with gr.Blocks(
125
  #theme=gr.themes.Soft(primary_hue="blue", secondary_hue="sky"),
126
  theme=gr.themes.Default(primary_hue="blue", secondary_hue="sky"),
127
+ js=js_func,
128
  css=".gradio-container {max-width: 960px !important; margin: auto !important;}"
129
  ) as demo:
130