Skip to content

Commit

Permalink
Added genre tags, imbdb elements for the front end and made unique co…
Browse files Browse the repository at this point in the history
…lor genre tags
  • Loading branch information
rishi2019194 committed Oct 16, 2023
1 parent 6efde38 commit c681a3f
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
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

0 comments on commit c681a3f

Please sign in to comment.