linoyts HF staff commited on
Commit
56d5bbe
β€’
1 Parent(s): be44dff

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -1
app.py CHANGED
@@ -24,6 +24,16 @@ import random
24
  import spaces
25
  from gradio_imageslider import ImageSlider
26
 
 
 
 
 
 
 
 
 
 
 
27
  def nms(x, t, s):
28
  x = cv2.GaussianBlur(x.astype(np.float32), (0, 0), s)
29
 
@@ -214,7 +224,7 @@ def run(
214
  return (controlnet_img, out)
215
 
216
 
217
- with gr.Blocks(css="style.css") as demo:
218
  gr.Markdown(DESCRIPTION, elem_id="description")
219
  gr.DuplicateButton(
220
  value="Duplicate Space for private use",
 
24
  import spaces
25
  from gradio_imageslider import ImageSlider
26
 
27
+ js_func = """
28
+ function refresh() {
29
+ const url = new URL(window.location);
30
+
31
+ if (url.searchParams.get('__theme') !== 'dark') {
32
+ url.searchParams.set('__theme', 'dark');
33
+ window.location.href = url.href;
34
+ }
35
+ }
36
+ """
37
  def nms(x, t, s):
38
  x = cv2.GaussianBlur(x.astype(np.float32), (0, 0), s)
39
 
 
224
  return (controlnet_img, out)
225
 
226
 
227
+ with gr.Blocks(css="style.css", js=js_func) as demo:
228
  gr.Markdown(DESCRIPTION, elem_id="description")
229
  gr.DuplicateButton(
230
  value="Duplicate Space for private use",