svjack commited on
Commit
867e309
1 Parent(s): 2717a45

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +18 -7
README.md CHANGED
@@ -296,7 +296,7 @@ def split_video_into_frames(input_video_path, num_frames, temp_folder='temp_fram
296
 
297
  print(f"新的视频已保存到 resampled_video.mp4,包含 {num_frames} 个帧,并保持原始的帧率。")
298
 
299
- def generate_video_with_prompt(input_video_path, prompt, model_id, gif_output_path, seed=0, num_frames=16, keep_imgs=False, temp_folder='temp_frames'):
300
  """
301
  生成带有文本提示的视频。
302
 
@@ -308,6 +308,11 @@ def generate_video_with_prompt(input_video_path, prompt, model_id, gif_output_pa
308
  :param num_frames: 目标帧数
309
  :param keep_imgs: 是否保留临时图片
310
  :param temp_folder: 临时文件夹路径
 
 
 
 
 
311
  """
312
  split_video_into_frames(input_video_path, num_frames, temp_folder)
313
 
@@ -328,11 +333,11 @@ def generate_video_with_prompt(input_video_path, prompt, model_id, gif_output_pa
328
  output = pipe(
329
  prompt=prompt,
330
  negative_prompt=negative_prompt,
331
- num_inference_steps=50,
332
- guidance_scale=20,
333
- controlnet_conditioning_scale=1.0,
334
- width=512,
335
- height=768,
336
  num_frames=num_frames,
337
  conditioning_frames=cn2,
338
  generator=generator
@@ -358,10 +363,16 @@ if __name__ == "__main__":
358
  parser.add_argument("--num_frames", type=int, default=16, help="目标帧数")
359
  parser.add_argument("--keep_imgs", action="store_true", help="是否保留临时图片")
360
  parser.add_argument("--temp_folder", default='temp_frames', help="临时文件夹路径")
 
 
 
 
 
361
 
362
  args = parser.parse_args()
363
 
364
- generate_video_with_prompt(args.input_video, args.prompt, args.model_id, args.gif_output_path, args.seed, args.num_frames, args.keep_imgs, args.temp_folder)
 
365
  ```
366
 
367
  ```bash
 
296
 
297
  print(f"新的视频已保存到 resampled_video.mp4,包含 {num_frames} 个帧,并保持原始的帧率。")
298
 
299
+ def generate_video_with_prompt(input_video_path, prompt, model_id, gif_output_path, seed=0, num_frames=16, keep_imgs=False, temp_folder='temp_frames', num_inference_steps=50, guidance_scale=20, controlnet_conditioning_scale=1.0, width=512, height=768):
300
  """
301
  生成带有文本提示的视频。
302
 
 
308
  :param num_frames: 目标帧数
309
  :param keep_imgs: 是否保留临时图片
310
  :param temp_folder: 临时文件夹路径
311
+ :param num_inference_steps: 推理步数
312
+ :param guidance_scale: 引导比例
313
+ :param controlnet_conditioning_scale: ControlNet 条件比例
314
+ :param width: 输出宽度
315
+ :param height: 输出高度
316
  """
317
  split_video_into_frames(input_video_path, num_frames, temp_folder)
318
 
 
333
  output = pipe(
334
  prompt=prompt,
335
  negative_prompt=negative_prompt,
336
+ num_inference_steps=num_inference_steps,
337
+ guidance_scale=guidance_scale,
338
+ controlnet_conditioning_scale=controlnet_conditioning_scale,
339
+ width=width,
340
+ height=height,
341
  num_frames=num_frames,
342
  conditioning_frames=cn2,
343
  generator=generator
 
363
  parser.add_argument("--num_frames", type=int, default=16, help="目标帧数")
364
  parser.add_argument("--keep_imgs", action="store_true", help="是否保留临时图片")
365
  parser.add_argument("--temp_folder", default='temp_frames', help="临时文件夹路径")
366
+ parser.add_argument("--num_inference_steps", type=int, default=50, help="推理步数")
367
+ parser.add_argument("--guidance_scale", type=float, default=20.0, help="引导比例")
368
+ parser.add_argument("--controlnet_conditioning_scale", type=float, default=1.0, help="ControlNet 条件比例")
369
+ parser.add_argument("--width", type=int, default=512, help="输出宽度")
370
+ parser.add_argument("--height", type=int, default=768, help="输出高度")
371
 
372
  args = parser.parse_args()
373
 
374
+ generate_video_with_prompt(args.input_video, args.prompt, args.model_id, args.gif_output_path, args.seed, args.num_frames,
375
+ args.keep_imgs, args.temp_folder, args.num_inference_steps, args.guidance_scale, args.controlnet_conditioning_scale, args.width, args.height)
376
  ```
377
 
378
  ```bash