Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -96,35 +96,15 @@ with gr.Blocks() as demo:
|
|
| 96 |
{json.dumps(url_params, indent=4)}
|
| 97 |
"""
|
| 98 |
# Fetch personalized data
|
| 99 |
-
|
| 100 |
-
|
| 101 |
else:
|
| 102 |
bot_message = "Session index is missing."
|
| 103 |
else:
|
| 104 |
bot_message = "There was an error. Please try again."
|
| 105 |
history[-1][1] = bot_message
|
| 106 |
time.sleep(1)
|
| 107 |
-
return history
|
| 108 |
-
|
| 109 |
-
def get_session_index(url_params):
|
| 110 |
-
if url_params:
|
| 111 |
-
print(f"""
|
| 112 |
-
{url_params.value}
|
| 113 |
-
""")
|
| 114 |
-
session_index = url_params.value.get('session_index')
|
| 115 |
-
if session_index: # Check if session_index is not None or empty
|
| 116 |
-
print("This is your session_index:" + session_index)
|
| 117 |
-
# Fetch personalized data
|
| 118 |
-
#personalized_data = fetch_personalized_data(session_index)
|
| 119 |
-
#print(personalized_data)
|
| 120 |
-
else:
|
| 121 |
-
print("Session index is missing.")
|
| 122 |
-
else:
|
| 123 |
-
print("There are no URL parameters available.")
|
| 124 |
-
time.sleep(1)
|
| 125 |
-
return session_index
|
| 126 |
-
|
| 127 |
-
get_session_index(url_params)
|
| 128 |
|
| 129 |
msg.submit(user, inputs=[msg, url_params, chatbot], outputs=[msg, chatbot], queue=False).then(
|
| 130 |
fn=bot, inputs=[chatbot, url_params], outputs=[chatbot]
|
|
|
|
| 96 |
{json.dumps(url_params, indent=4)}
|
| 97 |
"""
|
| 98 |
# Fetch personalized data
|
| 99 |
+
personalized_data = fetch_personalized_data(session_index)
|
| 100 |
+
print(personalized_data)
|
| 101 |
else:
|
| 102 |
bot_message = "Session index is missing."
|
| 103 |
else:
|
| 104 |
bot_message = "There was an error. Please try again."
|
| 105 |
history[-1][1] = bot_message
|
| 106 |
time.sleep(1)
|
| 107 |
+
return history, session_index
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 108 |
|
| 109 |
msg.submit(user, inputs=[msg, url_params, chatbot], outputs=[msg, chatbot], queue=False).then(
|
| 110 |
fn=bot, inputs=[chatbot, url_params], outputs=[chatbot]
|