CoolFace
Modelpublic

diffusers/tools

sourceHugging Facecreativeml-openrail-mupdated 3y agoView on Hugging Face
11likes28downloads
run_lcm.py22 linesDownload Raw Back to root
1#!/usr/bin/env python32from diffusers import AutoPipelineForText2Image, AutoPipelineForImage2Image3import torch4 5pipe = AutoPipelineForText2Image.from_pretrained("SimianLuo/LCM_Dreamshaper_v7", dtype=torch.float16)6 7prompt = "A beautiful landscape of a snowy mountain"8 9num_inference_steps = 110 11image = pipe(prompt=prompt, num_inference_steps=num_inference_steps, output_type="pil").images[0]12image.save("snow_mountain.png")13 14pipe = AutoPipelineForImage2Image.from_pipe(pipe)15 16prompt = "A beautiful landscape of a very red mountain"17 18image = pipe(prompt=prompt, image=image, num_inference_steps=10, strength=0.05, output_type="pil").images[0]19image.show()20 21 22