Ashrafb commited on
Commit
c21ae72
·
verified ·
1 Parent(s): 01a3b4f

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +3 -7
main.py CHANGED
@@ -60,18 +60,14 @@ def resize_img(input_img, max_size):
60
  return img
61
 
62
 
63
- def colorize_image(pil_image, img_size=800) -> "PIL.Image":
64
- # Open the image
65
- pil_img = pil_image.convert("RGB")
66
  img_rgb = np.array(pil_img)
67
  resized_img_rgb = resize_img(img_rgb, img_size)
68
  resized_pil_img = PIL.Image.fromarray(resized_img_rgb)
69
-
70
- # Send the image to the model
71
  output_pil_img = colorizer.plot_transformed_pil_image(resized_pil_img, render_factor=35, compare=False)
72
-
73
- return output_pil_img
74
 
 
75
 
76
  def image_download_button(pil_image, filename: str, fmt: str, label="Download"):
77
  if fmt not in ["jpg", "png"]:
 
60
  return img
61
 
62
 
63
+ def colorize_image(input_image, colorizer, img_size=800):
64
+ pil_img = input_image.convert("RGB")
 
65
  img_rgb = np.array(pil_img)
66
  resized_img_rgb = resize_img(img_rgb, img_size)
67
  resized_pil_img = PIL.Image.fromarray(resized_img_rgb)
 
 
68
  output_pil_img = colorizer.plot_transformed_pil_image(resized_pil_img, render_factor=35, compare=False)
 
 
69
 
70
+ return output_pil_img
71
 
72
  def image_download_button(pil_image, filename: str, fmt: str, label="Download"):
73
  if fmt not in ["jpg", "png"]: