Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added genre tags, imdb elements for the front end and made unique co… #31

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/prediction_scripts/item_based.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,4 @@ 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])
8 changes: 4 additions & 4 deletions src/recommenderapp/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"])
Expand All @@ -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


Expand Down
18 changes: 9 additions & 9 deletions src/recommenderapp/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down