imaginAIry/docs/examples/generate_doc_examples.py
Bryce 9b95e8b0b6 perf: improve cli startup time
- do not provide automatically imported api functions and objects in `imaginairy` root module
- horrible hack to overcome horrible design choices by easy_install/setuptools

The hack modifies the installed script to remove the __import__ pkg_resources line

If we don't do this then the scripts will be slow to start up because of
pkg_resources.require() which is called by setuptools to ensure the
"correct" version of the package is installed.

before modification example:
```
__requires__ = 'imaginAIry==14.0.0b5'
__import__('pkg_resources').require('imaginAIry==14.0.0b5')
__file__ = '/home/user/projects/imaginairy/imaginairy/bin/aimg'
with open(__file__) as f:
    exec(compile(f.read(), __file__, 'exec'))
```
2023-12-12 20:54:39 -08:00

42 lines
1.3 KiB
Python

from imaginairy.api import imagine_image_files
from imaginairy.schema import ImaginePrompt, LazyLoadingImage
def main():
prompts = [
ImaginePrompt(
"make her wear clown makeup",
seed=952243488,
model="edit",
init_image=LazyLoadingImage(
url="https://github.com/brycedrennan/imaginAIry/raw/2a3e19f5a1a864fcee18c23f17aea02cc0f61bbf/assets/girl_with_a_pearl_earring.jpg"
),
steps=30,
),
ImaginePrompt(
"make her wear clown makeup",
seed=952243488,
model="edit",
init_image=LazyLoadingImage(
url="https://github.com/brycedrennan/imaginAIry/raw/2a3e19f5a1a864fcee18c23f17aea02cc0f61bbf/assets/girl_with_a_pearl_earring.jpg"
),
steps=30,
),
ImaginePrompt(
"make it a color professional photo headshot",
negative_prompt="old, ugly, blurry",
seed=390919410,
model="edit",
init_image=LazyLoadingImage(
url="https://github.com/brycedrennan/imaginAIry/raw/2a3e19f5a1a864fcee18c23f17aea02cc0f61bbf/assets/mona-lisa.jpg"
),
steps=30,
),
]
imagine_image_files(prompts, outdir="./outputs", make_gif=True)
if __name__ == "__main__":
main()