multimodalart HF staff commited on
Commit
7826288
·
1 Parent(s): 9817ece

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -5
app.py CHANGED
@@ -394,11 +394,14 @@ with gr.Blocks(css="style.css") as demo:
394
 
395
  demo.load(None,
396
  _js="""async () => {
397
- let gradioURL = window.self.location.href;
398
- console.log(gradioURL);
399
- if (!gradioURL.endsWith("?__theme=dark")) {
400
- window.self.location.replace(gradioURL + "?__theme=dark");
401
- }
 
 
 
402
  }""")
403
  demo.queue()
404
  demo.launch()
 
394
 
395
  demo.load(None,
396
  _js="""async () => {
397
+ let gradioURL = new URL(window.self.location.href);
398
+ let params = new URLSearchParams(gradioURL.search);
399
+
400
+ if (!params.has('__theme') || params.get('__theme') !== 'dark') {
401
+ params.set('__theme', 'dark');
402
+ gradioURL.search = params.toString();
403
+ window.self.location.replace(gradioURL.toString());
404
+ }
405
  }""")
406
  demo.queue()
407
  demo.launch()