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_face_emotion.py 1.1 kB

1234567891011121314151617181920212223242526272829303132
  1. # Copyright (c) Alibaba, Inc. and its affiliates.
  2. import unittest
  3. from modelscope.pipelines import pipeline
  4. from modelscope.pipelines.base import Pipeline
  5. from modelscope.utils.constant import Tasks
  6. from modelscope.utils.test_utils import test_level
  7. class FaceEmotionTest(unittest.TestCase):
  8. def setUp(self) -> None:
  9. self.model = 'damo/cv_face-emotion'
  10. self.img = {'img_path': 'data/test/images/face_emotion.jpg'}
  11. def pipeline_inference(self, pipeline: Pipeline, input: str):
  12. result = pipeline(input)
  13. print(result)
  14. @unittest.skip('skip since the model is set to private for now')
  15. def test_run_modelhub(self):
  16. face_emotion = pipeline(Tasks.face_emotion, model=self.model)
  17. self.pipeline_inference(face_emotion, self.img)
  18. @unittest.skip('skip since the model is set to private for now')
  19. def test_run_modelhub_default_model(self):
  20. face_emotion = pipeline(Tasks.face_emotion)
  21. self.pipeline_inference(face_emotion, self.img)
  22. if __name__ == '__main__':
  23. unittest.main()