yamildiego commited on
Commit
f559cf4
1 Parent(s): fddc5d7

adding other model

Browse files
Files changed (2) hide show
  1. README.md +1 -5
  2. handler.py +7 -34
README.md CHANGED
@@ -28,8 +28,4 @@ inference: true
28
  }
29
  ```
30
 
31
- SD_MODEL no tested
32
-
33
- default => Lykon/dreamshaper-8
34
-
35
- default || dreamshaper || juggernaut || realistic-vision || rev-animated
 
28
  }
29
  ```
30
 
31
+ dreamshaper || dreamshaper_2
 
 
 
 
handler.py CHANGED
@@ -26,49 +26,22 @@ CONTROLNET_MAPPING = {
26
  },
27
  }
28
 
29
-
30
- # SD_ID_MAPPING = {
31
- # "default": "Lykon/dreamshaper-8",
32
- # "dreamshaper": "stablediffusionapi/dreamshaper-xl",
33
- # "juggernaut": "stablediffusionapi/juggernaut-xl-v8",
34
- # "realistic":"SG161222/Realistic_Vision_V1.4",
35
- # "rev":"s6yx/ReV_Animated"
36
- # }
37
-
38
  class EndpointHandler():
39
  def __init__(self, path=""):
40
  self.control_type = "depth"
41
  self.controlnet = ControlNetModel.from_pretrained(CONTROLNET_MAPPING[self.control_type]["model_id"],torch_dtype=dtype).to(device)
42
 
43
  self.stable_diffusion_id_0 = "Lykon/dreamshaper-8"
44
- self.default = StableDiffusionControlNetPipeline.from_pretrained(self.stable_diffusion_id_0,
45
  controlnet=self.controlnet,
46
  torch_dtype=dtype,
47
  safety_checker=StableDiffusionSafetyChecker.from_pretrained("CompVis/stable-diffusion-safety-checker", torch_dtype=dtype)).to("cuda")
48
 
49
- # self.stable_diffusion_id_1 = "stablediffusionapi/dreamshaper-xl"
50
- # self.juggernaut = StableDiffusionControlNetPipeline.from_pretrained(self.stable_diffusion_id_1,
51
- # controlnet=self.controlnet,
52
- # torch_dtype=dtype,
53
- # safety_checker=StableDiffusionSafetyChecker.from_pretrained("CompVis/stable-diffusion-safety-checker", torch_dtype=dtype)).to("cuda")
54
- # self.stable_diffusion_id_2 = "stablediffusionapi/juggernaut-xl-v8"
55
- # self.realistic = StableDiffusionControlNetPipeline.from_pretrained(self.stable_diffusion_id_2,
56
- # controlnet=self.controlnet,
57
- # torch_dtype=dtype,
58
- # safety_checker=StableDiffusionSafetyChecker.from_pretrained("CompVis/stable-diffusion-safety-checker", torch_dtype=dtype)).to("cuda")
59
- # self.stable_diffusion_id_3 = "SG161222/Realistic_Vision_V1.4"
60
- # self.pipe = StableDiffusionControlNetPipeline.from_pretrained(self.stable_diffusion_id_3,
61
- # controlnet=self.controlnet,
62
- # torch_dtype=dtype,
63
- # safety_checker=StableDiffusionSafetyChecker.from_pretrained("CompVis/stable-diffusion-safety-checker", torch_dtype=dtype)).to("cuda")
64
- # self.stable_diffusion_id_4 = "s6yx/ReV_Animated"
65
- # self.rev = StableDiffusionControlNetPipeline.from_pretrained(self.stable_diffusion_id_4,
66
- # controlnet=self.controlnet,
67
- # torch_dtype=dtype,
68
- # safety_checker=StableDiffusionSafetyChecker.from_pretrained("CompVis/stable-diffusion-safety-checker", torch_dtype=dtype)).to("cuda")
69
-
70
-
71
-
72
  # Define Generator with seed
73
  self.generator = torch.Generator(device=device.type).manual_seed(3)
74
 
@@ -80,7 +53,7 @@ class EndpointHandler():
80
 
81
 
82
  # hyperparamters
83
- sd_model = data.pop("sd_model", "default")
84
  prompt = data.pop("inputs", None)
85
  negative_prompt = data.pop("negative_prompt", None)
86
  image_depth_map = data.pop("image_depth_map", None)
 
26
  },
27
  }
28
 
 
 
 
 
 
 
 
 
 
29
  class EndpointHandler():
30
  def __init__(self, path=""):
31
  self.control_type = "depth"
32
  self.controlnet = ControlNetModel.from_pretrained(CONTROLNET_MAPPING[self.control_type]["model_id"],torch_dtype=dtype).to(device)
33
 
34
  self.stable_diffusion_id_0 = "Lykon/dreamshaper-8"
35
+ self.dreamshaper = StableDiffusionControlNetPipeline.from_pretrained(self.stable_diffusion_id_0,
36
  controlnet=self.controlnet,
37
  torch_dtype=dtype,
38
  safety_checker=StableDiffusionSafetyChecker.from_pretrained("CompVis/stable-diffusion-safety-checker", torch_dtype=dtype)).to("cuda")
39
 
40
+ self.stable_diffusion_id_1 = "lykon/dreamshaper-xl-v2-turbo"
41
+ self.dreamshaper_2 = StableDiffusionControlNetPipeline.from_pretrained(self.stable_diffusion_id_1,
42
+ controlnet=self.controlnet,
43
+ torch_dtype=dtype,
44
+ safety_checker=StableDiffusionSafetyChecker.from_pretrained("CompVis/stable-diffusion-safety-checker", torch_dtype=dtype)).to("cuda")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
  # Define Generator with seed
46
  self.generator = torch.Generator(device=device.type).manual_seed(3)
47
 
 
53
 
54
 
55
  # hyperparamters
56
+ sd_model = data.pop("sd_model", "dreamshaper")
57
  prompt = data.pop("inputs", None)
58
  negative_prompt = data.pop("negative_prompt", None)
59
  image_depth_map = data.pop("image_depth_map", None)