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_video_category.py 1.0 kB

123456789101112131415161718192021222324252627282930
  1. # Copyright (c) Alibaba, Inc. and its affiliates.
  2. import unittest
  3. from modelscope.pipelines import pipeline
  4. from modelscope.utils.constant import Tasks
  5. from modelscope.utils.demo_utils import DemoCompatibilityCheck
  6. from modelscope.utils.test_utils import test_level
  7. class VideoCategoryTest(unittest.TestCase, DemoCompatibilityCheck):
  8. def setUp(self) -> None:
  9. self.task = Tasks.video_category
  10. self.model_id = 'damo/cv_resnet50_video-category'
  11. @unittest.skipUnless(test_level() >= 0, 'skip test in current test level')
  12. def test_run_modelhub(self):
  13. category_pipeline = pipeline(Tasks.video_category, self.model_id)
  14. result = category_pipeline(
  15. 'data/test/videos/video_category_test_video.mp4')
  16. print(f'video category output: {result}.')
  17. @unittest.skip('demo compatibility test is only enabled on a needed-basis')
  18. def test_demo_compatibility(self):
  19. self.compatibility_check()
  20. if __name__ == '__main__':
  21. unittest.main()