Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -45,9 +45,10 @@ embeddings = np.load("netflix_embeddings.npy") #created using sentence_transfor
|
|
45 |
metadata = pd.read_csv("netflix_metadata.csv") #created using sentence_transformers on kaggle
|
46 |
|
47 |
# Vector search function
|
48 |
-
def vector_search(query,
|
49 |
query_embedding = sentence_model.encode(query)
|
50 |
similarities = cosine_similarity([query_embedding], embeddings)[0]
|
|
|
51 |
top_indices = similarities.argsort()[-top_n:][::-1]
|
52 |
results = metadata.iloc[top_indices]
|
53 |
result_text=""
|
|
|
45 |
metadata = pd.read_csv("netflix_metadata.csv") #created using sentence_transformers on kaggle
|
46 |
|
47 |
# Vector search function
|
48 |
+
def vector_search(query,response_amount=3):
|
49 |
query_embedding = sentence_model.encode(query)
|
50 |
similarities = cosine_similarity([query_embedding], embeddings)[0]
|
51 |
+
top_n=response_amount
|
52 |
top_indices = similarities.argsort()[-top_n:][::-1]
|
53 |
results = metadata.iloc[top_indices]
|
54 |
result_text=""
|