aboutsummaryrefslogtreecommitdiff
path: root/db2pc.py
diff options
context:
space:
mode:
authornavanchauhan <navanchauhan@gmail.com>2022-05-21 11:11:59 -0600
committernavanchauhan <navanchauhan@gmail.com>2022-05-21 11:11:59 -0600
commit34965e2cdb026bfaf7facf5c520848ce19120251 (patch)
tree14e8e48fd619a5ca7eea117b5fe7a96a93ef671a /db2pc.py
parent4b78fbe5e6b79464c5a07174801f598c27127aaf (diff)
fixed code for pushing to pinecone
Diffstat (limited to 'db2pc.py')
-rw-r--r--db2pc.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/db2pc.py b/db2pc.py
index b6de15a..4acddcb 100644
--- a/db2pc.py
+++ b/db2pc.py
@@ -22,7 +22,7 @@ batch_size = 32
df = pd.read_sql("Select * from movies", engine)
df["combined_text"] = df["title"] + ": " + df["overview"].fillna('') + " - " + df["tagline"].fillna('') + " Genres:- " + df["genres"].fillna('')
-print(len(df["combined_text"].tolist()))
+print(f'Length of Combined Text: {len(df["combined_text"].tolist())}')
for x in tqdm(range(0,len(df),batch_size)):
to_send = []
@@ -31,7 +31,7 @@ for x in tqdm(range(0,len(df),batch_size)):
embeddings = model.encode(sentences)
for idx, value in enumerate(trakt_ids):
to_send.append(
- {
- value: embeddings[idx].tolist()
- })
- index.upsert(to_send)
+ (
+ str(value), embeddings[idx].tolist()
+ ))
+ index.upsert(to_send) \ No newline at end of file