Spaces:
Sleeping
Sleeping
Update utils.py
Browse files
utils.py
CHANGED
@@ -28,8 +28,8 @@ with open("ds.json") as f:
|
|
28 |
dataset = json.load(f)
|
29 |
|
30 |
# ✅ Precompute embeddings for dataset questions
|
31 |
-
dataset_inputs = [item.get("
|
32 |
-
dataset_answers = [item.get("
|
33 |
dataset_embeddings = similarity_model.encode(dataset_inputs, convert_to_tensor=True)
|
34 |
|
35 |
# ✅ Function to detect greetings
|
|
|
28 |
dataset = json.load(f)
|
29 |
|
30 |
# ✅ Precompute embeddings for dataset questions
|
31 |
+
dataset_inputs = [item.get("Question", "").lower().strip() for item in dataset]
|
32 |
+
dataset_answers = [item.get("Answer", "") for item in dataset]
|
33 |
dataset_embeddings = similarity_model.encode(dataset_inputs, convert_to_tensor=True)
|
34 |
|
35 |
# ✅ Function to detect greetings
|