julien-c HF staff commited on
Commit
e234a11
·
verified ·
1 Parent(s): ae43e08

Fix for Spaces

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -17,7 +17,9 @@ CUSTOM_JS_ON_LOAD = """
17
  async () => {
18
  console.log("page.load");
19
  window.itv = setInterval(() => {
20
- const btn = document.querySelector('body > gradio-app').shadowRoot.querySelector("#run_button");
 
 
21
  btn.click();
22
  }, 1000);
23
  // otherwise JS error
 
17
  async () => {
18
  console.log("page.load");
19
  window.itv = setInterval(() => {
20
+ const root = document.querySelector('body > gradio-app').shadowRoot || document.querySelector('body > gradio-app');
21
+ // ≠ in local or in Spaces for some reason
22
+ const btn = root.querySelector("#run_button");
23
  btn.click();
24
  }, 1000);
25
  // otherwise JS error