Lalit9031 commited on
Commit
0d5a35a
·
verified ·
1 Parent(s): 3379885

timer_update

Browse files
Files changed (1) hide show
  1. app.py +8 -8
app.py CHANGED
@@ -19,10 +19,10 @@ DEFAULT_MODEL_ID = os.getenv(
19
  "HF_ZERO_GPU_VIDEO_MODEL",
20
  "stabilityai/stable-video-diffusion-img2vid-xt-1-1",
21
  )
22
- DEFAULT_GPU_DURATION_SECONDS = int(os.getenv("HF_ZERO_GPU_DURATION_SECONDS", "600"))
23
- DEFAULT_FPS = int(os.getenv("HF_ZERO_GPU_FPS", "7"))
24
- DEFAULT_NUM_FRAMES = int(os.getenv("HF_ZERO_GPU_NUM_FRAMES", "25"))
25
- DEFAULT_INFERENCE_STEPS = int(os.getenv("HF_ZERO_GPU_INFERENCE_STEPS", "25"))
26
  DEFAULT_MOTION_BUCKET_ID = int(os.getenv("HF_ZERO_GPU_MOTION_BUCKET_ID", "127"))
27
  DEFAULT_NOISE_AUG_STRENGTH = float(os.getenv("HF_ZERO_GPU_NOISE_AUG_STRENGTH", "0.02"))
28
 
@@ -78,7 +78,7 @@ def _render_clip(
78
  seed: int,
79
  ) -> None:
80
  image = Image.open(image_path).convert("RGB")
81
- target_size = (1024, 576) if image.width >= image.height else (576, 1024)
82
  image = ImageOps.fit(image, target_size, method=Image.Resampling.LANCZOS)
83
  generator = torch.Generator(device="cuda").manual_seed(seed)
84
  result = pipe(
@@ -134,10 +134,10 @@ def render_package(
134
  pipe,
135
  image_path,
136
  video_path,
137
- num_frames=max(8, int(num_frames)),
138
- inference_steps=max(10, int(inference_steps)),
139
  motion_bucket_id=int(motion_bucket_id),
140
- fps=max(4, int(fps)),
141
  noise_aug_strength=float(noise_aug_strength),
142
  seed=render_seed,
143
  )
 
19
  "HF_ZERO_GPU_VIDEO_MODEL",
20
  "stabilityai/stable-video-diffusion-img2vid-xt-1-1",
21
  )
22
+ DEFAULT_GPU_DURATION_SECONDS = max(60, min(int(os.getenv("HF_ZERO_GPU_DURATION_SECONDS", "120")), 120))
23
+ DEFAULT_FPS = int(os.getenv("HF_ZERO_GPU_FPS", "6"))
24
+ DEFAULT_NUM_FRAMES = int(os.getenv("HF_ZERO_GPU_NUM_FRAMES", "16"))
25
+ DEFAULT_INFERENCE_STEPS = int(os.getenv("HF_ZERO_GPU_INFERENCE_STEPS", "12"))
26
  DEFAULT_MOTION_BUCKET_ID = int(os.getenv("HF_ZERO_GPU_MOTION_BUCKET_ID", "127"))
27
  DEFAULT_NOISE_AUG_STRENGTH = float(os.getenv("HF_ZERO_GPU_NOISE_AUG_STRENGTH", "0.02"))
28
 
 
78
  seed: int,
79
  ) -> None:
80
  image = Image.open(image_path).convert("RGB")
81
+ target_size = (768, 432) if image.width >= image.height else (432, 768)
82
  image = ImageOps.fit(image, target_size, method=Image.Resampling.LANCZOS)
83
  generator = torch.Generator(device="cuda").manual_seed(seed)
84
  result = pipe(
 
134
  pipe,
135
  image_path,
136
  video_path,
137
+ num_frames=max(8, min(int(num_frames), 16)),
138
+ inference_steps=max(10, min(int(inference_steps), 12)),
139
  motion_bucket_id=int(motion_bucket_id),
140
+ fps=max(4, min(int(fps), 6)),
141
  noise_aug_strength=float(noise_aug_strength),
142
  seed=render_seed,
143
  )