Yoxas commited on
Commit
86d4425
·
verified ·
1 Parent(s): 6c4a2c9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -9,14 +9,14 @@ import spaces
9
  data = pd.read_csv('RB10kstats.csv')
10
 
11
  # Convert embedding column from string to numpy array
12
- data['embedding'] = data['embedding'].apply(lambda x: np.fromstring(x[1:-1], sep=', '))
13
 
14
  # Initialize FAISS index
15
- dimension = len(data['embedding'][0])
16
  res = faiss.StandardGpuResources() # use a single GPU
17
  index = faiss.IndexFlatL2(dimension)
18
  gpu_index = faiss.index_cpu_to_gpu(res, 0, index) # move to GPU
19
- gpu_index.add(np.stack(data['embedding'].values))
20
 
21
  # Check if GPU is available
22
  device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
 
9
  data = pd.read_csv('RB10kstats.csv')
10
 
11
  # Convert embedding column from string to numpy array
12
+ data['embeddings'] = data['embeddings'].apply(lambda x: np.fromstring(x[1:-1], sep=', '))
13
 
14
  # Initialize FAISS index
15
+ dimension = len(data['embeddings'][0])
16
  res = faiss.StandardGpuResources() # use a single GPU
17
  index = faiss.IndexFlatL2(dimension)
18
  gpu_index = faiss.index_cpu_to_gpu(res, 0, index) # move to GPU
19
+ gpu_index.add(np.stack(data['embeddings'].values))
20
 
21
  # Check if GPU is available
22
  device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')