Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -13,6 +13,14 @@ get_window_url_params = """
|
|
13 |
return [text_input, url_params];
|
14 |
}
|
15 |
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
set_window_url_params = """
|
17 |
function(text_input, url_params) {
|
18 |
const state = {text_input:text_input}
|
@@ -35,8 +43,8 @@ with gr.Blocks() as block:
|
|
35 |
outputs=[text_output, url_params], _js=set_window_url_params)
|
36 |
block.load(
|
37 |
fn=predict,
|
38 |
-
inputs=[
|
39 |
-
outputs=[
|
40 |
-
_js=
|
41 |
)
|
42 |
block.launch(debug=True)
|
|
|
13 |
return [text_input, url_params];
|
14 |
}
|
15 |
"""
|
16 |
+
get_window_url_params_s = """
|
17 |
+
function(url_params) {
|
18 |
+
console.log(text_input, url_params);
|
19 |
+
const params = new URLSearchParams(window.location.search);
|
20 |
+
url_params = Object.fromEntries(params);
|
21 |
+
return [url_params];
|
22 |
+
}
|
23 |
+
"""
|
24 |
set_window_url_params = """
|
25 |
function(text_input, url_params) {
|
26 |
const state = {text_input:text_input}
|
|
|
43 |
outputs=[text_output, url_params], _js=set_window_url_params)
|
44 |
block.load(
|
45 |
fn=predict,
|
46 |
+
inputs=[url_params],
|
47 |
+
outputs=[url_params],
|
48 |
+
_js=get_window_url_params_s
|
49 |
)
|
50 |
block.launch(debug=True)
|