Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -116,8 +116,7 @@ class Chatbot():
|
|
116 |
openai.api_key = os.getenv('OPENAI_API_KEY')
|
117 |
embedding_model = "text-embedding-ada-002"
|
118 |
# This is going to create embeddings for subsets of the PDF
|
119 |
-
embeddings = np.vstack(df.text.apply(lambda x: get_embedding(x, engine=embedding_model)))
|
120 |
-
embeddings = np.array(embeddings, dtype=np.float32)
|
121 |
return embeddings
|
122 |
|
123 |
def search_embeddings(self, embeddings, df, query, n=3, pprint=True):
|
|
|
116 |
openai.api_key = os.getenv('OPENAI_API_KEY')
|
117 |
embedding_model = "text-embedding-ada-002"
|
118 |
# This is going to create embeddings for subsets of the PDF
|
119 |
+
embeddings = np.vstack(df[df['text'].apply(lambda x: isinstance(x, str))]['text'].apply(lambda x: get_embedding(x, engine=embedding_model)))
|
|
|
120 |
return embeddings
|
121 |
|
122 |
def search_embeddings(self, embeddings, df, query, n=3, pprint=True):
|