Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -72,18 +72,19 @@ with gr.Blocks() as demo:
|
|
| 72 |
chatbot = gr.Chatbot().style(height=500)
|
| 73 |
msg = gr.Textbox()
|
| 74 |
clear = gr.Button("Clear")
|
|
|
|
| 75 |
|
| 76 |
def user(user_message, url_params, history):
|
| 77 |
return "", history + [[user_message, None]]
|
| 78 |
|
| 79 |
-
def bot(history, url_params):
|
| 80 |
if "read query" in history[-1][0]:
|
| 81 |
bot_message = f"""
|
| 82 |
here your URL params:
|
| 83 |
{json.dumps(url_params, indent=4)}
|
| 84 |
"""
|
| 85 |
else:
|
| 86 |
-
bot_message = "You did not ask for the URL Params :) But here is what I read from the database"
|
| 87 |
history[-1][1] = bot_message
|
| 88 |
time.sleep(1)
|
| 89 |
return history
|
|
|
|
| 72 |
chatbot = gr.Chatbot().style(height=500)
|
| 73 |
msg = gr.Textbox()
|
| 74 |
clear = gr.Button("Clear")
|
| 75 |
+
json_result = fetch_data_as_json()
|
| 76 |
|
| 77 |
def user(user_message, url_params, history):
|
| 78 |
return "", history + [[user_message, None]]
|
| 79 |
|
| 80 |
+
def bot(history, url_params, json_result):
|
| 81 |
if "read query" in history[-1][0]:
|
| 82 |
bot_message = f"""
|
| 83 |
here your URL params:
|
| 84 |
{json.dumps(url_params, indent=4)}
|
| 85 |
"""
|
| 86 |
else:
|
| 87 |
+
bot_message = "You did not ask for the URL Params :) But here is what I read from the database" + {json_result}
|
| 88 |
history[-1][1] = bot_message
|
| 89 |
time.sleep(1)
|
| 90 |
return history
|