Get free YouTube views, likes and subscribers
Get Free YouTube Subscribers, Views and Likes

ArcGIS Pro and DALL-E A.I. Integration via Python API - Ru0026D Christmas Special!

Follow
GIS Coordinated

Video no. 157
Please do read this text:

Jump to 11:44 if you want to just see the bit about conda (python config)

In this R&D video I demonstrate integration with DALLE A.I. image generator using the ArcGIS Pro python in Calculate Field.
Note it is the python API and not REST as I mention (wrongly) a few times!
This is just with the image generator but there are lots of other "A.I. playgrounds"....

A few prerequisites:
* Make sure the openai library is installed
* Create a clone of your python environment and activate it
* Create a DALLE API account
* Get your API key make a note of it!
* Create an attribute to store the URL generated by DALLE in any table

The python block looks like this:

yourURLattribute =
getAIPhoto(!Style!)

import os
import openai
def getAIPhoto(treestyle):

openai.api_key = "INSERT_YR_API_KEY_HERE"
response = openai.Image.create(
prompt="photo of a short spruce tree in the style of " + treestyle,
n=1,
size="1024x1024")
image_url = response['data'][0]['url']
return image_url


n = 1 means just return one single image.

Useful links:
https://beta.openai.com/docs/apirefe...
https://anaconda.org/condaforge/conda
https://openai.com/

Retrieve the condaforge channel packages:
conda install c condaforge conda
(that will grab openai library amongst others!)

If you have to update numpy, use pip:
pip install numpy upgrade

posted by moseskc72tt