burakcanbiner commited on
Commit
cb2036e
1 Parent(s): e412e47

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +26 -21
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
- # @spaces.GPU
110
- # def update_audio_model(self, audio_model_update):
111
 
112
- # print(f"changing ckpts audio model {audio_model_update}")
113
 
114
- # if audio_model_update == "Landscape Model":
115
- # audio_projector_path = "ckpts/audio_projector_landscape.pth"
116
- # gate_dict_path = "ckpts/landscape.pt"
117
- # else:
118
- # audio_projector_path = "ckpts/audio_projector_gh.pth"
119
- # gate_dict_path = "ckpts/greatest_hits.pt"
120
-
121
- # self.pnp.set_audio_projector(gate_dict_path, audio_projector_path)
122
- # self.pnp.changed_model = True
 
123
 
124
- # # gate_dict = torch.load(gate_dict_path)
125
 
126
- # # for name, param in self.pnp.unet.named_parameters():
127
- # # if "adapter" in name:
128
- # # param.data = gate_dict[name]
129
 
130
- # # self.pnp.audio_projector.load_state_dict(torch.load(audio_projector_path))
131
- # # self.pnp.unet.to(self.device)
132
- # # self.pnp.audio_projector.to(self.device)
133
 
134
- # return gr.Dropdown()
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