ezzcodeezzlife / dalle2-in-python

Use DALL·E 2 in Python
https://pypi.org/project/dalle2/
MIT License
177 stars 34 forks source link

Add support to add image to favorites #11

Open charlesjlee opened 2 years ago

charlesjlee commented 2 years ago

The DALL·E UI allows you to mark an image as a "favorite", which just saves a reference to a collection. It would be nice to do this programatically.

kv-crosstech commented 2 years ago

Like in #10 generation id needs to be cached

the endpoint is https://labs.openai.com/api/labs/collections/private/generations

import requests

auth_header = "Bearer sess-......"

payload = {"generation_ids": ["generation-ExyZNQNG5xzIkYqmPfOejUzP"]}

ret = requests.post(
    f"https://labs.openai.com/api/labs/collections/private/generations",
    headers={"Authorization": auth_header},
    json=payload,
)
print(ret.json())

generation_ids seems to be accepting a list of IDS, but i didn't test what happens if you actually put here multiple generations

kv-crosstech commented 2 years ago

Off topic: I'm actually quite shocked, that no one has done what I just did. This library can be (and probably will be) very helpful for developers before OpenAI releases actual API with documentation.

kv-crosstech commented 2 years ago

@ezzcodeezzlife do you need PR for any of these?

ezzcodeezzlife commented 2 years ago

@kv-crosstech if you want to add these features feel to do so 🔥 ill merge asap