Skip to content

Commit

Permalink
Merge pull request #12 from rishiraj/staging
Browse files Browse the repository at this point in the history
Staging
  • Loading branch information
rishiraj authored Apr 15, 2024
2 parents 51ecc20 + 94bd27a commit 2d8f0a4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
jax==0.4.26
sentence-transformers==2.6.1
sentence-transformers==2.6.1
pandas==2.0.3
8 changes: 8 additions & 0 deletions spanking/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import jax.numpy as jnp
import pickle
from sentence_transformers import SentenceTransformer
import pandas as pd

class VectorDB:
def __init__(self, model_name='BAAI/bge-base-en-v1.5'):
Expand Down Expand Up @@ -46,6 +47,13 @@ def save(self, file_path):
def load(file_path):
with open(file_path, 'rb') as file:
return pickle.load(file)

def to_df(self):
data = {
'text': self.texts,
'embedding': [embedding.tolist() for embedding in self.embeddings]
}
return pd.DataFrame(data)

def __len__(self):
return len(self.texts)
Expand Down

0 comments on commit 2d8f0a4

Please sign in to comment.