Yoxas commited on
Commit
1f1368a
·
verified ·
1 Parent(s): 21336c5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -17,10 +17,10 @@ data = pd.read_csv('RBDx10kstats.csv')
17
  # Function to safely convert JSON strings to numpy arrays
18
  def safe_json_loads(x):
19
  try:
20
- return np.array(json.loads(x), dtype=np.float32) # Ensure the array is of type float32
21
  except json.JSONDecodeError as e:
22
  logging.error(f"Error decoding JSON: {e}")
23
- return np.array([], dtype=np.float32) # Return an empty array or handle it as appropriate
24
 
25
  # Apply the safe_json_loads function to the embedding column
26
  data['embedding'] = data['embedding'].apply(safe_json_loads)
 
17
  # Function to safely convert JSON strings to numpy arrays
18
  def safe_json_loads(x):
19
  try:
20
+ return np.array(json.loads(x), dtype=np.float16) # Ensure the array is of type float32
21
  except json.JSONDecodeError as e:
22
  logging.error(f"Error decoding JSON: {e}")
23
+ return np.array([], dtype=np.float16) # Return an empty array or handle it as appropriate
24
 
25
  # Apply the safe_json_loads function to the embedding column
26
  data['embedding'] = data['embedding'].apply(safe_json_loads)