mirror of
https://github.com/modelscope/modelscope.git
synced 2025-12-25 20:49:37 +01:00
32 lines
992 B
Python
32 lines
992 B
Python
import unittest
|
|
|
|
from modelscope.hub.api import HubApi
|
|
from modelscope.utils.hub import create_model_if_not_exist
|
|
|
|
# note this is temporary before official account management is ready
|
|
USER_NAME = 'maasadmin'
|
|
PASSWORD = '12345678'
|
|
|
|
|
|
class HubExampleTest(unittest.TestCase):
|
|
|
|
def setUp(self):
|
|
self.api = HubApi()
|
|
self.api.login(USER_NAME, PASSWORD)
|
|
|
|
@unittest.skip('to be used for local test only')
|
|
def test_example_model_creation(self):
|
|
# ATTENTION:change to proper model names before use
|
|
model_name = 'cv_unet_person-image-cartoon_compound-models'
|
|
model_chinese_name = '达摩卡通化模型'
|
|
model_org = 'damo'
|
|
model_id = '%s/%s' % (model_org, model_name)
|
|
created = create_model_if_not_exist(self.api, model_id,
|
|
model_chinese_name)
|
|
if not created:
|
|
print('!! NOT created since model already exists !!')
|
|
|
|
|
|
if __name__ == '__main__':
|
|
unittest.main()
|