Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -43,16 +43,21 @@ type `read query`
|
|
| 43 |
if "read query" in history[-1][0]:
|
| 44 |
session_index = url_params.get('session_index')
|
| 45 |
bot_message = f"""
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
print(url_params)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 50 |
else:
|
| 51 |
bot_message = random.choice(["Yes", "No"])
|
| 52 |
history[-1][1] = bot_message
|
| 53 |
time.sleep(1)
|
| 54 |
return history
|
| 55 |
|
|
|
|
| 56 |
msg.submit(user, inputs=[msg, url_params, chatbot], outputs=[msg, chatbot], queue=False).then(
|
| 57 |
fn=bot, inputs=[chatbot, url_params], outputs=[chatbot]
|
| 58 |
)
|
|
@@ -137,6 +142,22 @@ print(personalized_data)
|
|
| 137 |
demo.launch()
|
| 138 |
|
| 139 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 140 |
'''
|
| 141 |
WHERE {decisions_table}.session_index = '{session_index}'
|
| 142 |
|
|
|
|
| 43 |
if "read query" in history[-1][0]:
|
| 44 |
session_index = url_params.get('session_index')
|
| 45 |
bot_message = f"""
|
| 46 |
+
here your URL params:
|
| 47 |
+
{json.dumps(url_params, indent=4)}
|
| 48 |
+
"""
|
| 49 |
print(url_params)
|
| 50 |
+
elif "print data" in history[-1][0]:
|
| 51 |
+
personalized_data = fetch_personalized_data()
|
| 52 |
+
print(personalized_data)
|
| 53 |
+
bot_message = "Data printed."
|
| 54 |
else:
|
| 55 |
bot_message = random.choice(["Yes", "No"])
|
| 56 |
history[-1][1] = bot_message
|
| 57 |
time.sleep(1)
|
| 58 |
return history
|
| 59 |
|
| 60 |
+
|
| 61 |
msg.submit(user, inputs=[msg, url_params, chatbot], outputs=[msg, chatbot], queue=False).then(
|
| 62 |
fn=bot, inputs=[chatbot, url_params], outputs=[chatbot]
|
| 63 |
)
|
|
|
|
| 142 |
demo.launch()
|
| 143 |
|
| 144 |
|
| 145 |
+
'''
|
| 146 |
+
def bot(history, url_params):
|
| 147 |
+
global session_index
|
| 148 |
+
if "read query" in history[-1][0]:
|
| 149 |
+
session_index = url_params.get('session_index')
|
| 150 |
+
bot_message = f"""
|
| 151 |
+
here your URL params:
|
| 152 |
+
{json.dumps(url_params, indent=4)}
|
| 153 |
+
"""
|
| 154 |
+
print(url_params)
|
| 155 |
+
else:
|
| 156 |
+
bot_message = random.choice(["Yes", "No"])
|
| 157 |
+
history[-1][1] = bot_message
|
| 158 |
+
time.sleep(1)
|
| 159 |
+
return history'''
|
| 160 |
+
|
| 161 |
'''
|
| 162 |
WHERE {decisions_table}.session_index = '{session_index}'
|
| 163 |
|