Spaces:
Sleeping
Sleeping
Upload app.py
Browse files
app.py
CHANGED
|
@@ -46,13 +46,13 @@ def get_recommendations_and_generate(query_text, k=3):
|
|
| 46 |
idx = int(idx_numpy)
|
| 47 |
trip_plan = {
|
| 48 |
"dest": dataset['test']['dest'][idx],
|
| 49 |
-
"
|
| 50 |
"reference_information": dataset['test']['reference_information'][idx]
|
| 51 |
}
|
| 52 |
results.append(trip_plan)
|
| 53 |
|
| 54 |
while len(results) < 3:
|
| 55 |
-
results.append({"dest": "No trip plan found", "
|
| 56 |
|
| 57 |
# 2. Create a prompt for the generative model
|
| 58 |
prompt = f"Write a complete travel plan that includes a title and a day-by-day itinerary. The trip must be about: {query_text}."
|
|
@@ -89,7 +89,7 @@ def format_trip_plan(trip):
|
|
| 89 |
# Formats the recommended trips with markdown
|
| 90 |
if not trip:
|
| 91 |
return "### No similar trip plan found."
|
| 92 |
-
return f"### {trip['
|
| 93 |
|
| 94 |
def format_generated_trip(trip_text):
|
| 95 |
return trip_text
|
|
|
|
| 46 |
idx = int(idx_numpy)
|
| 47 |
trip_plan = {
|
| 48 |
"dest": dataset['test']['dest'][idx],
|
| 49 |
+
"days": dataset['test']['days'][idx],
|
| 50 |
"reference_information": dataset['test']['reference_information'][idx]
|
| 51 |
}
|
| 52 |
results.append(trip_plan)
|
| 53 |
|
| 54 |
while len(results) < 3:
|
| 55 |
+
results.append({"dest": "No trip plan found", "days":"", "reference_information": ""})
|
| 56 |
|
| 57 |
# 2. Create a prompt for the generative model
|
| 58 |
prompt = f"Write a complete travel plan that includes a title and a day-by-day itinerary. The trip must be about: {query_text}."
|
|
|
|
| 89 |
# Formats the recommended trips with markdown
|
| 90 |
if not trip:
|
| 91 |
return "### No similar trip plan found."
|
| 92 |
+
return f"### {trip['days']}-days trip to {trip['dest'].upper()}\n**Suggested Plan:**\n{trip['reference_information']}"
|
| 93 |
|
| 94 |
def format_generated_trip(trip_text):
|
| 95 |
return trip_text
|