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

123456789101112131415161718192021222324252627282930
  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. YOUR_ACCESS_TOKEN = 'token'
  6. class HubExampleTest(unittest.TestCase):
  7. def setUp(self):
  8. self.api = HubApi()
  9. self.api.login(YOUR_ACCESS_TOKEN)
  10. @unittest.skip('to be used for local test only')
  11. def test_example_model_creation(self):
  12. # ATTENTION:change to proper model names before use
  13. model_name = 'cv_unet_person-image-cartoon_compound-models'
  14. model_chinese_name = '达摩卡通化模型'
  15. model_org = 'damo'
  16. model_id = '%s/%s' % (model_org, model_name)
  17. created = create_model_if_not_exist(self.api, model_id,
  18. model_chinese_name)
  19. if not created:
  20. print('!! NOT created since model already exists !!')
  21. if __name__ == '__main__':
  22. unittest.main()