diff --git a/backend/src/ItemItemWithKNNRec.py b/backend/src/ItemItemWithKNNRec.py index c7ffd17..77f8042 100644 --- a/backend/src/ItemItemWithKNNRec.py +++ b/backend/src/ItemItemWithKNNRec.py @@ -8,7 +8,8 @@ from fuzzywuzzy import fuzz from google.cloud import firestore from google.oauth2 import service_account - +from google.auth.credentials import AnonymousCredentials +import json class ItemItemWithKNNRec: def __init__(self): @@ -25,11 +26,13 @@ def __init__(self): self.saved_kNN = joblib.load("src/kNN_model.joblib") def fetch_movie_info(self): - key_file_path = os.getcwd() + '/src/cinectmoviedb-665d236ba447.json' - print(key_file_path) - environ['GOOGLE_APPLICATION_CREDENTIALS'] = key_file_path - project = 'cinectmoviedb' - client = firestore.Client(project=project, database='cinectdatabase') + # key_file_path = os.getcwd() + '/src/cinectmoviedb-665d236ba447.json' + # print(key_file_path) + # environ['GOOGLE_APPLICATION_CREDENTIALS'] = key_file_path + # project = 'cinectmoviedb' + # client = firestore.Client(project=project, database='cinectdatabase') + json_str = json.loads(environ['CREDENTIALS']) + client = firestore.Client.from_service_account_info(json_str, database='cinectdatabase') collection_ref = client.collection('movie_info') page_size = 50 diff --git a/backend/src/api.py b/backend/src/api.py index 89bc624..4e50444 100644 --- a/backend/src/api.py +++ b/backend/src/api.py @@ -28,7 +28,6 @@ def verify_user(): def get_recommendation(): json_str = str(request.args.get("data")) json_obj = json.loads(json_str) - input_movie_list = extract_titles(json_obj["users"]) genres = json_obj["genres"] try: