Yaron Koresh commited on
Commit
4513e12
·
verified ·
1 Parent(s): 89af836

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -15
app.py CHANGED
@@ -124,7 +124,6 @@ pipe.scheduler = EulerAncestralDiscreteScheduler.from_pretrained(
124
  )
125
  #pipe.unet.load_state_dict(load_file(hf_hub_download(repo, ckpt), device=device), strict=False)
126
  pipe.load_ip_adapter("h94/IP-Adapter", subfolder="models", weight_name="ip-adapter_sd15.bin")
127
- pipe.enable_vae_slicing()
128
  pipe.enable_free_init(method="butterworth", use_fast_sampling=fast)
129
 
130
  # Threading
@@ -308,8 +307,9 @@ def calc(img,p1,p2,motion):
308
  global pipe
309
 
310
  if last_motion != motion:
311
- pipe.unload_lora_weights()
312
- if inp[3] != "":
 
313
  pipe.load_lora_weights(motion, adapter_name="motion")
314
  pipe.fuse_lora()
315
  pipe.set_adapters("motion", [0.7])
@@ -317,23 +317,12 @@ def calc(img,p1,p2,motion):
317
 
318
  pipe.to(device,dtype)
319
 
320
- if p2=="":
321
- return pipe(
322
- prompt=p1,
323
- height=height,
324
- width=width,
325
- ip_adapter_image=img.convert("RGB"),
326
- num_inference_steps=step,
327
- guidance_scale=accu,
328
- num_frames=(fps*time)
329
- )
330
-
331
  return pipe(
332
  prompt=p1,
333
  negative_prompt=p2,
334
  height=height,
335
  width=width,
336
- ip_adapter_image=img.convert("RGB"),
337
  num_inference_steps=step,
338
  guidance_scale=accu,
339
  num_frames=(fps*time)
 
124
  )
125
  #pipe.unet.load_state_dict(load_file(hf_hub_download(repo, ckpt), device=device), strict=False)
126
  pipe.load_ip_adapter("h94/IP-Adapter", subfolder="models", weight_name="ip-adapter_sd15.bin")
 
127
  pipe.enable_free_init(method="butterworth", use_fast_sampling=fast)
128
 
129
  # Threading
 
307
  global pipe
308
 
309
  if last_motion != motion:
310
+ if last_motion != "":
311
+ pipe.unload_lora_weights()
312
+ if motion != "":
313
  pipe.load_lora_weights(motion, adapter_name="motion")
314
  pipe.fuse_lora()
315
  pipe.set_adapters("motion", [0.7])
 
317
 
318
  pipe.to(device,dtype)
319
 
 
 
 
 
 
 
 
 
 
 
 
320
  return pipe(
321
  prompt=p1,
322
  negative_prompt=p2,
323
  height=height,
324
  width=width,
325
+ ip_adapter_image=img,
326
  num_inference_steps=step,
327
  guidance_scale=accu,
328
  num_frames=(fps*time)