File size: 573 Bytes
8a25edd 3023ac1 f27f78b 3023ac1 8a25edd |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
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")}')
|