(self, device)
| 516 | |
| 517 | class ScribbleText2Image: |
| 518 | def __init__(self, device): |
| 519 | print(f"Initializing ScribbleText2Image to {device}") |
| 520 | self.torch_dtype = torch.float16 if 'cuda' in device else torch.float32 |
| 521 | self.controlnet = ControlNetModel.from_pretrained("fusing/stable-diffusion-v1-5-controlnet-scribble", |
| 522 | torch_dtype=self.torch_dtype) |
| 523 | self.pipe = StableDiffusionControlNetPipeline.from_pretrained( |
| 524 | "runwayml/stable-diffusion-v1-5", controlnet=self.controlnet, safety_checker=StableDiffusionSafetyChecker.from_pretrained('CompVis/stable-diffusion-safety-checker'), |
| 525 | torch_dtype=self.torch_dtype |
| 526 | ) |
| 527 | self.pipe.scheduler = UniPCMultistepScheduler.from_config(self.pipe.scheduler.config) |
| 528 | self.pipe.to(device) |
| 529 | self.seed = -1 |
| 530 | self.a_prompt = 'best quality, extremely detailed' |
| 531 | self.n_prompt = 'longbody, lowres, bad anatomy, bad hands, missing fingers, extra digit, ' \ |
| 532 | 'fewer digits, cropped, worst quality, low quality' |
| 533 | |
| 534 | @prompts(name="Generate Image Condition On Sketch Image", |
| 535 | description="useful when you want to generate a new real image from both the user description and " |
nothing calls this directly
no outgoing calls
no test coverage detected