original_docstring:  Using a selected image, this function alters the r, g, b components of an image to return a new image\
      that looks like a pencil sketch (aka edge detected image). The pixels in the image are changed to either black\
      or white depending on the difference in contrast between the two pixels.
  
      Written by Alia Nichol (#101143486).
  
      >>> detect_edges(choose_file(), 12)
      <Cimpl.Image object at 0x0000017986874A20>
      
docstring: Using a selected image, this function alters the r, g, b components of an image to return a new image\
  that looks like a pencil sketch (aka edge detected image). The pixels in the image are changed to either black\
  or white depending on the difference in contrast between the two pixels.
  
  
  
  
docstring_tokens: Using a selected image this function alters the r g b components of an image to return a new image \ that looks like a pencil sketch ( aka edge detected image ) . The pixels in the image are changed to either black \ or white depending on the difference in contrast between the two pixels .
code: def detect_edges( image: Image, threshold: int ) -> Image:
      """ Using a selected image, this function alters the r, g, b components of an image to return a new image\
      that looks like a pencil sketch (aka edge detected image). The pixels in the image are changed to either black\
      or white depending on the difference in contrast between the two pixels.
  
      Written by Alia Nichol (#101143486).
  
      >>> detect_edges(choose_file(), 12)
      <Cimpl.Image object at 0x0000017986874A20>
      """
      image = load_image(image)  # Loads an image of choice.
      new_image = copy(image)
  
      for y in range(get_height(new_image) - 1):  # Begins at the first row and moves down through each row in the image.
          for x in range(get_width(new_image)):
  
              r, g, b = (get_color(new_image, x, y))
              r1, g1, b1 = (get_color(new_image, x, y + 1))
  
              if abs(((r + g + b) // 3) - ((
                                                   r1 + g1 + b1) // 3)) > threshold:  # Changes the pixels to black if
                  # contrast between the two pixels is high.
                  set_color(new_image, x, y, create_color(0, 0, 0))
              else:  # Changes the pixels to white is the contrast between the two pixels is low
                  set_color(new_image, x, y, create_color(255, 255, 255))
  
      show(new_image)
      return new_image
code_tokens: def detect_edges ( image : Image , threshold : int ) -> Image : image = load_image ( image ) new_image = copy ( image ) for y in range ( get_height ( new_image ) - 1 ) : for x in range ( get_width ( new_image ) ) : r , g , b = ( get_color ( new_image , x , y ) ) r1 , g1 , b1 = ( get_color ( new_image , x , y + 1 ) ) if abs ( ( ( r + g + b ) // 3 ) - ( ( r1 + g1 + b1 ) // 3 ) ) > threshold : set_color ( new_image , x , y , create_color ( 0 , 0 , 0 ) ) else : set_color ( new_image , x , y , create_color ( 255 , 255 , 255 ) ) show ( new_image ) return new_image
short_docstring: Using a selected image, this function alters the r, g, b components of an image to return a new image\
  that looks like a pencil sketch (aka edge detected image).
short_docstring_tokens: Using a selected image this function alters the r g b components of an image to return a new image \ that looks like a pencil sketch ( aka edge detected image ) .
comment: """ Using a selected image, this function alters the r, g, b components of an image to return a new image\
      that looks like a pencil sketch (aka edge detected image). The pixels in the image are changed to either black\
      or white depending on the difference in contrast between the two pixels.
  
      Written by Alia Nichol (#101143486).
  
      >>> detect_edges(choose_file(), 12)
      <Cimpl.Image object at 0x0000017986874A20>
      """$SEP$# Loads an image of choice.$SEP$# Begins at the first row and moves down through each row in the image.$SEP$# Changes the pixels to black if$SEP$# contrast between the two pixels is high.$SEP$# Changes the pixels to white is the contrast between the two pixels is low