patrickvonplaten commited on
Commit
9d20a4e
1 Parent(s): 0911685

better model

Browse files
Files changed (1) hide show
  1. image_transformation.py +3 -6
image_transformation.py CHANGED
@@ -15,7 +15,7 @@ if is_vision_available():
15
  from PIL import Image
16
 
17
  if is_diffusers_available():
18
- from diffusers import ControlNetModel, StableDiffusionControlNetPipeline, UniPCMultistepScheduler
19
 
20
  if is_opencv_available():
21
  import cv2
@@ -30,7 +30,7 @@ IMAGE_TRANSFORMATION_DESCRIPTION = (
30
 
31
  class ImageTransformationTool(Tool):
32
  default_stable_diffusion_checkpoint = "runwayml/stable-diffusion-v1-5"
33
- default_controlnet_checkpoint = "lllyasviel/control_v11p_sd15_canny"
34
  description = IMAGE_TRANSFORMATION_DESCRIPTION
35
  inputs = ['image', 'text']
36
  outputs = ['image']
@@ -66,7 +66,7 @@ class ImageTransformationTool(Tool):
66
  self.pipeline = StableDiffusionControlNetPipeline.from_pretrained(
67
  self.stable_diffusion_checkpoint, controlnet=self.controlnet
68
  )
69
- self.pipeline.scheduler = UniPCMultistepScheduler.from_config(self.pipeline.scheduler.config)
70
 
71
  self.pipeline.to(self.device)
72
  if self.device.type == "cuda":
@@ -78,9 +78,6 @@ class ImageTransformationTool(Tool):
78
  if not self.is_initialized:
79
  self.setup()
80
 
81
- initial_prompt = "super-hero character, best quality, extremely detailed"
82
- prompt = initial_prompt + prompt
83
-
84
  low_threshold = 100
85
  high_threshold = 200
86
 
 
15
  from PIL import Image
16
 
17
  if is_diffusers_available():
18
+ from diffusers import ControlNetModel, StableDiffusionControlNetPipeline, DPMSolverMultistepScheduler
19
 
20
  if is_opencv_available():
21
  import cv2
 
30
 
31
  class ImageTransformationTool(Tool):
32
  default_stable_diffusion_checkpoint = "runwayml/stable-diffusion-v1-5"
33
+ default_controlnet_checkpoint = "lllyasviel/control_v11e_sd15_ip2p"
34
  description = IMAGE_TRANSFORMATION_DESCRIPTION
35
  inputs = ['image', 'text']
36
  outputs = ['image']
 
66
  self.pipeline = StableDiffusionControlNetPipeline.from_pretrained(
67
  self.stable_diffusion_checkpoint, controlnet=self.controlnet
68
  )
69
+ self.pipeline.scheduler = DPMSolverMultistepScheduler.from_config(self.pipeline.scheduler.config)
70
 
71
  self.pipeline.to(self.device)
72
  if self.device.type == "cuda":
 
78
  if not self.is_initialized:
79
  self.setup()
80
 
 
 
 
81
  low_threshold = 100
82
  high_threshold = 200
83