aa
Browse files
app.py
CHANGED
|
@@ -16,7 +16,34 @@ pipe.to("cuda")
|
|
| 16 |
pipe.enable_xformers_memory_efficient_attention()
|
| 17 |
pipe.unet.to(memory_format=torch.channels_last)
|
| 18 |
|
| 19 |
-
help_text = """
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
|
| 21 |
def previous(image):
|
| 22 |
return image
|
|
|
|
| 16 |
pipe.enable_xformers_memory_efficient_attention()
|
| 17 |
pipe.unet.to(memory_format=torch.channels_last)
|
| 18 |
|
| 19 |
+
help_text = """
|
| 20 |
+
**Note: Please be advised that a safety checker has been implemented in this public space.
|
| 21 |
+
Any attempts to generate inappropriate or NSFW images will result in the display of a black screen
|
| 22 |
+
as a precautionary measure to protect all users. We appreciate your cooperation in
|
| 23 |
+
maintaining a safe and appropriate environment for all members of our community.**
|
| 24 |
+
|
| 25 |
+
New features and bug-fixes:
|
| 26 |
+
|
| 27 |
+
1. Chat style interface
|
| 28 |
+
2. Now use **'reverse'** as prompt to get back the previous image after an unwanted edit
|
| 29 |
+
3. Use **'restart'** as prompt to get back to original image and start over!
|
| 30 |
+
4. Now you can load larger image files (~5 mb) as well
|
| 31 |
+
|
| 32 |
+
Some notes from the official [instruct-pix2pix](https://huggingface.co/spaces/timbrooks/instruct-pix2pix) Space by the authors and from the official [Diffusers docs](https://huggingface.co/docs/diffusers/main/en/api/pipelines/stable_diffusion/pix2pix) -
|
| 33 |
+
|
| 34 |
+
If you're not getting what you want, there may be a few reasons:
|
| 35 |
+
1. Is the image not changing enough? Your guidance_scale may be too low. It should be >1. Higher guidance scale encourages to generate images
|
| 36 |
+
that are closely linked to the text `prompt`, usually at the expense of lower image quality. This value dictates how similar the output should
|
| 37 |
+
be to the input. This pipeline requires a value of at least `1`. It's possible your edit requires larger changes from the original image.
|
| 38 |
+
|
| 39 |
+
2. Alternatively, you can toggle image_guidance_scale. Image guidance scale is to push the generated image towards the inital image. Image guidance
|
| 40 |
+
scale is enabled by setting `image_guidance_scale > 1`. Higher image guidance scale encourages to generate images that are closely
|
| 41 |
+
linked to the source image `image`, usually at the expense of lower image quality.
|
| 42 |
+
3. I have observed that rephrasing the instruction sometimes improves results (e.g., "turn him into a dog" vs. "make him a dog" vs. "as a dog").
|
| 43 |
+
4. Increasing the number of steps sometimes improves results.
|
| 44 |
+
5. Do faces look weird? The Stable Diffusion autoencoder has a hard time with faces that are small in the image. Try:
|
| 45 |
+
* Cropping the image so the face takes up a larger portion of the frame.
|
| 46 |
+
"""
|
| 47 |
|
| 48 |
def previous(image):
|
| 49 |
return image
|