Spaces:
Sleeping
Sleeping
Commit
·
e8ef14f
1
Parent(s):
8fc5d37
fix: define the function before loading the model
Browse files
app.py
CHANGED
@@ -9,8 +9,6 @@ from fastai.vision.all import load_learner, PILImage, PILMask
|
|
9 |
|
10 |
MODEL_PATH = Path('.') / 'models'
|
11 |
TEST_IMAGES_PATH = Path('.') / 'test'
|
12 |
-
LEARNER = load_learner(MODEL_PATH / 'car-segmentation_v1.pkl')
|
13 |
-
|
14 |
|
15 |
def preprocess_mask(file_name):
|
16 |
"""Ensures masks are in grayscale format and removes transparency."""
|
@@ -38,6 +36,8 @@ def preprocess_mask(file_name):
|
|
38 |
# Convert to grayscale after handling transparency
|
39 |
return PILMask.create(mask.convert('L'))
|
40 |
|
|
|
|
|
41 |
|
42 |
def segment_image(image):
|
43 |
image = PILImage.create(image)
|
|
|
9 |
|
10 |
MODEL_PATH = Path('.') / 'models'
|
11 |
TEST_IMAGES_PATH = Path('.') / 'test'
|
|
|
|
|
12 |
|
13 |
def preprocess_mask(file_name):
|
14 |
"""Ensures masks are in grayscale format and removes transparency."""
|
|
|
36 |
# Convert to grayscale after handling transparency
|
37 |
return PILMask.create(mask.convert('L'))
|
38 |
|
39 |
+
LEARNER = load_learner(MODEL_PATH / 'car-segmentation_v1.pkl')
|
40 |
+
|
41 |
|
42 |
def segment_image(image):
|
43 |
image = PILImage.create(image)
|