Spaces:
Runtime error
Runtime error
Commit ·
89c1167
1
Parent(s): 8f34205
Update app.py
Browse files
app.py
CHANGED
|
@@ -18,18 +18,8 @@ if huggingface_token is None:
|
|
| 18 |
raise ValueError("Hugging Face token not found. Please set the HUGGINGFACE_TOKEN environment variable.")
|
| 19 |
|
| 20 |
|
| 21 |
-
# # Define a custom transform for Gaussian blur
|
| 22 |
-
# def gaussian_blur(x, p=0.5, kernel_size_min=3, kernel_size_max=9, sigma_min=0.1, sigma_max=2):
|
| 23 |
-
# if x.ndim == 4:
|
| 24 |
-
# for i in range(x.shape[0]):
|
| 25 |
-
# if random.random() < p:
|
| 26 |
-
# kernel_size = random.randrange(kernel_size_min, kernel_size_max + 1, 2)
|
| 27 |
-
# sigma = random.uniform(sigma_min, sigma_max)
|
| 28 |
-
# x[i] = GaussianBlur(kernel_size=kernel_size, sigma=sigma)(x[i])
|
| 29 |
-
# return x
|
| 30 |
-
|
| 31 |
# Define a custom transform for Gaussian blur
|
| 32 |
-
def gaussian_blur(x, p=0.5, kernel_size_min=3, kernel_size_max=
|
| 33 |
if x.ndim == 4:
|
| 34 |
for i in range(x.shape[0]):
|
| 35 |
if random.random() < p:
|
|
@@ -38,6 +28,16 @@ def gaussian_blur(x, p=0.5, kernel_size_min=3, kernel_size_max=20, sigma_min=0.1
|
|
| 38 |
x[i] = GaussianBlur(kernel_size=kernel_size, sigma=sigma)(x[i])
|
| 39 |
return x
|
| 40 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
# this function only describes how much a singular value in al ist stands out.
|
| 42 |
# if all values in the lsit are high or low this is 1
|
| 43 |
# the smaller the proportiopn of number of disimilar vlaues are to other more similar values the lower this number
|
|
|
|
| 18 |
raise ValueError("Hugging Face token not found. Please set the HUGGINGFACE_TOKEN environment variable.")
|
| 19 |
|
| 20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
# Define a custom transform for Gaussian blur
|
| 22 |
+
def gaussian_blur(x, p=0.5, kernel_size_min=3, kernel_size_max=9, sigma_min=0.1, sigma_max=2):
|
| 23 |
if x.ndim == 4:
|
| 24 |
for i in range(x.shape[0]):
|
| 25 |
if random.random() < p:
|
|
|
|
| 28 |
x[i] = GaussianBlur(kernel_size=kernel_size, sigma=sigma)(x[i])
|
| 29 |
return x
|
| 30 |
|
| 31 |
+
# # Define a custom transform for Gaussian blur
|
| 32 |
+
# def gaussian_blur(x, p=0.5, kernel_size_min=3, kernel_size_max=20, sigma_min=0.1, sigma_max=3):
|
| 33 |
+
# if x.ndim == 4:
|
| 34 |
+
# for i in range(x.shape[0]):
|
| 35 |
+
# if random.random() < p:
|
| 36 |
+
# kernel_size = random.randrange(kernel_size_min, kernel_size_max + 1, 2)
|
| 37 |
+
# sigma = random.uniform(sigma_min, sigma_max)
|
| 38 |
+
# x[i] = GaussianBlur(kernel_size=kernel_size, sigma=sigma)(x[i])
|
| 39 |
+
# return x
|
| 40 |
+
|
| 41 |
# this function only describes how much a singular value in al ist stands out.
|
| 42 |
# if all values in the lsit are high or low this is 1
|
| 43 |
# the smaller the proportiopn of number of disimilar vlaues are to other more similar values the lower this number
|