-
Notifications
You must be signed in to change notification settings - Fork 0
/
Deluge
27 lines (27 loc) · 808 Bytes
/
Deluge
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// Trigger: on user input of text field
if(input.imagine_image_text != null)
{
// Setup Headers
headers = Map();
headers.put("Content-Type","application/json");
headers.put("Authorization","Bearer YOUR-API-KEY");
headers.put("OpenAI-Organization","YOUR-ORGANISATION-ID");
data = Map();
data.put("prompt",input.imagine_image_text);
data.put("size","512x512");
// invoke url
response = invokeurl
[
url :"https://api.openai.com/v1/images/generations"
type :POST
parameters:data.toString()
headers:headers
];
// Extract ChatGPT response
data = response.getJSON("data");
url = data.getJSON("url");
input.Image_URL = url;
}
// Trigger: on user input of image URL field
Image_link = input.Image_URL;
input.Display_Image = "<img height=’512′ width=’512′ src='" + Image_link + "'/>";