diff options
-rw-r--r-- | app.py | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -14,6 +14,8 @@ app = Flask(__name__) with open("./data/beer_info_small.json") as beers_json: beer = json.loads(beers_json.read()) +beers_for_random = [b for b in beer if beer[b][3] > 75] +print(len(beers_for_random)) with open('./data/brewery_names.json') as f: brewery_names = json.load(f) ATTRS = ['Barnyardy', @@ -52,7 +54,7 @@ def index(): @app.route('/random') def random_beer(): - rando = random.choice(list(beer.keys())).split('-') + rando = random.choice(list(beers_for_random)).split('-') return redirect(url_for('get_beer_details', brewery_id=rando[0], beer_id=rando[1])) @@ -70,7 +72,7 @@ def get_beer_details(brewery_id, beer_id): similar_beers = get_closest(full_id) style_map = get_style_preds(full_id) - + print('Style Map:{}'.format(style_map)) similar_beer_objects = [] for item in similar_beers: item_result, item_brewer = beer_lookup(item) |