git clone https://www.modelscope.cn/ValeriaWong/flower_classification14.git
更多关于模型加载和推理的问题参考模型的推理Pipeline。
from modelscope.pipelines import pipeline
from modelscope.utils.constant import Tasks
from modelscope.hub.api import HubApi
YOUR_ACCESS_TOKEN ="请从ModelScope个人中心->访问令牌获取"
api = HubApi()
api.login(YOUR_ACCESS_TOKEN)
img_path = 'https://images.pexels.com/photos/54267/sunflower-blossom-bloom-flowers-54267.jpeg' #向日葵图片
# p = pipeline('image-classification', 'ValeriaWong/flower_classification14')
image_classification = pipeline(Tasks.image_classification,
model='ValeriaWong/flower_classification14',
model_revision = "v1.0.1")
result = image_classification(img_path)
print(result)
更多使用说明请参阅ModelScope文档中心。