You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

test_hub_examples.py 1.0 kB

123456789101112131415161718192021222324252627282930313233
  1. import unittest
  2. from maas_hub.maas_api import MaasApi
  3. from modelscope.utils.hub import create_model_if_not_exist
  4. USER_NAME = 'maasadmin'
  5. PASSWORD = '12345678'
  6. class HubExampleTest(unittest.TestCase):
  7. def setUp(self):
  8. self.api = MaasApi()
  9. # note this is temporary before official account management is ready
  10. self.api.login(USER_NAME, PASSWORD)
  11. @unittest.skip('to be used for local test only')
  12. def test_example_model_creation(self):
  13. # ATTENTION:change to proper model names before use
  14. model_name = 'cv_unet_person-image-cartoon_compound-models'
  15. model_chinese_name = '达摩卡通化模型'
  16. model_org = 'damo'
  17. model_id = '%s/%s' % (model_org, model_name)
  18. created = create_model_if_not_exist(self.api, model_id,
  19. model_chinese_name)
  20. if not created:
  21. print('!! NOT created since model already exists !!')
  22. if __name__ == '__main__':
  23. unittest.main()