Skip to content

lucianoambrosini.it

OpenAI (DALL-E) inside Grasshopper with Python – Advanced version

Recently many Architects and Designers have been exploring different AI platforms – This is exciting!
If you want to go straight to the point: Jump to “Edit mode” or Jump to “Variation mode”

So I would like to share with you this little intuition…

📣 This Advanced version of DALL-E inside Grasshopper takes into account some existing features already implemented on the OpenAI platform. The components that I have coded allow you to execute the requesting process to elaborate predictions directly from Grasshopper. In particular, this update introduces the Edit and the Variation features. Last but not least I have speeded up the design workflow to run the “Edit” task thanks to the ImageMask component. These components have been included in the Ambrosinus-Toolkit since v.1.1.2 (downloadable from Rhino Package Manager too).
Enjoy the reading! 😉

This article is the natural continuation of the one related to the first introduction of the request processes for the processing of images from the prompt to image by Artificial Intelligence (see here). So here below I assume that you already have installed all necessary to run LA_OpenAI-GH ghuser component that you will find in the AI Ambrosinus-Toolkit sub-category. Anyway, I added some extra tips for some of you that have encountered issues in installing the python libraries (unfortunately this procedure depends on AI platform developers).

 

Now this component is available on my GitHub page and has replaced the previous Python light version one

EDIT mode

Coded components in action:

The key concept behind the Edit process consists in elaborating an “image mask” based on the given one as input (BaseIMG parameter) with a transparent “shape mask”. In this way, the AI quickly realizes that the area in which the DALL-E algorithm will have to make changes (elaborates new predictions) is only the transparent one, all the rest, opaque, will remain unchanged. The design workflow improvements regard the possibility to avoid going forth and back from Photoshop or from whatever image-editing software you prefer and go on staying in a unique design environment like Rhino and Grasshopper.

Maybe this is a little thing…but this is my intuition. Let me explaining

So thanks to the ImageMask component is it possible to draw inside Rhino and over the base image given as source input and use the 2D Rhino tools as a “lasso selection tool”. The nested sequence is Frame (one curve) > Curves (also more than one) > Holes (also more than one – optional – but very important is that holes need to be contained in Curve) – Please do not draw intersections among these three categories to avoid failure. Others info about ImageMask are available here.

Briefly in order to run Edit mode you need:

  • API Key;
  • select mode;
  • a base image (PNG);
  • an image mask as described above;
  • a full path where saving all new images;
  • text prompt;
  • number of images to generate;
  • images size (256px or 512px or 1024px)

For instance, imagine that you or your colleague has generated a facade study for a beautiful building or architectural project. Now you can “manipulate” as expected by Open AI just a specific portion of that facade. This “little intuition” allows you to push forward your creative boundaries and even more smartly your design production.

Image source credits by Hassan Ragab from IG @hsnrgb – further improvement/enhancement by Luciano Ambrosini
Image source credits by Arturo Tedeschi from IG @arturotedeschi – further improvement/enhancement by Luciano Ambrosini

Below I have provided a simple carousel of images

 

Here below the video DEMO



 

 

 

VARIATION mode

Coded components in action:

About the Variation process, I can only tell you that the whole image production is made by DALL-E in terms of input parameters, you only need to give as input the base image, no image mask, no text prompt is needed.

Briefly in order to run Variation mode you need:

  • API Key;
  • select mode;
  • a base image (PNG);

So unleash your creativity! 😉

Image source credits by Hassan Ragab from IG @hsnrgb – further improvement/enhancement by Luciano Ambrosini
Image source credits by Arturo Tedeschi from IG @arturotedeschi – further improvement/enhancement by Luciano Ambrosini

Below I have provided a simple carousel of images

Since Build 110 output files are packed in an IMGs folder (all images), TXTs folder (all text prompts) and finally this build creates a CSV file as LOG output of all the AI requests and generation processes.

 
Here below the video DEMO



 

Download this component from HERE 

 

Interested in my works? see *About Me* section and contact me by email and/or by social