2023-08-15 21:32:30 +08:00
|
|
|
import sys
|
|
|
|
|
import unittest
|
|
|
|
|
|
|
|
|
|
from modelscope.models import Model
|
|
|
|
|
from modelscope.outputs import OutputKeys
|
|
|
|
|
from modelscope.pipelines import pipeline
|
2023-08-22 10:57:23 +08:00
|
|
|
from modelscope.utils.constant import Tasks
|
2023-08-15 21:32:30 +08:00
|
|
|
from modelscope.utils.test_utils import test_level
|
|
|
|
|
|
|
|
|
|
|
2023-08-18 11:47:45 +08:00
|
|
|
class Image2VideoTest(unittest.TestCase):
|
2023-08-15 21:32:30 +08:00
|
|
|
|
|
|
|
|
def setUp(self) -> None:
|
2023-08-17 20:03:05 +08:00
|
|
|
self.task = Tasks.image_to_video
|
2023-08-16 11:35:15 +08:00
|
|
|
self.model_id = 'damo/Image-to-Video'
|
2023-08-17 20:34:43 +08:00
|
|
|
self.path = 'https://video-generation-wulanchabu.oss-cn-wulanchabu.aliyuncs.com/baishao/test.jpeg'
|
2023-08-15 21:32:30 +08:00
|
|
|
|
2023-08-18 20:13:20 +08:00
|
|
|
@unittest.skipUnless(test_level() >= 1, 'skip test in current test level')
|
2023-08-16 11:35:15 +08:00
|
|
|
def test_run_with_model_from_modelhub(self):
|
2023-08-15 21:32:30 +08:00
|
|
|
pipe = pipeline(task=self.task, model=self.model_id)
|
2023-08-16 11:35:15 +08:00
|
|
|
|
|
|
|
|
output_video_path = pipe(
|
2023-08-17 20:34:43 +08:00
|
|
|
self.path, output_video='./output.mp4')[OutputKeys.OUTPUT_VIDEO]
|
2023-08-15 21:32:30 +08:00
|
|
|
print(output_video_path)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
2023-08-16 11:35:15 +08:00
|
|
|
unittest.main()
|