Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -13,18 +13,6 @@ def process_image(input_image):
|
|
| 13 |
model_seg = load_segformer(PATH_model_seg)
|
| 14 |
model_det = load_yolo(PATH_model_det)
|
| 15 |
|
| 16 |
-
# Convert the input image to a numpy array if necessary
|
| 17 |
-
if isinstance(input_image, str):
|
| 18 |
-
# If the input is a file path, open the image using PIL
|
| 19 |
-
input_image = Image.open(input_image)
|
| 20 |
-
|
| 21 |
-
if isinstance(input_image, Image.Image):
|
| 22 |
-
# Convert PIL image to numpy array
|
| 23 |
-
input_image = np.array(input_image)
|
| 24 |
-
|
| 25 |
-
if not isinstance(input_image, np.ndarray):
|
| 26 |
-
raise ValueError("Input image is not a valid format (string path, PIL image, or numpy array)")
|
| 27 |
-
|
| 28 |
output_image = run(input_image, model_seg, model_det, image_size, target_distances, num_ys=num_ys)
|
| 29 |
return output_image
|
| 30 |
|
|
|
|
| 13 |
model_seg = load_segformer(PATH_model_seg)
|
| 14 |
model_det = load_yolo(PATH_model_det)
|
| 15 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
output_image = run(input_image, model_seg, model_det, image_size, target_distances, num_ys=num_ys)
|
| 17 |
return output_image
|
| 18 |
|