Yoxas commited on
Commit
4b71595
·
verified ·
1 Parent(s): 259ef44

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -1
app.py CHANGED
@@ -24,8 +24,12 @@ data['embedding'] = data['embedding'].apply(safe_json_loads)
24
  # Filter out any rows with empty embeddings
25
  data = data[data['embedding'].apply(lambda x: x.size > 0)]
26
 
 
 
 
 
27
  # Initialize FAISS index
28
- dimension = len(data['embedding'][0])
29
  res = faiss.StandardGpuResources() # use a single GPU
30
 
31
  # Check available GPU devices
 
24
  # Filter out any rows with empty embeddings
25
  data = data[data['embedding'].apply(lambda x: x.size > 0)]
26
 
27
+ # Check if the DataFrame is empty after filtering
28
+ if data.empty:
29
+ raise RuntimeError("No valid embeddings found in the data.")
30
+
31
  # Initialize FAISS index
32
+ dimension = len(data['embedding'].iloc[0])
33
  res = faiss.StandardGpuResources() # use a single GPU
34
 
35
  # Check available GPU devices