Yoxas commited on
Commit
3c00fbf
·
verified ·
1 Parent(s): f7cf69d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -18,9 +18,9 @@ data = dataset["train"]
18
 
19
  # Convert the string embeddings to numerical arrays
20
  def convert_and_ensure_2d_embeddings(example):
21
- # Convert the string to a numpy array
22
  embedding_str = example['embedding']
23
- embedding_str = embedding_str.replace('\n', ' ')
24
  embedding_list = list(map(float, embedding_str.strip("[]").split()))
25
  embeddings = np.array(embedding_list, dtype=np.float32)
26
  # Ensure the embeddings are 2-dimensional
 
18
 
19
  # Convert the string embeddings to numerical arrays
20
  def convert_and_ensure_2d_embeddings(example):
21
+ # Clean the embedding string
22
  embedding_str = example['embedding']
23
+ embedding_str = embedding_str.replace('\n', ' ').replace('...', '')
24
  embedding_list = list(map(float, embedding_str.strip("[]").split()))
25
  embeddings = np.array(embedding_list, dtype=np.float32)
26
  # Ensure the embeddings are 2-dimensional