ford442 commited on
Commit
aa4436f
·
verified ·
1 Parent(s): 95e9ab1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -4
app.py CHANGED
@@ -107,8 +107,6 @@ print(f"Target inference device: {target_inference_device}")
107
  pipeline_instance.to(target_inference_device)
108
  if latent_upsampler_instance: latent_upsampler_instance.to(target_inference_device)
109
 
110
- generator = torch.Generator(device='cuda').manual_seed(seed)
111
-
112
  def calculate_new_dimensions(orig_w, orig_h):
113
  if orig_w == 0 or orig_h == 0: return int(768), int(768)
114
  if orig_w >= orig_h:
@@ -137,7 +135,7 @@ def enhance_frame(prompt, image_to_enhance: Image.Image):
137
  try:
138
  print("Moving enhancer pipeline to GPU...")
139
  seed = random.randint(0, MAX_SEED)
140
- generator.manual_seed(seed)
141
  enhancer_pipeline.to("cuda",torch.bfloat16)
142
  refine_prompt = prompt +" high detail, sharp focus, 8k, professional"
143
  enhanced_image = enhancer_pipeline(prompt=refine_prompt, image=image_to_enhance, strength=0.1, generator=generator, num_inference_steps=160).images[0]
@@ -224,7 +222,7 @@ def generate(prompt, negative_prompt, clips_list, input_image_filepath, input_vi
224
  if randomize_seed: seed_ui = random.randint(0, 2**32 - 1)
225
  seed_everething(int(seed_ui))
226
  seed = random.randint(0, MAX_SEED)
227
- generator.manual_seed(seed)
228
  actual_num_frames = max(9, min(MAX_NUM_FRAMES, int(round((max(1, round(duration_ui * fps)) - 1.0) / 8.0) * 8 + 1)))
229
  actual_height, actual_width = int(height_ui), int(width_ui)
230
  height_padded, width_padded = ((actual_height - 1) // 32 + 1) * 32, ((actual_width - 1) // 32 + 1) * 32
 
107
  pipeline_instance.to(target_inference_device)
108
  if latent_upsampler_instance: latent_upsampler_instance.to(target_inference_device)
109
 
 
 
110
  def calculate_new_dimensions(orig_w, orig_h):
111
  if orig_w == 0 or orig_h == 0: return int(768), int(768)
112
  if orig_w >= orig_h:
 
135
  try:
136
  print("Moving enhancer pipeline to GPU...")
137
  seed = random.randint(0, MAX_SEED)
138
+ generator = torch.Generator(device='cuda').manual_seed(seed)
139
  enhancer_pipeline.to("cuda",torch.bfloat16)
140
  refine_prompt = prompt +" high detail, sharp focus, 8k, professional"
141
  enhanced_image = enhancer_pipeline(prompt=refine_prompt, image=image_to_enhance, strength=0.1, generator=generator, num_inference_steps=160).images[0]
 
222
  if randomize_seed: seed_ui = random.randint(0, 2**32 - 1)
223
  seed_everething(int(seed_ui))
224
  seed = random.randint(0, MAX_SEED)
225
+ generator = torch.Generator(device='cuda').manual_seed(seed)
226
  actual_num_frames = max(9, min(MAX_NUM_FRAMES, int(round((max(1, round(duration_ui * fps)) - 1.0) / 8.0) * 8 + 1)))
227
  actual_height, actual_width = int(height_ui), int(width_ui)
228
  height_padded, width_padded = ((actual_height - 1) // 32 + 1) * 32, ((actual_width - 1) // 32 + 1) * 32