Spaces:
Build error
Build error
File size: 760 Bytes
76e4b2c 42b7a6d 76e4b2c 42b7a6d 76e4b2c 42b7a6d 76e4b2c |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
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() |