Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support to make image public and generate shareable link #10

Open
charlesjlee opened this issue Jul 22, 2022 · 1 comment
Open

Add support to make image public and generate shareable link #10

charlesjlee opened this issue Jul 22, 2022 · 1 comment
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@charlesjlee
Copy link
Contributor

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.

@ezzcodeezzlife ezzcodeezzlife added enhancement New feature or request help wanted Extra attention is needed labels Jul 22, 2022
@kv-crosstech
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants