mustafa2ak commited on
Commit
6bba3db
·
verified ·
1 Parent(s): 23c579e

Update database.py

Browse files
Files changed (1) hide show
  1. database.py +4 -2
database.py CHANGED
@@ -281,7 +281,7 @@ class DogDatabase:
281
  return self.cursor.lastrowid # THIS LINE - make sure it returns the image_id
282
 
283
  def get_dog_images(self, dog_id: int, validated_only: bool = False,
284
- include_discarded: bool = False) -> List[Dict]:
285
  """Get all images for a dog"""
286
  query = "SELECT * FROM dog_images WHERE dog_id = ?"
287
  params = [dog_id]
@@ -294,9 +294,10 @@ class DogDatabase:
294
  query += " ORDER BY timestamp DESC"
295
 
296
  self.cursor.execute(query, params)
 
297
 
298
  images = []
299
- for row in self.cursor.fetchall():
300
  # Decode image
301
  image_bytes = base64.b64decode(row['image_data'])
302
  nparr = np.frombuffer(image_bytes, np.uint8)
@@ -316,6 +317,7 @@ class DogDatabase:
316
  })
317
 
318
  return images
 
319
 
320
  def validate_image(self, image_id: int, is_valid: bool = True):
321
  """Mark image as validated or discarded"""
 
281
  return self.cursor.lastrowid # THIS LINE - make sure it returns the image_id
282
 
283
  def get_dog_images(self, dog_id: int, validated_only: bool = False,
284
+ include_discarded: bool = False) -> List[Dict]:
285
  """Get all images for a dog"""
286
  query = "SELECT * FROM dog_images WHERE dog_id = ?"
287
  params = [dog_id]
 
294
  query += " ORDER BY timestamp DESC"
295
 
296
  self.cursor.execute(query, params)
297
+ rows = self.cursor.fetchall()
298
 
299
  images = []
300
+ for row in rows:
301
  # Decode image
302
  image_bytes = base64.b64decode(row['image_data'])
303
  nparr = np.frombuffer(image_bytes, np.uint8)
 
317
  })
318
 
319
  return images
320
+
321
 
322
  def validate_image(self, image_id: int, is_valid: bool = True):
323
  """Mark image as validated or discarded"""