Spaces:
Sleeping
Sleeping
Commit
·
589adec
1
Parent(s):
068bc79
Update utils.py
Browse files
utils.py
CHANGED
@@ -7,13 +7,8 @@ def preprocess_image(img_path):
|
|
7 |
img = Image.open(img_path)
|
8 |
img = img.resize((256, 256))
|
9 |
img_array = np.array(img)
|
10 |
-
img_array = img_array[:, :, :3] # Keep only the first three channels (RGB)
|
11 |
-
img_array = np.expand_dims(img_array, axis=0) # Add an extra dimension for batch size
|
12 |
-
img_array = img_array / 255.0 # Normalize pixel values to the range [0, 1]
|
13 |
return img_array
|
14 |
|
15 |
-
|
16 |
-
|
17 |
# Function to classify the garbage
|
18 |
def classify_garbage(img_path, model):
|
19 |
processed_img = preprocess_image(img_path)
|
|
|
7 |
img = Image.open(img_path)
|
8 |
img = img.resize((256, 256))
|
9 |
img_array = np.array(img)
|
|
|
|
|
|
|
10 |
return img_array
|
11 |
|
|
|
|
|
12 |
# Function to classify the garbage
|
13 |
def classify_garbage(img_path, model):
|
14 |
processed_img = preprocess_image(img_path)
|