mayank64ce commited on
Commit
ec572cb
·
verified ·
1 Parent(s): 3ccb8a7

Update app.py

Browse files

edited gaussian_blur docstring

Files changed (1) hide show
  1. app.py +13 -10
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 = 5, sigma: int = 0) -> str:
14
  """
15
- Applies Gaussian blur to an image.
16
-
 
 
 
17
  Args:
18
- image_path (str): Path to the input image.
19
- output_path (str): Path to save the blurred image.
20
- kernel_size (int): Size of the Gaussian kernel (default is 5).
21
- sigma (int): Standard deviation for Gaussian kernel (default is 0, which lets OpenCV decide).
22
-
23
  Returns:
24
- str: Path to the blurred image.
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