RohitGandikota commited on
Commit
376e5cc
·
1 Parent(s): 5a392b9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -2
app.py CHANGED
@@ -3,6 +3,8 @@ import torch
3
  from finetuning import FineTunedModel
4
  from StableDiffuser import StableDiffuser
5
  from train import train
 
 
6
  import os
7
  model_map = {'Van Gogh' : 'models/vangogh.pt',
8
  'Pablo Picasso': 'models/pablopicasso.pt',
@@ -229,7 +231,10 @@ class Demo:
229
  n_steps=50,
230
  generator=generator
231
  )
232
- images = self.diffuser.run_safety_checker(images=images, device='cuda')
 
 
 
233
  orig_image = images[0][0]
234
 
235
  torch.cuda.empty_cache()
@@ -243,7 +248,9 @@ class Demo:
243
  n_steps=50,
244
  generator=generator
245
  )
246
- images = self.diffuser.run_safety_checker(images=images, device='cuda')
 
 
247
  edited_image = images[0][0]
248
 
249
  del finetuner
 
3
  from finetuning import FineTunedModel
4
  from StableDiffuser import StableDiffuser
5
  from train import train
6
+ from diffusers.pipelines.stable_diffusion.safety_checker import StableDiffusionSafetyChecker
7
+
8
  import os
9
  model_map = {'Van Gogh' : 'models/vangogh.pt',
10
  'Pablo Picasso': 'models/pablopicasso.pt',
 
231
  n_steps=50,
232
  generator=generator
233
  )
234
+ images, has_nsfw_concept = StableDiffusionSafetyChecker(
235
+ images=images
236
+ )
237
+
238
  orig_image = images[0][0]
239
 
240
  torch.cuda.empty_cache()
 
248
  n_steps=50,
249
  generator=generator
250
  )
251
+ images, has_nsfw_concept = StableDiffusionSafetyChecker(
252
+ images=images
253
+ )
254
  edited_image = images[0][0]
255
 
256
  del finetuner