fffiloni commited on
Commit
040c9ac
1 Parent(s): d02a25f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -9
app.py CHANGED
@@ -37,19 +37,26 @@ def resize(height,img):
37
 
38
  def infer(prompt, source_img):
39
  if(source_img != None):
40
- init_image = resize(512,source_img)
41
- init_image.save('source.png')
42
  images_list = img_pipe([prompt] * 2, init_image=init_image, strength=0.75)
 
 
 
 
 
 
 
43
  else:
44
  images_list = prompt_pipe([prompt] * 2)
 
 
 
 
 
 
 
45
 
46
- images = []
47
- safe_image = Image.open(r"unsafe.png")
48
- for i, image in enumerate(images_list["sample"]):
49
- if(images_list["nsfw_content_detected"][i]):
50
- images.append(safe_image)
51
- else:
52
- images.append(image)
53
 
54
  return images
55
  print("Great sylvain ! Everything is working fine !")
 
37
 
38
  def infer(prompt, source_img):
39
  if(source_img != None):
40
+ source_image = resize(512,source_img)
41
+ source_image.save('source.png')
42
  images_list = img_pipe([prompt] * 2, init_image=init_image, strength=0.75)
43
+ images = []
44
+ safe_image = Image.open(r"unsafe.png")
45
+ for i, image in enumerate(images_list["sample"]):
46
+ if(images_list["nsfw_content_detected"][i]):
47
+ images.append(safe_image)
48
+ else:
49
+ images.append(image)
50
  else:
51
  images_list = prompt_pipe([prompt] * 2)
52
+ images = []
53
+ safe_image = Image.open(r"unsafe.png")
54
+ for i, image in enumerate(images_list["sample"]):
55
+ if(images_list["nsfw_content_detected"][i]):
56
+ images.append(safe_image)
57
+ else:
58
+ images.append(image)
59
 
 
 
 
 
 
 
 
60
 
61
  return images
62
  print("Great sylvain ! Everything is working fine !")