Spaces:
Sleeping
Sleeping
ddovidovich
commited on
Commit
·
5e7f51f
1
Parent(s):
6ecdc04
Update app.py
Browse files
app.py
CHANGED
@@ -20,13 +20,7 @@ def list_to_numpy(obj):
|
|
20 |
def load_documents_from_jsonl(embeddings_model, jsonl_path, createEmbeddings=False):
|
21 |
tqdm.pandas(desc="Loading Data")
|
22 |
df = pd.read_json(jsonl_path, lines=True).progress_apply(lambda x: x)
|
23 |
-
|
24 |
df.columns = ['Question' if 'Question' in col else 'Answer' if 'Answer' in col else col for col in df.columns]
|
25 |
-
|
26 |
-
if createEmbeddings:
|
27 |
-
tqdm.pandas(desc="Creating Embeddings")
|
28 |
-
df['Embeddings'] = df.progress_apply(lambda x: embeddings_model.encode(f"Question: {x['Question']} \n Answer: {x['Answer']}").tolist(), axis=1)
|
29 |
-
|
30 |
return df
|
31 |
|
32 |
def generate_embeddings(tokenizer, model, text):
|
|
|
20 |
def load_documents_from_jsonl(embeddings_model, jsonl_path, createEmbeddings=False):
|
21 |
tqdm.pandas(desc="Loading Data")
|
22 |
df = pd.read_json(jsonl_path, lines=True).progress_apply(lambda x: x)
|
|
|
23 |
df.columns = ['Question' if 'Question' in col else 'Answer' if 'Answer' in col else col for col in df.columns]
|
|
|
|
|
|
|
|
|
|
|
24 |
return df
|
25 |
|
26 |
def generate_embeddings(tokenizer, model, text):
|