2023-03-09 00:57:43 +08:00
|
|
|
# Copyright (c) Alibaba, Inc. and its affiliates.
|
|
|
|
|
|
|
|
|
|
import unittest
|
|
|
|
|
|
|
|
|
|
from modelscope.outputs import OutputKeys
|
|
|
|
|
from modelscope.pipelines import pipeline
|
|
|
|
|
from modelscope.utils.constant import Tasks
|
|
|
|
|
from modelscope.utils.test_utils import test_level
|
|
|
|
|
|
|
|
|
|
|
2023-05-14 23:41:40 +08:00
|
|
|
class TextToVideoSynthesisTest(unittest.TestCase):
|
2023-03-09 00:57:43 +08:00
|
|
|
|
|
|
|
|
def setUp(self) -> None:
|
|
|
|
|
self.task = Tasks.text_to_video_synthesis
|
|
|
|
|
self.model_id = 'damo/text-to-video-synthesis'
|
|
|
|
|
|
|
|
|
|
test_text = {
|
|
|
|
|
'text': 'A panda eating bamboo on a rock.',
|
|
|
|
|
}
|
|
|
|
|
|
2023-07-14 16:22:10 +08:00
|
|
|
test_text_height_width = {
|
|
|
|
|
'text': 'A panda eating bamboo on a rock.',
|
|
|
|
|
'out_height': 256,
|
|
|
|
|
'out_width': 256,
|
|
|
|
|
}
|
|
|
|
|
|
2024-12-12 19:24:38 +08:00
|
|
|
@unittest.skip
|
2023-03-09 00:57:43 +08:00
|
|
|
def test_run_with_model_from_modelhub(self):
|
|
|
|
|
pipe_line_text_to_video_synthesis = pipeline(
|
|
|
|
|
task=self.task, model=self.model_id)
|
|
|
|
|
output_video_path = pipe_line_text_to_video_synthesis(
|
|
|
|
|
self.test_text)[OutputKeys.OUTPUT_VIDEO]
|
|
|
|
|
print(output_video_path)
|
|
|
|
|
|
2024-12-12 19:24:38 +08:00
|
|
|
@unittest.skip
|
2023-07-14 16:22:10 +08:00
|
|
|
def test_run_modelhub_user_control(self):
|
|
|
|
|
pipe_line_text_to_video_synthesis = pipeline(
|
|
|
|
|
task=self.task, model=self.model_id)
|
|
|
|
|
output_video_path = pipe_line_text_to_video_synthesis(
|
|
|
|
|
self.test_text_height_width)[OutputKeys.OUTPUT_VIDEO]
|
|
|
|
|
print(output_video_path)
|
|
|
|
|
|
2023-03-09 00:57:43 +08:00
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
|
unittest.main()
|