import os.path as osp import cv2 from modelscope.outputs import OutputKeys from modelscope.pipelines import pipeline from modelscope.utils.constant import Tasks image_skychange = pipeline(Tasks.image_skychange, model='iic/cv_hrnetocr_skychange') result = image_skychange( {'sky_image': '~/Downloads/sky_image.jpg', 'scene_image': '/opt/data/face/NXEo0zusSaNB2fa232c84898e92ff165e2dfee59cb54.jpg'}) cv2.imwrite('~/Downloads/result.png', result[OutputKeys.OUTPUT_IMG]) print(f'Output written to {osp.abspath("result.png")}')