Spaces:
Running
Running
Deepak Sahu
commited on
Commit
·
918ec9f
1
Parent(s):
ba0a0d3
Update z_embedding.py
Browse files- z_embedding.py +2 -2
z_embedding.py
CHANGED
@@ -53,10 +53,10 @@ def dataframe_compute_summary_vector(books_df: pd.DataFrame) -> np.ndarray:
|
|
53 |
|
54 |
return summary_vectors
|
55 |
|
56 |
-
def get_embeddings(summaries: list[str]) -> np.ndarray:
|
57 |
'''Utils function to to take in hypothetical document(s) and return the embedding of it(s)
|
58 |
'''
|
59 |
-
|
60 |
if isinstance(summaries, str):
|
61 |
summaries = [summaries, ]
|
62 |
return model.encode(summaries)
|
|
|
53 |
|
54 |
return summary_vectors
|
55 |
|
56 |
+
def get_embeddings(summaries: list[str], model = None) -> np.ndarray:
|
57 |
'''Utils function to to take in hypothetical document(s) and return the embedding of it(s)
|
58 |
'''
|
59 |
+
model = model if model else load_model()
|
60 |
if isinstance(summaries, str):
|
61 |
summaries = [summaries, ]
|
62 |
return model.encode(summaries)
|