MCPcopy Create free account
hub / github.com/chenfei-wu/TaskMatrix / __init__

Method __init__

visual_chatgpt.py:276–285  ·  view source on GitHub ↗
(self, device)

Source from the content-addressed store, hash-verified

274
275class 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. "

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected