Spaces:
Runtime error
Runtime error
Commit
Β·
265d8de
1
Parent(s):
2c9d51e
Update space
Browse files
app.py
CHANGED
|
@@ -15,6 +15,7 @@ pipe.scheduler = LCMScheduler.from_config(pipe.scheduler.config)
|
|
| 15 |
# Adapt the InstructPix2Pix model using the LoRA parameters
|
| 16 |
adapter_id = "latent-consistency/lcm-lora-sdv1-5"
|
| 17 |
pipe.load_lora_weights(adapter_id)
|
|
|
|
| 18 |
|
| 19 |
MAX_SEED = np.iinfo(np.int32).max
|
| 20 |
MAX_IMAGE_SIZE = 1024
|
|
@@ -48,30 +49,12 @@ with gr.Blocks(css=css) as demo:
|
|
| 48 |
with gr.Column(elem_id="col-container"):
|
| 49 |
gr.Markdown(
|
| 50 |
f"""
|
| 51 |
-
# β‘
|
| 52 |
-
# β‘ Text-guided image editing with 8-step iCD-SD1.5 β‘
|
| 53 |
-
This is a demo for [Invertible Consistency Distillation](https://yandex-research.github.io/invertible-cd/),
|
| 54 |
-
a diffusion distillation method proposed in [Invertible Consistency Distillation for Text-Guided Image Editing in Around 7 Steps](https://arxiv.org/abs/2406.14539)
|
| 55 |
-
by [Yandex Research](https://github.com/yandex-research).
|
| 56 |
Currently running on {power_device}
|
| 57 |
"""
|
| 58 |
)
|
| 59 |
gr.Markdown(
|
| 60 |
-
"
|
| 61 |
-
" Lower tau values provide better reference preservation. We commonly use tau=0.6 and tau=0.8. <br />"
|
| 62 |
-
"2. *Cross replace steps (crs)* and *self replace steps (srs)*. Controls the time step interval "
|
| 63 |
-
"where the cross- and self-attention maps are replaced. Higher values lead to better preservation of the reference image. "
|
| 64 |
-
"The optimal values depend on the particular image. "
|
| 65 |
-
"Mostly, we use crs and srs from 0.2 to 0.6. <br />"
|
| 66 |
-
"3. *Amplify word* and *Amplify factor*. Define the word that needs to be enhanced in the edited image. <br />"
|
| 67 |
-
"4. *Blended word*. Specifies the object used for making local edits. That is, edit only selected objects. <br />"
|
| 68 |
-
"5. *Is replacement*. You can set True, if you replace only one word in the original prompt. But False also works in these cases."
|
| 69 |
-
)
|
| 70 |
-
gr.Markdown(
|
| 71 |
-
"Feel free to check out our [image generation demo](https://huggingface.co/spaces/dbaranchuk/iCD-image-generation) as well."
|
| 72 |
-
)
|
| 73 |
-
gr.Markdown(
|
| 74 |
-
"If you enjoy the space, feel free to give a β to the <a href='https://github.com/yandex-research/invertible-cd' target='_blank'>Github Repo</a>. [](https://github.com/yandex-research/invertible-cd)"
|
| 75 |
)
|
| 76 |
with gr.Row():
|
| 77 |
|
|
|
|
| 15 |
# Adapt the InstructPix2Pix model using the LoRA parameters
|
| 16 |
adapter_id = "latent-consistency/lcm-lora-sdv1-5"
|
| 17 |
pipe.load_lora_weights(adapter_id)
|
| 18 |
+
pipe.to('cuda')
|
| 19 |
|
| 20 |
MAX_SEED = np.iinfo(np.int32).max
|
| 21 |
MAX_IMAGE_SIZE = 1024
|
|
|
|
| 49 |
with gr.Column(elem_id="col-container"):
|
| 50 |
gr.Markdown(
|
| 51 |
f"""
|
| 52 |
+
# β‘ Instruct-p2p with Consistency Distillationβ‘
|
|
|
|
|
|
|
|
|
|
|
|
|
| 53 |
Currently running on {power_device}
|
| 54 |
"""
|
| 55 |
)
|
| 56 |
gr.Markdown(
|
| 57 |
+
"If you enjoy the space, feel free to give a β to the <a href='https://github.com/yandex-research/invertible-cd' target='_blank'>Github Repo</a>. [](https://github.com/quickjkee/instruct-pix2pix-distill)"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 58 |
)
|
| 59 |
with gr.Row():
|
| 60 |
|