Spaces:
Runtime error
Runtime error
Commit
·
efefb83
1
Parent(s):
17e197e
test
Browse files
app.py
CHANGED
|
@@ -12,7 +12,7 @@ def generate_image(prompt, num_inference_steps, guidance_scale):
|
|
| 12 |
model_id = "stabilityai/stable-diffusion-xl-base-1.0"
|
| 13 |
adapter_id = "latent-consistency/lcm-lora-sdxl"
|
| 14 |
|
| 15 |
-
pipe = AutoPipelineForText2Image.from_pretrained(model_id, torch_dtype=torch.
|
| 16 |
pipe.scheduler = LCMScheduler.from_config(pipe.scheduler.config)
|
| 17 |
pipe.to("cuda")
|
| 18 |
|
|
@@ -28,7 +28,7 @@ def generate_image(prompt, num_inference_steps, guidance_scale):
|
|
| 28 |
def inpaint_image(prompt, init_image, mask_image, num_inference_steps, guidance_scale):
|
| 29 |
pipe = AutoPipelineForInpainting.from_pretrained(
|
| 30 |
"diffusers/stable-diffusion-xl-1.0-inpainting-0.1",
|
| 31 |
-
torch_dtype=torch.
|
| 32 |
variant="fp16",
|
| 33 |
).to("cuda")
|
| 34 |
pipe.scheduler = LCMScheduler.from_config(pipe.scheduler.config)
|
|
@@ -64,7 +64,7 @@ def generate_image_with_adapter(prompt, num_inference_steps, guidance_scale):
|
|
| 64 |
pipe = DiffusionPipeline.from_pretrained(
|
| 65 |
"stabilityai/stable-diffusion-xl-base-1.0",
|
| 66 |
variant="fp16",
|
| 67 |
-
torch_dtype=torch.
|
| 68 |
).to("cuda")
|
| 69 |
|
| 70 |
# set scheduler
|
|
@@ -94,6 +94,10 @@ def modify_image(image, brightness, contrast):
|
|
| 94 |
return image
|
| 95 |
|
| 96 |
with gr.Blocks(gr.themes.Soft()) as demo:
|
|
|
|
|
|
|
|
|
|
|
|
|
| 97 |
with gr.Row():
|
| 98 |
image_output = gr.Image(label="Generated Image")
|
| 99 |
|
|
|
|
| 12 |
model_id = "stabilityai/stable-diffusion-xl-base-1.0"
|
| 13 |
adapter_id = "latent-consistency/lcm-lora-sdxl"
|
| 14 |
|
| 15 |
+
pipe = AutoPipelineForText2Image.from_pretrained(model_id, torch_dtype=torch.float32, variant="fp16")
|
| 16 |
pipe.scheduler = LCMScheduler.from_config(pipe.scheduler.config)
|
| 17 |
pipe.to("cuda")
|
| 18 |
|
|
|
|
| 28 |
def inpaint_image(prompt, init_image, mask_image, num_inference_steps, guidance_scale):
|
| 29 |
pipe = AutoPipelineForInpainting.from_pretrained(
|
| 30 |
"diffusers/stable-diffusion-xl-1.0-inpainting-0.1",
|
| 31 |
+
torch_dtype=torch.float32,
|
| 32 |
variant="fp16",
|
| 33 |
).to("cuda")
|
| 34 |
pipe.scheduler = LCMScheduler.from_config(pipe.scheduler.config)
|
|
|
|
| 64 |
pipe = DiffusionPipeline.from_pretrained(
|
| 65 |
"stabilityai/stable-diffusion-xl-base-1.0",
|
| 66 |
variant="fp16",
|
| 67 |
+
torch_dtype=torch.float32
|
| 68 |
).to("cuda")
|
| 69 |
|
| 70 |
# set scheduler
|
|
|
|
| 94 |
return image
|
| 95 |
|
| 96 |
with gr.Blocks(gr.themes.Soft()) as demo:
|
| 97 |
+
with gr.Row():
|
| 98 |
+
gr.Markdown("## Latent Consistency for Diffusion Models")
|
| 99 |
+
gr.Markdown("Run this demo on your own machine if you would like: docker run -it -p 7860:7860 --platform=linux/amd64 --gpus all \
|
| 100 |
+
registry.hf.space/macadeliccc-lcm-papercut-demo:latest python app.py")
|
| 101 |
with gr.Row():
|
| 102 |
image_output = gr.Image(label="Generated Image")
|
| 103 |
|