(self, device)
| 274 | |
| 275 | class Text2Image: |
| 276 | def __init__(self, device): |
| 277 | print(f"Initializing Text2Image to {device}") |
| 278 | self.device = device |
| 279 | self.torch_dtype = torch.float16 if 'cuda' in device else torch.float32 |
| 280 | self.pipe = StableDiffusionPipeline.from_pretrained("runwayml/stable-diffusion-v1-5", |
| 281 | torch_dtype=self.torch_dtype) |
| 282 | self.pipe.to(device) |
| 283 | self.a_prompt = 'best quality, extremely detailed' |
| 284 | self.n_prompt = 'longbody, lowres, bad anatomy, bad hands, missing fingers, extra digit, ' \ |
| 285 | 'fewer digits, cropped, worst quality, low quality' |
| 286 | |
| 287 | @prompts(name="Generate Image From User Input Text", |
| 288 | description="useful when you want to generate an image from a user input text and save it to a file. " |
nothing calls this directly
no outgoing calls
no test coverage detected