Spaces:
Runtime error
Runtime error
Commit
Β·
ff99100
1
Parent(s):
9e07bd7
Update space
Browse files
app.py
CHANGED
|
@@ -2,7 +2,7 @@ import spaces
|
|
| 2 |
import gradio as gr
|
| 3 |
import numpy as np
|
| 4 |
import torch
|
| 5 |
-
import
|
| 6 |
from diffusers import DDPMScheduler, StableDiffusionPipeline, DDIMScheduler, UNet2DConditionModel
|
| 7 |
from diffusers import StableDiffusionInstructPix2PixPipeline, LCMScheduler
|
| 8 |
|
|
@@ -23,7 +23,7 @@ MAX_IMAGE_SIZE = 1024
|
|
| 23 |
|
| 24 |
@spaces.GPU(duration=30)
|
| 25 |
def infer(image, edit_instruction, guidance_scale, image_guidance_scale, n_steps):
|
| 26 |
-
|
| 27 |
image = pipe(prompt=edit_instruction,
|
| 28 |
image=image,
|
| 29 |
num_inference_steps=n_steps,
|
|
@@ -50,7 +50,7 @@ with gr.Blocks(css=css) as demo:
|
|
| 50 |
with gr.Column(elem_id="col-container"):
|
| 51 |
gr.Markdown(
|
| 52 |
f"""
|
| 53 |
-
# β‘ Instruct-
|
| 54 |
Currently running on {power_device}
|
| 55 |
"""
|
| 56 |
)
|
|
|
|
| 2 |
import gradio as gr
|
| 3 |
import numpy as np
|
| 4 |
import torch
|
| 5 |
+
from PIL import Image
|
| 6 |
from diffusers import DDPMScheduler, StableDiffusionPipeline, DDIMScheduler, UNet2DConditionModel
|
| 7 |
from diffusers import StableDiffusionInstructPix2PixPipeline, LCMScheduler
|
| 8 |
|
|
|
|
| 23 |
|
| 24 |
@spaces.GPU(duration=30)
|
| 25 |
def infer(image, edit_instruction, guidance_scale, image_guidance_scale, n_steps):
|
| 26 |
+
image = Image.fromarray(image).resize((512, 512))
|
| 27 |
image = pipe(prompt=edit_instruction,
|
| 28 |
image=image,
|
| 29 |
num_inference_steps=n_steps,
|
|
|
|
| 50 |
with gr.Column(elem_id="col-container"):
|
| 51 |
gr.Markdown(
|
| 52 |
f"""
|
| 53 |
+
# β‘ Instruct-pix2pix with Consistency Distillationβ‘
|
| 54 |
Currently running on {power_device}
|
| 55 |
"""
|
| 56 |
)
|