SnowFlash383935 commited on
Commit
39b661b
·
verified ·
1 Parent(s): 411537a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -8
app.py CHANGED
@@ -1,13 +1,11 @@
1
  import gradio as gr
2
  jsf = """
3
- function refresh() {
4
- const url = new URL(window.location);
5
-
6
- if (url.searchParams.get('__theme') !== 'dark') {
7
- url.searchParams.set('__theme', 'dark');
8
- window.location.href = url.href;
9
- }
10
- }
11
  """
12
  def update(name):
13
  return f"Welcome to Gradio, {name}!"
 
1
  import gradio as gr
2
  jsf = """
3
+ window.addEventListener('load', function () {
4
+ gradioURL = window.location.href
5
+ if (!gradioURL.endsWith('?__theme=dark')) {
6
+ window.location.replace(gradioURL + '?__theme=dark');
7
+ }
8
+ });
 
 
9
  """
10
  def update(name):
11
  return f"Welcome to Gradio, {name}!"