Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
Khoumbaa authored Feb 12, 2024
1 parent c8b3d88 commit 3c167b0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion app.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from flask import Flask, render_template, request
import random

app = Flask(__name__)

Expand All @@ -7,7 +8,9 @@ def get_recommendations(category, city):
with open(filename, 'r') as file:
places = [line.strip().split(', ') for line in file]

recommendations = [name for name, location in places if location.lower() == city.lower()]
filtered_recommendations = [name for name, location in places if location.lower() == city.lower()]

recommendations = random.sample(filtered_recommendations, min(5, len(filtered_recommendations)))

return recommendations

Expand Down

0 comments on commit 3c167b0

Please sign in to comment.