Adding result shower
This commit is contained in:
@@ -450,6 +450,25 @@ class DatabaseManager:
|
||||
filters["model_id"] = model_id
|
||||
return self.get_detections(filters)
|
||||
|
||||
def delete_detections_for_image(
|
||||
self, image_id: int, model_id: Optional[int] = None
|
||||
) -> int:
|
||||
"""Delete detections tied to a specific image and optional model."""
|
||||
conn = self.get_connection()
|
||||
try:
|
||||
cursor = conn.cursor()
|
||||
if model_id is not None:
|
||||
cursor.execute(
|
||||
"DELETE FROM detections WHERE image_id = ? AND model_id = ?",
|
||||
(image_id, model_id),
|
||||
)
|
||||
else:
|
||||
cursor.execute("DELETE FROM detections WHERE image_id = ?", (image_id,))
|
||||
conn.commit()
|
||||
return cursor.rowcount
|
||||
finally:
|
||||
conn.close()
|
||||
|
||||
def delete_detections_for_model(self, model_id: int) -> int:
|
||||
"""Delete all detections for a specific model."""
|
||||
conn = self.get_connection()
|
||||
|
||||
Reference in New Issue
Block a user