Update app.py
Browse files
app.py
CHANGED
|
@@ -21,10 +21,9 @@ def preprocess_image(image, target_size=(192, 176)):
|
|
| 21 |
|
| 22 |
# Salt-and-pepper noise function
|
| 23 |
def add_salt_and_pepper_noise(image, amount=0.05):
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
"""
|
| 28 |
img_array = np.array(image)
|
| 29 |
# Salt noise
|
| 30 |
num_salt = np.ceil(amount * img_array.size * 0.5)
|
|
|
|
| 21 |
|
| 22 |
# Salt-and-pepper noise function
|
| 23 |
def add_salt_and_pepper_noise(image, amount=0.05):
|
| 24 |
+
# image: PIL Image in grayscale ('L') or RGB
|
| 25 |
+
# amount: fraction of pixels to corrupt
|
| 26 |
+
|
|
|
|
| 27 |
img_array = np.array(image)
|
| 28 |
# Salt noise
|
| 29 |
num_salt = np.ceil(amount * img_array.size * 0.5)
|