Create video_pipeline.py
Browse files- video_pipeline.py +8 -0
video_pipeline.py
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from modelscope.pipelines import pipeline
|
2 |
+
from modelscope.utils.constant import Tasks
|
3 |
+
|
4 |
+
video_pipe = pipeline(Tasks.text_to_video_synthesis, model='damo/text-to-video-synthesis', device='cuda')
|
5 |
+
|
6 |
+
def generate_video(prompt, image_path):
|
7 |
+
result = video_pipe({'text': prompt, 'input_image': image_path})
|
8 |
+
return result['video_path']
|