Yaron Koresh commited on
Commit
59db4bc
·
verified ·
1 Parent(s): ef852ba

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -5
app.py CHANGED
@@ -120,7 +120,7 @@ def generate_random_string(length):
120
  characters = string.ascii_letters + string.digits
121
  return ''.join(random.choice(characters) for _ in range(length))
122
 
123
- @spaces.GPU(duration=85)
124
  def Piper(name,positive_prompt,negative,motion):
125
  global step
126
  global fps
@@ -188,12 +188,13 @@ repo = "ByteDance/AnimateDiff-Lightning"
188
  ckpt = f"animatediff_lightning_{step}step_diffusers.safetensors"
189
  base = "emilianJR/epiCRealism"
190
  #base = "SG161222/Realistic_Vision_V6.0_B1_noVAE"
191
-
192
- pipe = AnimateDiffPipeline.from_pretrained(base, torch_dtype=dtype, token=os.getenv("hf_token")).to(device)
 
 
193
  pipe.scheduler = EulerDiscreteScheduler.from_config(pipe.scheduler.config, timestep_spacing="trailing", beta_schedule="linear")
194
- pipe.unet.load_state_dict(load_file(hf_hub_download(repo, ckpt), device=device), strict=False)
195
  pipe.enable_free_init(method="butterworth", use_fast_sampling=False)
196
-
197
  mp.set_start_method("spawn", force=True)
198
 
199
  with gr.Blocks(theme=gr.themes.Soft(),css=css,js=js) as demo:
 
120
  characters = string.ascii_letters + string.digits
121
  return ''.join(random.choice(characters) for _ in range(length))
122
 
123
+ @spaces.GPU(duration=65)
124
  def Piper(name,positive_prompt,negative,motion):
125
  global step
126
  global fps
 
188
  ckpt = f"animatediff_lightning_{step}step_diffusers.safetensors"
189
  base = "emilianJR/epiCRealism"
190
  #base = "SG161222/Realistic_Vision_V6.0_B1_noVAE"
191
+
192
+ adapter = MotionAdapter().to(device, dtype)
193
+ adapter.load_state_dict(load_file(hf_hub_download(repo ,ckpt), device=device))
194
+ pipe = AnimateDiffPipeline.from_pretrained(base, motion_adapter=adapter, torch_dtype=dtype).to(device)
195
  pipe.scheduler = EulerDiscreteScheduler.from_config(pipe.scheduler.config, timestep_spacing="trailing", beta_schedule="linear")
 
196
  pipe.enable_free_init(method="butterworth", use_fast_sampling=False)
197
+
198
  mp.set_start_method("spawn", force=True)
199
 
200
  with gr.Blocks(theme=gr.themes.Soft(),css=css,js=js) as demo: