Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,6 +1,16 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
with gr.Blocks() as demo:
|
|
|
|
| 4 |
chatbot = gr.Chatbot()
|
| 5 |
msg = gr.Textbox()
|
| 6 |
clear = gr.Button("Clear")
|
|
@@ -18,5 +28,11 @@ with gr.Blocks() as demo:
|
|
| 18 |
bot, chatbot, chatbot
|
| 19 |
)
|
| 20 |
clear.click(lambda: None, None, chatbot, queue=False)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
|
| 22 |
demo.launch()
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
|
| 3 |
+
get_window_url_params = """
|
| 4 |
+
function() {
|
| 5 |
+
console.log(text_input, url_params);
|
| 6 |
+
const params = new URLSearchParams(window.location.search);
|
| 7 |
+
url_params = Object.fromEntries(params);
|
| 8 |
+
return url_params;
|
| 9 |
+
}
|
| 10 |
+
"""
|
| 11 |
+
|
| 12 |
with gr.Blocks() as demo:
|
| 13 |
+
url_params = gr.JSON({}, visible=True, label="URL Params")
|
| 14 |
chatbot = gr.Chatbot()
|
| 15 |
msg = gr.Textbox()
|
| 16 |
clear = gr.Button("Clear")
|
|
|
|
| 28 |
bot, chatbot, chatbot
|
| 29 |
)
|
| 30 |
clear.click(lambda: None, None, chatbot, queue=False)
|
| 31 |
+
block.load(
|
| 32 |
+
None,
|
| 33 |
+
inputs=None,
|
| 34 |
+
outputs=url_params,
|
| 35 |
+
_js=get_window_url_params
|
| 36 |
+
)
|
| 37 |
|
| 38 |
demo.launch()
|