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

1234567891011121314151617181920212223242526272829303132
  1. # Copyright (c) Alibaba, Inc. and its affiliates.
  2. import unittest
  3. from modelscope.hub.api import HubApi
  4. from modelscope.utils.hub import create_model_if_not_exist
  5. # note this is temporary before official account management is ready
  6. YOUR_ACCESS_TOKEN = 'token'
  7. class HubExampleTest(unittest.TestCase):
  8. def setUp(self):
  9. self.api = HubApi()
  10. self.api.login(YOUR_ACCESS_TOKEN)
  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()