diff --git a/Code/recommenderapp/app.py b/Code/recommenderapp/app.py index 4b9b50fa6..10f5a009f 100644 --- a/Code/recommenderapp/app.py +++ b/Code/recommenderapp/app.py @@ -1,7 +1,7 @@ """ Module for routing all calls from the frontend """ - +from Code.prediction_scripts.item_based import recommend_for_new_user import json import sys from search import Search @@ -10,7 +10,7 @@ from utils import send_email_to_user, beautify_feedback_data sys.path.append("../../") -from Code.prediction_scripts.item_based import recommend_for_new_user + app = Flask(__name__) app.secret_key = "secret key" diff --git a/Code/recommenderapp/utils.py b/Code/recommenderapp/utils.py index 3b588d3e7..4280dddfb 100644 --- a/Code/recommenderapp/utils.py +++ b/Code/recommenderapp/utils.py @@ -37,9 +37,9 @@ def create_colored_tags(genres): } tags = [] for genre in genres: - color = genre_colors.get(genre, '#CCCCCC') # Default color if not found - tag = f'{genre}' - tags.append(tag) + color = genre_colors.get(genre, '#CCCCCC') # Default color if not found + tag = f'{genre}' + tags.append(tag) return ' '.join(tags) @@ -87,23 +87,25 @@ def send_email_to_user(recipient_email, categorized_data): message['From'] = sender_email message['To'] = recipient_email message['Subject'] = subject - # Load the CSV file into a DataFrame movie_genre_df = pd.read_csv('../../data/movies.csv') # Create a dictionary to map movies to their genres movie_to_genres = {} - for index, row in movie_genre_df.iterrows(): + for row in movie_genre_df.rows(): movie = row['title'] genres = row['genres'].split('|') movie_to_genres[movie] = genres # Create the email message with HTML content html_content = c.EMAIL_HTML_CONTENT.format( - '\n'.join(f'