import gradio as gr import os from modelscope.pipelines import pipeline from modelscope.outputs import OutputKeys SECRET_TOKEN = os.getenv('SECRET_TOKEN', 'default_secret') pipe = pipeline(task='image-to-video', model='damo/Image-to-Video', model_revision='v1.1.0') def infer (image_in, secret_token): if secret_token != SECRET_TOKEN: raise gr.Error(f'Invalid secret token. Please fork the original space if you want to use it for yourself.') # IMG_PATH: your image path (url or local file) IMG_PATH = image_in output_video_path = pipe(IMG_PATH, output_video='output.mp4')[OutputKeys.OUTPUT_VIDEO] print(output_video_path) return output_video_path with gr.Blocks() as demo: gr.Markdown("""
You are currently viewing a micro-service API meant to be used by robots.
For the human UI, please check out the original Space by Sylvain Filoni.