Skip to content

Commit

Permalink
Environment variable credentials
Browse files Browse the repository at this point in the history
  • Loading branch information
tbeidlershenk committed Apr 17, 2024
1 parent 3a1c4c8 commit 4fdfef4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
15 changes: 9 additions & 6 deletions backend/src/ItemItemWithKNNRec.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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
Expand Down
1 change: 0 additions & 1 deletion backend/src/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 4fdfef4

Please sign in to comment.