Spaces:
Build error
Build error
" rather than '
Browse files30 unmodified lines313233343536374 unmodified lines424344454647488 unmodified lines5758596061626318 unmodified lines8283848586878889909192939495969710 unmodified lines1081091101111121131141152 unmodified lines11811912012112212312412512630 unmodified linessnapshot_download(repo_id="openai/clip-vit-large-patch14", repo_type="model", local_dir="ckpts/text_encoder_2", force_download=True)def initialize_model(model_path):print('initialize_model: ' + model_path)if torch.cuda.device_count() == 0:return None4 unmodified linesprint(f"`models_root` exists: {models_root_path}")hunyuan_video_sampler = HunyuanVideoSampler.from_pretrained(models_root_path, args=args)print('Model initialized: ' + model_path)return hunyuan_video_samplermodel = initialize_model("ckpts")8 unmodified linesflow_shift,embedded_guidance_scale):print('generate_video (prompt: ' + prompt + ')')return generate_video_gpu(model,prompt,18 unmodified linesflow_shift,embedded_guidance_scale):print('generate_video_gpu (prompt: ' + prompt + ')')if torch.cuda.device_count() == 0:gr.Warning('Set this space to GPU config to make it work.')return Noneseed = None if seed == -1 else seedwidth, height = resolution.split("x")width, height = int(width), int(height)negative_prompt = "" # not applicable in the inferenceprint('Predicting video...')outputs = model.predict(prompt=prompt,10 unmodified linesembedded_guidance_scale=embedded_guidance_scale)print('Video predicted')samples = outputs['samples']sample = samples[0].unsqueeze(0)save_path = "./gradio_outputs"2 unmodified linestime_flag = datetime.fromtimestamp(time.time()).strftime("%Y-%m-%d-%H:%M:%S")video_path = f"{save_path}/{time_flag}_seed{outputs['seeds'][0]}_{outputs['prompts'][0][:100].replace('/','')}.mp4"save_videos_grid(sample, video_path, fps=24)logger.info(f'Sample saved to: {video_path}')print('Return the video')return video_pathdef create_demo(model_path):30 unmodified lines313233343536374 unmodified lines424344454647488 unmodified lines5758596061626318 unmodified lines8283848586878889909192939495969710 unmodified lines1081091101111121131141152 unmodified lines11811912012112212312412512630 unmodified linessnapshot_download(repo_id="openai/clip-vit-large-patch14", repo_type="model", local_dir="ckpts/text_encoder_2", force_download=True)def initialize_model(model_path):print("initialize_model: " + model_path)if torch.cuda.device_count() == 0:return None4 unmodified linesprint(f"`models_root` exists: {models_root_path}")hunyuan_video_sampler = HunyuanVideoSampler.from_pretrained(models_root_path, args=args)print("Model initialized: " + model_path)return hunyuan_video_samplermodel = initialize_model("ckpts")8 unmodified linesflow_shift,embedded_guidance_scale):print("generate_video (prompt: " + prompt + ")")return generate_video_gpu(model,prompt,18 unmodified linesflow_shift,embedded_guidance_scale):print("generate_video_gpu (prompt: " + prompt + ")")if torch.cuda.device_count() == 0:gr.Warning("Set this space to GPU config to make it work.")return Noneseed = None if seed == -1 else seedwidth, height = resolution.split("x")width, height = int(width), int(height)negative_prompt = "" # not applicable in the inferenceprint("Predicting video...")outputs = model.predict(prompt=prompt,10 unmodified linesembedded_guidance_scale=embedded_guidance_scale)print("Video predicted")samples = outputs["samples"]sample = samples[0].unsqueeze(0)save_path = "./gradio_outputs"2 unmodified linestime_flag = datetime.fromtimestamp(time.time()).strftime("%Y-%m-%d-%H:%M:%S")video_path = f"{save_path}/{time_flag}_seed{outputs['seeds'][0]}_{outputs['prompts'][0][:100].replace('/','')}.mp4"save_videos_grid(sample, video_path, fps=24)logger.info(f"Sample saved to: {video_path}")print("Return the video")return video_pathdef create_demo(model_path):
app.py+10-10