Spaces:
Configuration error
Configuration error
Update app.py
Browse files
app.py
CHANGED
|
@@ -64,7 +64,8 @@ class AnimateController:
|
|
| 64 |
# gate_dict_path = "ckpts/landscape.pt"
|
| 65 |
# self.pnp.set_audio_projector(gate_dict_path, audio_projector_path)
|
| 66 |
|
| 67 |
-
|
|
|
|
| 68 |
|
| 69 |
|
| 70 |
@spaces.GPU
|
|
@@ -101,37 +102,41 @@ class AnimateController:
|
|
| 101 |
negative_prompt="",
|
| 102 |
audio_path=audio,
|
| 103 |
image_path=image_path,
|
|
|
|
|
|
|
| 104 |
cfg_scale=cfg_scale,
|
|
|
|
| 105 |
)
|
| 106 |
|
| 107 |
return image
|
| 108 |
|
| 109 |
-
|
| 110 |
-
|
| 111 |
|
| 112 |
-
|
| 113 |
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
#
|
|
|
|
| 123 |
|
| 124 |
-
#
|
| 125 |
|
| 126 |
-
#
|
| 127 |
-
#
|
| 128 |
-
#
|
| 129 |
|
| 130 |
-
#
|
| 131 |
-
#
|
| 132 |
-
#
|
| 133 |
|
| 134 |
-
|
| 135 |
|
| 136 |
controller = AnimateController()
|
| 137 |
|
|
|
|
| 64 |
# gate_dict_path = "ckpts/landscape.pt"
|
| 65 |
# self.pnp.set_audio_projector(gate_dict_path, audio_projector_path)
|
| 66 |
|
| 67 |
+
self.audio_projector_path = "ckpts/audio_projector_landscape.pth"
|
| 68 |
+
self.adapter_ckpt_path = "ckpts/landscape.pt"
|
| 69 |
|
| 70 |
|
| 71 |
@spaces.GPU
|
|
|
|
| 102 |
negative_prompt="",
|
| 103 |
audio_path=audio,
|
| 104 |
image_path=image_path,
|
| 105 |
+
audio_projector_path = self.audio_projector_path,
|
| 106 |
+
adapter_ckpt_path = self.adapter_ckpt_path,
|
| 107 |
cfg_scale=cfg_scale,
|
| 108 |
+
|
| 109 |
)
|
| 110 |
|
| 111 |
return image
|
| 112 |
|
| 113 |
+
@spaces.GPU
|
| 114 |
+
def update_audio_model(self, audio_model_update):
|
| 115 |
|
| 116 |
+
print(f"changing ckpts audio model {audio_model_update}")
|
| 117 |
|
| 118 |
+
if audio_model_update == "Landscape Model":
|
| 119 |
+
self.audio_projector_path = "ckpts/audio_projector_landscape.pth"
|
| 120 |
+
self.adapter_ckpt_path = "ckpts/landscape.pt"
|
| 121 |
+
else:
|
| 122 |
+
self.audio_projector_path = "ckpts/audio_projector_gh.pth"
|
| 123 |
+
self.adapter_ckpt_path = "ckpts/greatest_hits.pt"
|
| 124 |
+
|
| 125 |
+
|
| 126 |
+
# self.pnp.set_audio_projector(gate_dict_path, audio_projector_path)
|
| 127 |
+
# self.pnp.changed_model = True
|
| 128 |
|
| 129 |
+
# gate_dict = torch.load(gate_dict_path)
|
| 130 |
|
| 131 |
+
# for name, param in self.pnp.unet.named_parameters():
|
| 132 |
+
# if "adapter" in name:
|
| 133 |
+
# param.data = gate_dict[name]
|
| 134 |
|
| 135 |
+
# self.pnp.audio_projector.load_state_dict(torch.load(audio_projector_path))
|
| 136 |
+
# self.pnp.unet.to(self.device)
|
| 137 |
+
# self.pnp.audio_projector.to(self.device)
|
| 138 |
|
| 139 |
+
return gr.Dropdown()
|
| 140 |
|
| 141 |
controller = AnimateController()
|
| 142 |
|