Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -133,21 +133,19 @@ def respond(message, history, language, chatbot_mode, destinations, trip_length,
|
|
| 133 |
food_prefs = food_prefs or []
|
| 134 |
activity = activity or []
|
| 135 |
language = language or "English"
|
| 136 |
-
|
|
|
|
| 137 |
top_weather = get_top_chunks(message, chunk_embeddings_weather, cleaned_chunks_weather)
|
| 138 |
top_luggage = get_top_chunks(message, chunk_embeddings_luggage, cleaned_chunks_luggage)
|
| 139 |
top_attraction = get_top_chunks(message, chunk_embeddings_attraction, cleaned_chunks_attraction)
|
| 140 |
top_food = get_top_chunks(message, chunk_embeddings_food, cleaned_chunks_food)
|
| 141 |
-
print(top_weather)
|
| 142 |
-
print(top_luggage)
|
| 143 |
-
print(top_attraction)
|
| 144 |
-
print(top_food)
|
| 145 |
|
| 146 |
str_top_weather = "\n".join(top_weather)
|
| 147 |
str_top_luggage = "\n".join(top_luggage)
|
| 148 |
str_top_attraction = "\n".join(top_attraction)
|
| 149 |
str_top_food = "\n".join(top_food)
|
| 150 |
|
|
|
|
| 151 |
ctx = (
|
| 152 |
f"Language: {language}"
|
| 153 |
f"Destination: {', '.join(destinations) if destinations else 'Not specified'}\n"
|
|
@@ -159,9 +157,6 @@ def respond(message, history, language, chatbot_mode, destinations, trip_length,
|
|
| 159 |
f"Activity Preferences: {', '.join(activity) if activity else 'Not specified'}\n"
|
| 160 |
)
|
| 161 |
|
| 162 |
-
chatbot_purpose = f"Chatbot Mode: {chatbot_mode or 'Not specified'}"
|
| 163 |
-
print(chatbot_purpose)
|
| 164 |
-
|
| 165 |
if chatbot_mode == "Packing":
|
| 166 |
messages = [{
|
| 167 |
"role": "system",
|
|
@@ -236,7 +231,6 @@ def update_visibility(chatbot_mode):
|
|
| 236 |
else:
|
| 237 |
return gr.update(visible=True), gr.update(visible=True)
|
| 238 |
|
| 239 |
-
|
| 240 |
with gr.Blocks(theme=theme) as demo:
|
| 241 |
with gr.Row():
|
| 242 |
# βββ left column: your controls βββ
|
|
@@ -277,7 +271,6 @@ with gr.Blocks(theme=theme) as demo:
|
|
| 277 |
label="What is the size of your luggage (liters)?"
|
| 278 |
)
|
| 279 |
|
| 280 |
-
|
| 281 |
with gr.Group(visible=True) as food_group:
|
| 282 |
gr.Markdown("### Food")
|
| 283 |
food_prefs = gr.Dropdown(
|
|
@@ -317,8 +310,6 @@ with gr.Blocks(theme=theme) as demo:
|
|
| 317 |
]
|
| 318 |
)
|
| 319 |
|
| 320 |
-
|
| 321 |
-
|
| 322 |
with gr.Column(scale=3):
|
| 323 |
gr.Image(value="Go Buddy2.png", interactive=False, show_label=False)
|
| 324 |
|
|
|
|
| 133 |
food_prefs = food_prefs or []
|
| 134 |
activity = activity or []
|
| 135 |
language = language or "English"
|
| 136 |
+
|
| 137 |
+
#conduct a semantic search for each of our files
|
| 138 |
top_weather = get_top_chunks(message, chunk_embeddings_weather, cleaned_chunks_weather)
|
| 139 |
top_luggage = get_top_chunks(message, chunk_embeddings_luggage, cleaned_chunks_luggage)
|
| 140 |
top_attraction = get_top_chunks(message, chunk_embeddings_attraction, cleaned_chunks_attraction)
|
| 141 |
top_food = get_top_chunks(message, chunk_embeddings_food, cleaned_chunks_food)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 142 |
|
| 143 |
str_top_weather = "\n".join(top_weather)
|
| 144 |
str_top_luggage = "\n".join(top_luggage)
|
| 145 |
str_top_attraction = "\n".join(top_attraction)
|
| 146 |
str_top_food = "\n".join(top_food)
|
| 147 |
|
| 148 |
+
#collect inputed data from the sidebar elements
|
| 149 |
ctx = (
|
| 150 |
f"Language: {language}"
|
| 151 |
f"Destination: {', '.join(destinations) if destinations else 'Not specified'}\n"
|
|
|
|
| 157 |
f"Activity Preferences: {', '.join(activity) if activity else 'Not specified'}\n"
|
| 158 |
)
|
| 159 |
|
|
|
|
|
|
|
|
|
|
| 160 |
if chatbot_mode == "Packing":
|
| 161 |
messages = [{
|
| 162 |
"role": "system",
|
|
|
|
| 231 |
else:
|
| 232 |
return gr.update(visible=True), gr.update(visible=True)
|
| 233 |
|
|
|
|
| 234 |
with gr.Blocks(theme=theme) as demo:
|
| 235 |
with gr.Row():
|
| 236 |
# βββ left column: your controls βββ
|
|
|
|
| 271 |
label="What is the size of your luggage (liters)?"
|
| 272 |
)
|
| 273 |
|
|
|
|
| 274 |
with gr.Group(visible=True) as food_group:
|
| 275 |
gr.Markdown("### Food")
|
| 276 |
food_prefs = gr.Dropdown(
|
|
|
|
| 310 |
]
|
| 311 |
)
|
| 312 |
|
|
|
|
|
|
|
| 313 |
with gr.Column(scale=3):
|
| 314 |
gr.Image(value="Go Buddy2.png", interactive=False, show_label=False)
|
| 315 |
|