botsi commited on
Commit
e6b50e5
·
verified ·
1 Parent(s): f8c9b96

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -2
app.py CHANGED
@@ -61,12 +61,20 @@ js = """
61
  }
62
  """
63
 
 
 
 
 
 
 
 
 
 
64
  with gr.Blocks(js = js) as demo:
65
  gr.Markdown("""## Gradio send queryparam to chatbot
66
  type `hi`
67
  """)
68
- url_params = """{url_params}"""
69
- #url_params = gr.JSON({}, visible=False, label="URL Params")
70
  chatbot = gr.Chatbot()
71
  #chatbot = gr.Chatbot().style(height=500)
72
  msg = gr.Textbox()
 
61
  }
62
  """
63
 
64
+ def get_window_url_params():
65
+ return """
66
+ function() {
67
+ const params = new URLSearchParams(window.location.search);
68
+ const url_params = Object.fromEntries(params);
69
+ return url_params;
70
+ }
71
+ """
72
+
73
  with gr.Blocks(js = js) as demo:
74
  gr.Markdown("""## Gradio send queryparam to chatbot
75
  type `hi`
76
  """)
77
+ url_params = gr.JSON({}, visible=False, label="URL Params")
 
78
  chatbot = gr.Chatbot()
79
  #chatbot = gr.Chatbot().style(height=500)
80
  msg = gr.Textbox()