botsi commited on
Commit
fee465c
·
verified ·
1 Parent(s): f455221

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -16
app.py CHANGED
@@ -53,16 +53,15 @@ def fetch_personalized_data(session_index):
53
  print(f"Error: {err}")
54
  return None
55
 
56
- def get_window_url_params():
57
- return """
58
- function() {
59
- const params = new URLSearchParams(window.location.search);
60
- const url_params = Object.fromEntries(params);
61
- return url_params;
62
- }
63
- """
64
 
65
- with gr.Blocks() as demo:
66
  gr.Markdown("""## Gradio send queryparam to chatbot
67
  type `hi`
68
  """)
@@ -112,12 +111,6 @@ with gr.Blocks() as demo:
112
 
113
  clear.click(lambda: None, None, chatbot, queue=False)
114
 
115
- demo.load(
116
- fn=lambda x: x,
117
- inputs=[url_params],
118
- outputs=[url_params],
119
- _js=get_window_url_params(),
120
- queue=False
121
- )
122
 
123
  demo.launch()
 
53
  print(f"Error: {err}")
54
  return None
55
 
56
+ js = """
57
+ function() {
58
+ const params = new URLSearchParams(window.location.search);
59
+ const url_params = Object.fromEntries(params);
60
+ return url_params;
61
+ }
62
+ """
 
63
 
64
+ with gr.Blocks(js = js) as demo:
65
  gr.Markdown("""## Gradio send queryparam to chatbot
66
  type `hi`
67
  """)
 
111
 
112
  clear.click(lambda: None, None, chatbot, queue=False)
113
 
114
+
 
 
 
 
 
 
115
 
116
  demo.launch()