Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -60,7 +60,9 @@ get_window_session_index = """
|
|
| 60 |
"""
|
| 61 |
|
| 62 |
with gr.Blocks() as demo:
|
| 63 |
-
gr.Markdown("""## Gradio send queryparam to chatbot
|
|
|
|
|
|
|
| 64 |
url_params = gr.JSON({}, visible=False, label="URL Params")
|
| 65 |
chatbot = gr.Chatbot().style(height=500)
|
| 66 |
msg = gr.Textbox()
|
|
@@ -77,7 +79,8 @@ with gr.Blocks() as demo:
|
|
| 77 |
here your URL params:
|
| 78 |
{json.dumps(url_params, indent=4)}
|
| 79 |
"""
|
| 80 |
-
|
|
|
|
| 81 |
elif "print data" in history[-1][0]:
|
| 82 |
personalized_data = fetch_personalized_data()
|
| 83 |
print(personalized_data)
|
|
@@ -153,10 +156,10 @@ with gr.Blocks() as demo:
|
|
| 153 |
return personalized_result
|
| 154 |
|
| 155 |
# Call the function to fetch data as JSON
|
| 156 |
-
|
| 157 |
|
| 158 |
# Print or use the json_result variable as needed
|
| 159 |
-
|
| 160 |
|
| 161 |
msg.submit(user, inputs=[msg, url_params, chatbot], outputs=[msg, chatbot], queue=False).then(
|
| 162 |
fn=bot, inputs=[chatbot, url_params], outputs=[chatbot]
|
|
|
|
| 60 |
"""
|
| 61 |
|
| 62 |
with gr.Blocks() as demo:
|
| 63 |
+
gr.Markdown("""## Gradio send queryparam to chatbot
|
| 64 |
+
type `read query`
|
| 65 |
+
""")
|
| 66 |
url_params = gr.JSON({}, visible=False, label="URL Params")
|
| 67 |
chatbot = gr.Chatbot().style(height=500)
|
| 68 |
msg = gr.Textbox()
|
|
|
|
| 79 |
here your URL params:
|
| 80 |
{json.dumps(url_params, indent=4)}
|
| 81 |
"""
|
| 82 |
+
|
| 83 |
+
|
| 84 |
elif "print data" in history[-1][0]:
|
| 85 |
personalized_data = fetch_personalized_data()
|
| 86 |
print(personalized_data)
|
|
|
|
| 156 |
return personalized_result
|
| 157 |
|
| 158 |
# Call the function to fetch data as JSON
|
| 159 |
+
personalized_data = fetch_personalized_data()
|
| 160 |
|
| 161 |
# Print or use the json_result variable as needed
|
| 162 |
+
print(personalized_data)
|
| 163 |
|
| 164 |
msg.submit(user, inputs=[msg, url_params, chatbot], outputs=[msg, chatbot], queue=False).then(
|
| 165 |
fn=bot, inputs=[chatbot, url_params], outputs=[chatbot]
|