Spaces:
Runtime error
Runtime error
Update app.py
Browse filesedited gaussian_blur docstring
app.py
CHANGED
|
@@ -10,24 +10,27 @@ from Gradio_UI import GradioUI
|
|
| 10 |
|
| 11 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
| 12 |
@tool
|
| 13 |
-
def gaussian_blur(image_path: str, output_path: str, kernel_size: int
|
| 14 |
"""
|
| 15 |
-
Applies Gaussian blur to an image.
|
| 16 |
-
|
|
|
|
|
|
|
|
|
|
| 17 |
Args:
|
| 18 |
-
image_path (str):
|
| 19 |
-
output_path (str):
|
| 20 |
-
kernel_size (int):
|
| 21 |
-
sigma (int):
|
| 22 |
-
|
| 23 |
Returns:
|
| 24 |
-
str:
|
| 25 |
"""
|
| 26 |
image = cv2.imread(image_path)
|
| 27 |
if image is None:
|
| 28 |
raise ValueError(f"Could not load image from {image_path}")
|
| 29 |
|
| 30 |
-
# Ensure kernel_size is an odd number
|
| 31 |
if kernel_size % 2 == 0:
|
| 32 |
kernel_size += 1
|
| 33 |
|
|
|
|
| 10 |
|
| 11 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
| 12 |
@tool
|
| 13 |
+
def gaussian_blur(image_path: str, output_path: str, kernel_size: int, sigma: int) -> str:
|
| 14 |
"""
|
| 15 |
+
Applies Gaussian blur to an image and saves the output.
|
| 16 |
+
|
| 17 |
+
This function reads an image, applies a Gaussian blur with the given
|
| 18 |
+
kernel size and sigma, and saves the processed image to the output path.
|
| 19 |
+
|
| 20 |
Args:
|
| 21 |
+
image_path (str): The file path of the input image.
|
| 22 |
+
output_path (str): The file path where the blurred image will be saved.
|
| 23 |
+
kernel_size (int): The size of the Gaussian blur kernel (must be an odd number).
|
| 24 |
+
sigma (int): The standard deviation for the Gaussian kernel.
|
| 25 |
+
|
| 26 |
Returns:
|
| 27 |
+
str: The path to the saved blurred image.
|
| 28 |
"""
|
| 29 |
image = cv2.imread(image_path)
|
| 30 |
if image is None:
|
| 31 |
raise ValueError(f"Could not load image from {image_path}")
|
| 32 |
|
| 33 |
+
# Ensure kernel_size is an odd number (OpenCV requires it)
|
| 34 |
if kernel_size % 2 == 0:
|
| 35 |
kernel_size += 1
|
| 36 |
|