diff --git a/src/prediction_scripts/item_based.py b/src/prediction_scripts/item_based.py index 8eac546fc..887051dad 100644 --- a/src/prediction_scripts/item_based.py +++ b/src/prediction_scripts/item_based.py @@ -49,4 +49,6 @@ def recommend_for_new_user(user_rating): by="recommended", ascending=False, inplace=True ) - return list(join_movies_and_recommendations["title"][:201]) + return list(join_movies_and_recommendations["title"][:201]), \ + list(join_movies_and_recommendations["genres"][:201]), \ + list(join_movies_and_recommendations["imdb_id"][:201]) diff --git a/src/recommenderapp/app.py b/src/recommenderapp/app.py index 59f43f2f5..81a94c4f9 100644 --- a/src/recommenderapp/app.py +++ b/src/recommenderapp/app.py @@ -27,7 +27,7 @@ def landing_page(): """ Renders the landing page. """ - return render_template("landing_page.html") + return render_template("search_page.html") @app.route("/predict", methods=["POST"]) @@ -42,9 +42,9 @@ def predict(): movie_with_rating = {"title": movie, "rating": 5.0} if movie_with_rating not in training_data: training_data.append(movie_with_rating) - recommendations = recommend_for_new_user(training_data) - recommendations = recommendations[:10] - resp = {"recommendations": recommendations} + recommendations, genres, imdb_id = recommend_for_new_user(training_data) + recommendations, genres, imdb_id = recommendations[:10], genres[:10], imdb_id[:10] + resp = {"recommendations": recommendations, "genres": genres, "imdb_id":imdb_id} return resp diff --git a/src/recommenderapp/templates/landing_page.html b/src/recommenderapp/templates/search_page.html similarity index 100% rename from src/recommenderapp/templates/landing_page.html rename to src/recommenderapp/templates/search_page.html diff --git a/src/recommenderapp/utils.py b/src/recommenderapp/utils.py index f65e488ff..088ba6450 100644 --- a/src/recommenderapp/utils.py +++ b/src/recommenderapp/utils.py @@ -19,23 +19,23 @@ def create_colored_tags(genres): 'Musical': '#FF1493', # DeepPink 'Sci-Fi': '#00CED1', # DarkTurquoise 'Mystery': '#8A2BE2', # BlueViolet - 'Thriller': '#FF4500', # OrangeRed - 'Horror': '#FF0000', # Red + 'Thriller': '#FF6347', # Tomato + 'Horror': '#FF4500', # OrangeRed 'Documentary': '#228B22', # ForestGreen - 'Fantasy': '#FF8C00', # DarkOrange + 'Fantasy': '#FFA500', # Orange 'Adventure': '#FFD700', # Gold 'Children': '#32CD32', # LimeGreen - 'Film-Noir': '#000000', # Black - 'Comedy': '#FFD700', # Gold + 'Film-Noir': '#2F4F4F', # DarkSlateGray + 'Comedy': '#FFB500', # VividYellow 'Crime': '#8B0000', # DarkRed 'Drama': '#8B008B', # DarkMagenta - 'Western': '#FF6347', # Tomato - 'IMAX': '#7FFFD4', # Aquamarine - 'Action': '#FF4500', # OrangeRed + 'Western': '#FF8C00', # DarkOrange + 'IMAX': '#20B2AA', # LightSeaGreen + 'Action': '#FF0000', # Red 'War': '#B22222', # FireBrick '(no genres listed)': '#A9A9A9', # DarkGray 'Romance': '#FF69B4', # HotPink - 'Animation': '#20B2AA' # LightSeaGreen + 'Animation': '#4B0082' # Indigo } tags = [] for genre in genres: