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 992 B

12345678910111213141516171819202122232425262728293031
  1. import unittest
  2. from modelscope.hub.api import HubApi
  3. from modelscope.utils.hub import create_model_if_not_exist
  4. # note this is temporary before official account management is ready
  5. USER_NAME = 'maasadmin'
  6. PASSWORD = '12345678'
  7. class HubExampleTest(unittest.TestCase):
  8. def setUp(self):
  9. self.api = HubApi()
  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()