Navanihk commited on
Commit
2650ad9
·
1 Parent(s): 6f16ef5
recommend_normal.py CHANGED
@@ -28,8 +28,8 @@ def load_data():
28
 
29
  # Load movie data
30
  movies_data = load_data()
31
- vectorizer_path = hf_hub_download(repo_id=repo_id, filename="feature_vector.pkl")
32
- similarity_path = hf_hub_download(repo_id=repo_id, filename="model_similarity.pkl")
33
  def recommend_movies(movie_name):
34
  # Add the movie to the user's history
35
  if vectorizer_path and similarity_path:
 
28
 
29
  # Load movie data
30
  movies_data = load_data()
31
+ vectorizer_path = hf_hub_download(repo_id=repo_id, filename="feature_vector.pkl", cache_dir=cache_dir)
32
+ similarity_path = hf_hub_download(repo_id=repo_id, filename="model_similarity.pkl", cache_dir=cache_dir)
33
  def recommend_movies(movie_name):
34
  # Add the movie to the user's history
35
  if vectorizer_path and similarity_path:
recommendwithdesc.py CHANGED
@@ -27,8 +27,8 @@ def load_data():
27
 
28
  # Load movie data
29
  movies_data = load_data()
30
- model_vectorizer = hf_hub_download(repo_id=repo_id, filename="model_vectorizer.pkl")
31
- similarity_path = hf_hub_download(repo_id=repo_id, filename="model_similarity.pkl")
32
  with open(model_vectorizer, 'rb') as vec_file, open(similarity_path, 'rb') as sim_file:
33
  vectorizer = pickle.load(vec_file)
34
  similarity = pickle.load(sim_file)
 
27
 
28
  # Load movie data
29
  movies_data = load_data()
30
+ model_vectorizer = hf_hub_download(repo_id=repo_id, filename="model_vectorizer.pkl", cache_dir=cache_dir)
31
+ similarity_path = hf_hub_download(repo_id=repo_id, filename="model_similarity.pkl", cache_dir=cache_dir)
32
  with open(model_vectorizer, 'rb') as vec_file, open(similarity_path, 'rb') as sim_file:
33
  vectorizer = pickle.load(vec_file)
34
  similarity = pickle.load(sim_file)
recommendwithhist.py CHANGED
@@ -61,8 +61,8 @@ for feature in selected_features:
61
 
62
  # Combine features
63
  combined_features = movies_data['genres'] + ' ' + movies_data['keywords'] + ' ' + movies_data['tagline'] + ' ' + movies_data['cast'] + ' ' + movies_data['director']
64
- model_vectorizer = hf_hub_download(repo_id=repo_id, filename="model_vectorizer.pkl")
65
- similarity_path = hf_hub_download(repo_id=repo_id, filename="model_similarity.pkl")
66
  # Check if the model (vectorizer and similarity) exists
67
  if model_vectorizer and similarity_path:
68
  # Load the vectorizer and similarity matrix
 
61
 
62
  # Combine features
63
  combined_features = movies_data['genres'] + ' ' + movies_data['keywords'] + ' ' + movies_data['tagline'] + ' ' + movies_data['cast'] + ' ' + movies_data['director']
64
+ model_vectorizer = hf_hub_download(repo_id=repo_id, filename="model_vectorizer.pkl", cache_dir=cache_dir)
65
+ similarity_path = hf_hub_download(repo_id=repo_id, filename="model_similarity.pkl", cache_dir=cache_dir)
66
  # Check if the model (vectorizer and similarity) exists
67
  if model_vectorizer and similarity_path:
68
  # Load the vectorizer and similarity matrix