Spaces:
Runtime error
Runtime error
Update app.py
Browse files
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.
|
21 |
except json.JSONDecodeError as e:
|
22 |
logging.error(f"Error decoding JSON: {e}")
|
23 |
-
return np.array([], dtype=np.
|
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)
|