Spaces:
Paused
Paused
Update inference.py
Browse files- inference.py +8 -3
inference.py
CHANGED
@@ -34,17 +34,22 @@ class Inference():
|
|
34 |
raise ValueError(f"Error processing image {idx}: {str(e)}")
|
35 |
|
36 |
return prepared_images
|
37 |
-
|
38 |
-
|
|
|
39 |
"""
|
40 |
Classify building type from a list of PIL Image objects
|
41 |
Args:
|
42 |
images: List of PIL Image objects
|
|
|
43 |
Returns:
|
44 |
Classification response
|
45 |
"""
|
46 |
logger.info(f"Preparing {len(images)} images for classification")
|
|
|
|
|
|
|
47 |
prepared_images = self._prepare_images(images)
|
48 |
logger.info(f"Image preparation successful")
|
49 |
-
response = self.classifier.get_response(prepared_images)
|
50 |
return response
|
|
|
34 |
raise ValueError(f"Error processing image {idx}: {str(e)}")
|
35 |
|
36 |
return prepared_images
|
37 |
+
|
38 |
+
|
39 |
+
def classify_building(self, images: List[Image.Image], saved_image_paths: List[str] = None) -> dict:
|
40 |
"""
|
41 |
Classify building type from a list of PIL Image objects
|
42 |
Args:
|
43 |
images: List of PIL Image objects
|
44 |
+
saved_image_paths: List of paths where images were saved to disk (optional)
|
45 |
Returns:
|
46 |
Classification response
|
47 |
"""
|
48 |
logger.info(f"Preparing {len(images)} images for classification")
|
49 |
+
if saved_image_paths:
|
50 |
+
logger.info(f"Images saved to disk at: {saved_image_paths}")
|
51 |
+
|
52 |
prepared_images = self._prepare_images(images)
|
53 |
logger.info(f"Image preparation successful")
|
54 |
+
response = self.classifier.get_response(prepared_images, saved_image_paths)
|
55 |
return response
|