Yaron Koresh commited on
Commit
24869b8
·
verified ·
1 Parent(s): e9a8d12

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -7
app.py CHANGED
@@ -117,10 +117,13 @@ function custom(){
117
  # torch pipe
118
 
119
  pipe = AnimateDiffPipeline.from_pretrained(base, motion_adapter=adapter).to(device)
120
- pipe.scheduler = EulerAncestralDiscreteScheduler.from_pretrained(
121
- base,
122
- subfolder="scheduler",
 
123
  beta_schedule="linear",
 
 
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-plus_sd15.bin")
@@ -233,7 +236,7 @@ class Command:
233
  self.func = func
234
  self.data = data
235
 
236
- def parallel(*pairs):
237
  if len(pairs) == 0:
238
  return
239
  if len(pairs) == 1:
@@ -248,7 +251,7 @@ def parallel(*pairs):
248
  for pair in pairs:
249
  f = pair.pop(0)
250
  queue.put(Command(f, pair))
251
- response = queue.get()
252
  return response
253
 
254
  # functionality
@@ -322,7 +325,7 @@ def calc(img,p1,p2,motion):
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)
@@ -351,7 +354,7 @@ def handle(*inp):
351
  ln = len(result)
352
 
353
  parargs = [[calc,*inp] for i in range(ln)]
354
- out_pipe = parallel(parargs)
355
  for i in range(ln):
356
  name = generate_random_string(12)+".png"
357
  export_to_gif(out_pipe[i].frames[0],name,fps=fps)
 
117
  # torch pipe
118
 
119
  pipe = AnimateDiffPipeline.from_pretrained(base, motion_adapter=adapter).to(device)
120
+ pipe.scheduler = DDIMScheduler(
121
+ clip_sample=False,
122
+ beta_start=0.00085,
123
+ beta_end=0.012,
124
  beta_schedule="linear",
125
+ timestep_spacing="trailing",
126
+ steps_offset=1
127
  )
128
  #pipe.unet.load_state_dict(load_file(hf_hub_download(repo, ckpt), device=device), strict=False)
129
  pipe.load_ip_adapter("h94/IP-Adapter", subfolder="models", weight_name="ip-adapter-plus_sd15.bin")
 
236
  self.func = func
237
  self.data = data
238
 
239
+ def parallel(timeout,*pairs):
240
  if len(pairs) == 0:
241
  return
242
  if len(pairs) == 1:
 
251
  for pair in pairs:
252
  f = pair.pop(0)
253
  queue.put(Command(f, pair))
254
+ response = queue.get(timeout=timeout)
255
  return response
256
 
257
  # functionality
 
325
  negative_prompt=p2,
326
  height=height,
327
  width=width,
328
+ ip_adapter_image=img.convert("RGB"),
329
  num_inference_steps=step,
330
  guidance_scale=accu,
331
  num_frames=(fps*time)
 
354
  ln = len(result)
355
 
356
  parargs = [[calc,*inp] for i in range(ln)]
357
+ out_pipe = parallel(40,parargs)
358
  for i in range(ln):
359
  name = generate_random_string(12)+".png"
360
  export_to_gif(out_pipe[i].frames[0],name,fps=fps)