code: def main(args):
      if paddle.is_compiled_with_cuda():
          paddle.set_device("gpu")
      else:
          paddle.set_device("cpu")
      input_path = args.input_path
      output_path = args.output_path
      point, box = args.point_prompt, args.box_prompt
      if point is not None:
          point = np.array([point])
          input_label = np.array([1])
      else:
          input_label = None
      if box is not None:
          box = np.array([[box[0], box[1]], [box[2], box[3]]])
  
      image = cv2.imread(input_path)
      image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
      model = sam_model_registry[args.model_type](
          checkpoint=model_link[args.model_type]
      )
      predictor = SamPredictor(model)
      predictor.set_image(image)
  
      masks, _, _ = predictor.predict(
          point_coords=point,
          point_labels=input_label,
          box=box,
          multimask_output=True,
      )
  
      plt.figure(figsize=(10, 10))
      plt.imshow(image)
      show_mask(masks[0], plt.gca())
      plt.axis("off")
      basename = os.path.basename(input_path)
      if not os.path.exists(output_path):
          os.makedirs(output_path)
      path_output = os.path.join(output_path, basename)
      plt.savefig(path_output)
      print("The output has been saved to {}".format(path_output))
  
file_path: PaddleSeg/contrib/SegmentAnything/scripts/promt_predict.py
imports: import os
  import sys
  import argparse
  import paddle
  import cv2
  import numpy
  import matplotlib.pyplot
  from segment_anything.predictor import SamPredictor
  from segment_anything.build_sam import sam_model_registry
label_desc: Use image node_id 3 for calling a global function with example usage: main(args) without return types