diff --git a/mysql-code/init-db.py b/mysql-code/init-db.py deleted file mode 100644 index a222193..0000000 --- a/mysql-code/init-db.py +++ /dev/null @@ -1,4 +0,0 @@ -import subprocess - -if (subprocess.run("mysql -u root mysql < mysql-code/Schema.sql", shell=True, check=True)): - print("successfully created the Marketplace databse") diff --git a/recommondation-engine/__pycache__/example1.cpython-313.pyc b/recommondation-engine/__pycache__/example1.cpython-313.pyc new file mode 100644 index 0000000..e8fb963 Binary files /dev/null and b/recommondation-engine/__pycache__/example1.cpython-313.pyc differ diff --git a/recommondation-engine/example1.py b/recommondation-engine/example1.py index 9a8ad35..621469d 100644 --- a/recommondation-engine/example1.py +++ b/recommondation-engine/example1.py @@ -1,7 +1,6 @@ # pip install mysql.connector import mysql.connector -from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.metrics.pairwise import cosine_similarity import numpy as np import logging @@ -108,6 +107,3 @@ def get_recommendations(user_id, top_n=40): except Exception as e: logging.error(f"Recommendation error for user {user_id}: {str(e)}") # return get_popular_products(top_n) # Fallback to popular products - - -get_recommendations(1) diff --git a/recommondation-engine/server.py b/recommondation-engine/server.py index 89850b1..c371a3c 100644 --- a/recommondation-engine/server.py +++ b/recommondation-engine/server.py @@ -1,5 +1,8 @@ from flask import Flask, request, jsonify from flask_cors import CORS +from example1 import get_recommendations +import time + app = Flask(__name__) CORS(app) # Enable CORS for all routes @@ -15,6 +18,9 @@ def handle_session_data(): if not user_id or not email or is_authenticated is None: return jsonify({'error': 'Invalid data'}), 400 + print(get_recommendations(user_id)) + time.sleep(2) + print(f"Received session data: User ID: {user_id}, Email: {email}, Authenticated: {is_authenticated}") return jsonify({'message': 'Session data received successfully'})