radames HF staff commited on
Commit
6094a05
1 Parent(s): f21e053

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -15,10 +15,12 @@ get_window_url_params = """
15
  """
16
  set_window_url_params = """
17
  function(text_input, url_params) {
18
- const state = {text_input:text_input}
19
- const queryString = '?' + new URLSearchParams(state).toString();
 
 
20
  window.parent.postMessage({ queryString: queryString }, "*")
21
- return [text_input, state];
22
  }
23
  """
24
  with gr.Blocks() as block:
15
  """
16
  set_window_url_params = """
17
  function(text_input, url_params) {
18
+ const params = new URLSearchParams(window.location.search);
19
+ params.set("text_input", text_input)
20
+ url_params = Object.fromEntries(params);
21
+ const queryString = '?' + params.toString();
22
  window.parent.postMessage({ queryString: queryString }, "*")
23
+ return [text_input, url_params];
24
  }
25
  """
26
  with gr.Blocks() as block: