Spaces:
Sleeping
Sleeping
Upload app.py
Browse files
app.py
CHANGED
@@ -136,6 +136,7 @@ def recommend_books(target_book: str, num_recommendations: int = 10) -> str:
|
|
136 |
|
137 |
if dataset is None or faiss_index is None or normalized_data is None or book_titles is None:
|
138 |
load_and_prepare_data()
|
|
|
139 |
|
140 |
target_book = target_book.lower()
|
141 |
# Fuzzy match the input to the closest book title
|
@@ -144,7 +145,7 @@ def recommend_books(target_book: str, num_recommendations: int = 10) -> str:
|
|
144 |
|
145 |
correlations = compute_correlations_faiss(faiss_index, book_titles, closest_match)
|
146 |
|
147 |
-
recommendations = correlations[correlations['book'] != target_book]
|
148 |
|
149 |
recommendations = recommendations.head(num_recommendations)
|
150 |
|
|
|
136 |
|
137 |
if dataset is None or faiss_index is None or normalized_data is None or book_titles is None:
|
138 |
load_and_prepare_data()
|
139 |
+
dataset = dataset.drop_duplicates(subset=['ISBN'])
|
140 |
|
141 |
target_book = target_book.lower()
|
142 |
# Fuzzy match the input to the closest book title
|
|
|
145 |
|
146 |
correlations = compute_correlations_faiss(faiss_index, book_titles, closest_match)
|
147 |
|
148 |
+
recommendations = correlations[correlations['book'] != target_book]
|
149 |
|
150 |
recommendations = recommendations.head(num_recommendations)
|
151 |
|