ychafiqui commited on
Commit
b7e9fbb
1 Parent(s): a8a7e6d

fixed filtering bug by removing count from part name

Browse files
Files changed (1) hide show
  1. functions.py +2 -0
functions.py CHANGED
@@ -28,6 +28,8 @@ def get_car_parts_count():
28
  def get_random_image(parts_filter=False):
29
  not_validated_imgs = df[df["validated"] == False]["img_name"].tolist()
30
  if parts_filter:
 
 
31
  # get rows where all selected parts are damaged (> 0)
32
  filtered_imgs = df[(df[parts_filter] > 0).all(axis=1)]["img_name"].tolist()
33
  not_validated_imgs = list(set(not_validated_imgs) & set(filtered_imgs))
 
28
  def get_random_image(parts_filter=False):
29
  not_validated_imgs = df[df["validated"] == False]["img_name"].tolist()
30
  if parts_filter:
31
+ # remove the count from the part name
32
+ parts_filter = [part.split(" (")[0] for part in parts_filter]
33
  # get rows where all selected parts are damaged (> 0)
34
  filtered_imgs = df[(df[parts_filter] > 0).all(axis=1)]["img_name"].tolist()
35
  not_validated_imgs = list(set(not_validated_imgs) & set(filtered_imgs))