Staticaliza commited on
Commit
cd12320
·
verified ·
1 Parent(s): 1745e08

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -32,7 +32,7 @@ footer {
32
  }
33
  '''
34
 
35
- repo_nsfw_classifier = pipeline("image-classification", model="Falconsai/nsfw_image_detection")
36
 
37
  repo_default = StableDiffusionXLPipeline.from_pretrained("fluently/Fluently-XL-Final", torch_dtype=torch.float16, use_safetensors=True, add_watermarker=False)
38
  repo_default.load_lora_weights("ehristoforu/dalle-3-xl-v2", adapter_name="base")
@@ -98,7 +98,8 @@ def generate(input=DEFAULT_INPUT, filter_input="", negative_input=DEFAULT_NEGATI
98
  guidance = guidance_set
99
 
100
  print(steps, guidance)
101
-
 
102
  repo.to(DEVICE)
103
 
104
  parameters = {
@@ -117,7 +118,7 @@ def generate(input=DEFAULT_INPUT, filter_input="", negative_input=DEFAULT_NEGATI
117
  image_paths = [save_image(img, seed) for img in images]
118
 
119
  print(image_paths)
120
-
121
  nsfw_prediction = repo_nsfw_classifier(Image.open(image_paths[0]))
122
 
123
  print(nsfw_prediction)
 
32
  }
33
  '''
34
 
35
+ repo_nsfw_classifier = AutoModel.from_pretrained("Falconsai/nsfw_image_detection")
36
 
37
  repo_default = StableDiffusionXLPipeline.from_pretrained("fluently/Fluently-XL-Final", torch_dtype=torch.float16, use_safetensors=True, add_watermarker=False)
38
  repo_default.load_lora_weights("ehristoforu/dalle-3-xl-v2", adapter_name="base")
 
98
  guidance = guidance_set
99
 
100
  print(steps, guidance)
101
+
102
+ repo_nsfw_classifier.to(DEVICE)
103
  repo.to(DEVICE)
104
 
105
  parameters = {
 
118
  image_paths = [save_image(img, seed) for img in images]
119
 
120
  print(image_paths)
121
+
122
  nsfw_prediction = repo_nsfw_classifier(Image.open(image_paths[0]))
123
 
124
  print(nsfw_prediction)