Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -17,12 +17,18 @@ dataset = load_dataset("Yoxas/statistical_literacyv2")
|
|
17 |
|
18 |
data = dataset["train"]
|
19 |
|
|
|
|
|
|
|
20 |
# Check the shape of the embeddings
|
21 |
-
print(
|
22 |
|
23 |
# Reshape the embeddings if necessary
|
24 |
-
if len(
|
25 |
-
|
|
|
|
|
|
|
26 |
|
27 |
data = data.add_faiss_index("Abstract_Embeddings")
|
28 |
|
|
|
17 |
|
18 |
data = dataset["train"]
|
19 |
|
20 |
+
# Convert the list to a numpy array
|
21 |
+
embeddings_array = np.array(data["Abstract_Embeddings"])
|
22 |
+
|
23 |
# Check the shape of the embeddings
|
24 |
+
print(embeddings_array.shape)
|
25 |
|
26 |
# Reshape the embeddings if necessary
|
27 |
+
if len(embeddings_array.shape) == 1:
|
28 |
+
embeddings_array = embeddings_array.reshape(-1, 1)
|
29 |
+
|
30 |
+
# Replace the list with the numpy array
|
31 |
+
data["Abstract_Embeddings"] = embeddings_array
|
32 |
|
33 |
data = data.add_faiss_index("Abstract_Embeddings")
|
34 |
|