import gradio as gr from modelscope.pipelines import pipeline from modelscope.outputs import OutputKeys from huggingface_hub import snapshot_download, HfApi import pathlib api = HfApi() model_dir = pathlib.Path('weights') snapshot_download('damo-vilab/modelscope-damo-text-to-video-synthesis', repo_type='model', local_dir=model_dir, use_auth_token=True) pipe = pipeline('text-to-video-synthesis', model_dir.as_posix()) def generate_video(prompt): output_video_path = pipe({'text': prompt})[OutputKeys.OUTPUT_VIDEO] return output_video_path iface = gr.Interface( fn=generate_video, inputs=gr.Textbox(lines=2, placeholder="Enter your text prompt"), outputs="video") iface.launch()