0b73c877
tangwang
fix
|
1
2
3
4
5
6
7
|
from modelscope.pipelines import pipeline
from modelscope.utils.constant import Tasks
from modelscope.outputs import OutputKeys
img_captioning = pipeline(Tasks.image_captioning, model='iic/ofa_image-caption_coco_distilled_en', model_revision='master')
result = img_captioning('https://modelscope.oss-cn-beijing.aliyuncs.com/demo/image-captioning/donuts.jpeg')
print(result[OutputKeys.CAPTION]) # 'a wooden table topped with different types of donuts'
|