Spaces:
Runtime error
Runtime error
Merge branch 'main' of https://huggingface.co/spaces/baulab/Erasing-Concepts-In-Diffusion into main
Browse files
app.py
CHANGED
|
@@ -258,7 +258,8 @@ class Demo:
|
|
| 258 |
loss.backward()
|
| 259 |
optimizer.step()
|
| 260 |
|
| 261 |
-
|
|
|
|
| 262 |
|
| 263 |
self.finetuner = finetuner.eval().half()
|
| 264 |
|
|
@@ -268,9 +269,9 @@ class Demo:
|
|
| 268 |
|
| 269 |
self.training = False
|
| 270 |
|
| 271 |
-
model_map['Custom'] =
|
| 272 |
|
| 273 |
-
return [gr.update(interactive=True), gr.update(interactive=True),
|
| 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)):
|