Open charlesjlee opened 1 year ago
So, there's additional steps required. After generation of images it returns generation with id
{
"generations": {
"data": [
{
"id": "generation-KdiiXg780fGKdfOEiMXI8Tnf",
...
},
..,
]
}
}
that KdiiXg780fGKdfOEiMXI8Tnf
is what we will need later on
we launch empty POST request to
https://labs.openai.com/api/labs/generations/generation-KdiiXg780fGKdfOEiMXI8Tnf/share
and then after result is received we generate link like they do (it's not in the response)
https://labs.openai.com/s/KdiiXg780fGKdfOEiMXI8Tnf
import requests
auth_header = "Bearer sess-......"
generation = "KdiiXg780fGKdfOEiMXI8Tnf"
ret = requests.post(
f"https://labs.openai.com/api/labs/generations/generation-{generation}/share",
headers={"Authorization": auth_header},
)
print(ret.json())
print(f"Your share link: https://labs.openai.com/s/{generation}")
And, yes, link returns 404 before it, so /share is required
The DALL·E UI allows you to designate an image as public and then creates a shareable link. It would be nice to be able to do this programatically.