ImaginAIry
Pythonic AI generation of images and videos
Install / Use
/learn @brycedrennan/ImaginAIryREADME
ImaginAIry 🤖🧠
AI imagined images. Pythonic generation of stable diffusion images and videos *!.
"just works" on Linux and macOS(M1) (and sometimes windows).
# on macOS, make sure rust is installed first
# be sure to use Python 3.10, Python 3.11 is not supported at the moment
>> pip install imaginairy
>> imagine "a scenic landscape" "a photo of a dog" "photo of a fruit bowl" "portrait photo of a freckled woman" "a bluejay"
# Make an AI video
>> aimg videogen --start-image rocket.png
Stable Video Diffusion
<p float="left"> <img src="docs/assets/svd-rocket.gif" height="190"> <img src="docs/assets/svd-athens.gif" height="190"> <img src="docs/assets/svd-pearl-girl.gif" height="190"> <img src="docs/assets/svd-starry-night.gif" height="190"> <img src="docs/assets/svd-dog.gif" height="190"> <img src="docs/assets/svd-xpbliss.gif" height="190"> </p>Rushed release of Stable Diffusion Video!
Works with Nvidia GPUs. Does not work on Mac or CPU.
On Windows you'll need to install torch 2.0 first via https://pytorch.org/get-started/locally/
Usage: aimg videogen [OPTIONS]
AI generate a video from an image
Example:
aimg videogen --start-image assets/rocket-wide.png
Options:
--start-image TEXT Input path for image file.
--num-frames INTEGER Number of frames.
--num-steps INTEGER Number of steps.
--model TEXT Model to use. One of: svd, svd_xt, svd_image_decoder, svd_xt_image_decoder
--fps INTEGER FPS for the AI to target when generating video
--output-fps INTEGER FPS for the output video
--motion-amount INTEGER How much motion to generate. value between 0 and 255.
-r, --repeats INTEGER How many times to repeat the renders. [default: 1]
--cond-aug FLOAT Conditional augmentation.
--seed INTEGER Seed for random number generator.
--decoding_t INTEGER Number of frames decoded at a time.
--output_folder TEXT Output folder.
--help Show this message and exit.
Images
<p float="left"> <img src="docs/assets/026882_1_ddim50_PS7.5_a_scenic_landscape_[generated].jpg" height="256"> <img src="docs/assets/026884_1_ddim50_PS7.5_photo_of_a_dog_[generated].jpg" height="256"> <img src="docs/assets/026890_1_ddim50_PS7.5_photo_of_a_bowl_of_fruit._still_life_[generated].jpg" height="256"> <img src="docs/assets/026885_1_ddim50_PS7.5_girl_with_a_pearl_earring_[generated].jpg" height="256"> <img src="docs/assets/026891_1_ddim50_PS7.5_close-up_photo_of_a_bluejay_[generated].jpg" height="256"> <img src="docs/assets/026893_1_ddim50_PS7.5_macro_photo_of_a_flower_[generated].jpg" height="256"> </p>Whats New
14.3.0
- feature: integrates spandrel for upscaling
- fix: allow loading sdxl models from local paths.
14.2.0
- 🎉 feature: add image prompt support via
--image-promptand--image-prompt-strength
14.1.1
- tests: add installation tests for windows, mac, and conda
- fix: dependency issues
14.1.0
- 🎉 feature: make video generation smooth by adding frame interpolation
- feature: SDXL weights in the compvis format can now be used
- feature: allow video generation at any size specified by user
- feature: video generations output in "bounce" format
- feature: choose video output format: mp4, webp, or gif
- feature: fix random seed handling in video generation
- docs: auto-publish docs on push to master
- build: remove imageio dependency
- build: vendorize facexlib so we don't install its unneeded dependencies
14.0.4
- docs: add a documentation website at https://brycedrennan.github.io/imaginAIry/
- build: remove fairscale dependency
- fix: video generation was broken
14.0.3
- fix: several critical bugs with package
- tests: add a wheel smoketest to detect these issues in the future
14.0.0
- 🎉 video generation using Stable Video Diffusion
- add
--videogento any image generation to create a short video from the generated image - or use
aimg videogento generate a video from an image
- add
- 🎉 SDXL (Stable Diffusion Extra Large) models are now supported.
- try
--model opendalleor--model sdxl - inpainting and controlnets are not yet supported for SDXL
- try
- 🎉 imaginairy is now backed by the refiners library
- This was a huge rewrite which is why some features are not yet supported. On the plus side, refiners supports cutting edge features (SDXL, image prompts, etc) which will be added to imaginairy soon.
- self-attention guidance which makes details of images more accurate
- 🎉 feature: larger image generations now work MUCH better and stay faithful to the same image as it looks at a smaller size.
For example
--size 720p --seed 1and--size 1080p --seed 1will produce the same image for SD15 - 🎉 feature: loading diffusers based models now supported. Example
--model https://huggingface.co/ainz/diseny-pixar --model-architecture sd15 - 🎉 feature: qrcode controlnet!
Run API server and StableStudio web interface (alpha)
Generate images via API or web interface. Much smaller featureset compared to the command line tool.
>> aimg server
Visit http://localhost:8000/ and http://localhost:8000/docs
<img src="https://github.com/Stability-AI/StableStudio/blob/a65d4877ad7d309627808a169818f1add8c278ae/misc/GenerateScreenshot.png?raw=true" width="512">Image Structure Control by ControlNet
(Not supported for SDXL yet)
Generate images guided by body poses, depth maps, canny edges, hed boundaries, or normal maps.
Openpose Control
imagine --control-image assets/indiana.jpg --control-mode openpose --caption-text openpose "photo of a polar bear"
<p float="left">
<img src="docs/assets/indiana.jpg" height="256">
<img src="docs/assets/indiana-pose.jpg" height="256">
<img src="docs/assets/indiana-pose-polar-bear.jpg" height="256">
</p>
Canny Edge Control
imagine --control-image assets/lena.png --control-mode canny "photo of a woman with a hat looking at the camera"
<p float="left">
<img src="docs/assets/lena.png" height="256">
<img src="docs/assets/lena-canny.jpg" height="256">
<img src="docs/assets/lena-canny-generated.jpg" height="256">
</p>
HED Boundary Control
imagine --control-image dog.jpg --control-mode hed "photo of a dalmation"
<p float="left">
<img src="docs/assets/000032_337692011_PLMS40_PS7.5_a_photo_of_a_dog.jpg" height="256">
<img src="docs/assets/dog-hed-boundary.jpg" height="256">
<img src="docs/assets/dog-hed-boundary-dalmation.jpg" height="256">
</p>
Depth Map Control
imagine --control-image fancy-living.jpg --control-mode depth "a modern living room"
<p float="left">
<img src="docs/assets/fancy-living.jpg" height="256">
<img src="docs/assets/fancy-living-depth.jpg" height="256">
<img src="docs/assets/fancy-living-depth-generated.jpg" height="256">
</p>
Normal Map Control
imagine --control-image bird.jpg --control-mode normal "a bird"
<p float="left">
<img src="docs/assets/013986_1_kdpmpp2m59_PS7.5_a_bluejay_[generated].jpg" height="256">
<img src="docs/assets/bird-normal.jpg" height="256">
<img src="docs/assets/bird-normal-generated.jpg" height="256">
</p>
Image Shuffle Control
Generates the image based on elements of the control image. Kind of similar to style transfer.
imagine --control-image pearl-girl.jpg --control-mode shuffle "a clown"
The middle image is the "shuffled" input image
<p float="left"> <img src="docs/assets/girl_with_a_pearl_earring.jpg" height="256"> <img src="docs/assets/pearl_shuffle_019331_1_kdpmpp2m15_PS7.5_img2img-0.0_a_clown.jpg" height="256"> <img src="docs/assets/pearl_shuffle_clown_019331_1_kdpmpp2m15_PS7.5_img2img-0.0_a_clown.jpg" height="256"> </p>Editing Instructions Control
Similar to instructPix2Pix (below) but works with any SD 1.5 based model.
imagine --control-image pearl-girl.jpg --control-mode edit --init-image-strength 0.01 --steps 30 --negative-prompt "" --model openjourney-v2 "make it anime" "make it at the beach"
<p float="left">
<img src="docs/assets/girl_with_a_pearl_earring.jpg" height="256">
<img src="docs/assets/pearl_anime_019537_521829407_kdpmpp2m30_PS9.0_img2img-0.01_make_it_anime.jpg" height="256">
<img src="docs/assets/pearl_beach_019561_862735879_kdpmpp2m30_PS7.0_img2img-0.01_make_it_at_the_beach.jpg" height="256">
</p>
Add Details Control (upscaling/super-resolution)
Replaces existing details in an image. Good to use with --init-image-strength 0.2
imagine --control-image "assets/wishbone.jpg" --control-mode details "sharp focus, high-resolution" --init-image-strength 0.2 --steps 30 -w 2048 -h 2048
<p float="left">
<img src="docs/assets/wishbone_headshot_badscale.jpg" height="256">
<img src="docs/assets/wishbone_headshot_details.jpg" height="256">
</p>
Image (re)Colorization (using brightness control)
Colorize black and white images or re-color existing images.
The generated colors will be applied back to the original image. You can
