mayank64ce commited on
Commit
1375074
·
verified ·
1 Parent(s): f6d3524

Update app.py

Browse files

updated display_image

Files changed (1) hide show
  1. app.py +13 -5
app.py CHANGED
@@ -36,20 +36,28 @@ def gaussian_blur(image_path: str, output_path: str, kernel_size: int, sigma: in
36
  return output_path
37
 
38
  @tool
39
- def display_image(image_path: str) -> None:
40
  """
41
- Opens and displays an image using Pillow.
 
 
 
42
 
43
  Args:
44
- image_path: The file path of the image to be displayed.
 
 
 
 
 
 
45
  """
46
  try:
47
  image = Image.open(image_path)
48
- image.show()
49
  except Exception as e:
50
  raise ValueError(f"Error opening image: {e}")
51
 
52
-
53
  @tool
54
  def get_current_time_in_timezone(timezone: str) -> str:
55
  """A tool that fetches the current local time in a specified timezone.
 
36
  return output_path
37
 
38
  @tool
39
+ def display_image(image_path: str) -> Image.Image:
40
  """
41
+ Loads and returns an image from the specified file path.
42
+
43
+ This function opens an image using Pillow and returns the loaded image object.
44
+ It raises an error if the file cannot be found or opened.
45
 
46
  Args:
47
+ image_path: The path to the image file.
48
+
49
+ Returns:
50
+ Image.Image: The loaded image object.
51
+
52
+ Raises:
53
+ ValueError: If the image cannot be opened.
54
  """
55
  try:
56
  image = Image.open(image_path)
57
+ return image
58
  except Exception as e:
59
  raise ValueError(f"Error opening image: {e}")
60
 
 
61
  @tool
62
  def get_current_time_in_timezone(timezone: str) -> str:
63
  """A tool that fetches the current local time in a specified timezone.