JadenFK commited on
Commit
aaad790
2 Parent(s): 506478b 958100a

Merge branch 'main' of https://huggingface.co/spaces/baulab/Erasing-Concepts-In-Diffusion into main

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -258,7 +258,8 @@ class Demo:
258
  loss.backward()
259
  optimizer.step()
260
 
261
- torch.save(finetuner.state_dict(), 'ft.pt')
 
262
 
263
  self.finetuner = finetuner.eval().half()
264
 
@@ -268,9 +269,9 @@ class Demo:
268
 
269
  self.training = False
270
 
271
- model_map['Custom'] = 'ft.pt'
272
 
273
- return [gr.update(interactive=True), gr.update(interactive=True), 'ft.pt', gr.Dropdown.update(choices=list(model_map.keys()), value='Custom')]
274
 
275
 
276
  def inference(self, prompt, seed, pbar = gr.Progress(track_tqdm=True)):
 
258
  loss.backward()
259
  optimizer.step()
260
 
261
+ ft_path = f"{prompt.lower().replace(' ', '')}.pt"
262
+ torch.save(finetuner.state_dict(), ft_path)
263
 
264
  self.finetuner = finetuner.eval().half()
265
 
 
269
 
270
  self.training = False
271
 
272
+ model_map['Custom'] = ft_path
273
 
274
+ return [gr.update(interactive=True), gr.update(interactive=True), ft_path, gr.Dropdown.update(choices=list(model_map.keys()), value='Custom')]
275
 
276
 
277
  def inference(self, prompt, seed, pbar = gr.Progress(track_tqdm=True)):