Skip to content

A DALL·E 2 image generation downloader. Permits easy upload to cloud services like Google Drive.

License

Notifications You must be signed in to change notification settings

afparsons/albaretto

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

albaretto

A DALL·E 2 image generation downloader. Permits easy upload to cloud services like Google Drive.

Status: an afternoon project. Don't expect robust capabilities!


⚠️ Programmatically accessing DALL·E 2 may be against OpenAI's terms of service. Proceed at your own risk.

  1. Usage Requirements

(e) You may not use web scraping, web harvesting, or web data extraction methods to extract data from the Services, the Content, or OpenAI’s or its affiliates’ software, models or systems.

https://openai.com/api/policies/terms/


Usage

$ albaretto <openai-bearer-token> google-drive <credentials.json>
# perform OAuth 2.0 authentication with a web browser

[albaretto] [google-drive] > fetch <task-id>
  ✓ Fetched <image-generation-id-1> (356.89 KiB)
  ✓ Fetched <image-generation-id-2> (340.39 KiB)
  ✓ Fetched <image-generation-id-3> (279.75 KiB)
  ✓ Fetched <image-generation-id-4> (401.94 KiB)

[albaretto] [google-drive] > save <folder-id>
  ✓ Saved <image-generation-id-1>.webp to <folder-id>
  ✓ Saved <image-generation-id-2>.webp to <folder-id>
  ✓ Saved <image-generation-id-3>.webp to <folder-id>
  ✓ Saved <image-generation-id-4>.webp to <folder-id>

# only fetch generated images 2 and 3 (one-indexed from left to right as displayed in the UI)
[albaretto] [google-drive] > fetch <task-id> -g 2 -g 3
  ✓ Fetched <image-generation-id-2> (340.39 KiB)
  ✓ Fetched <image-generation-id-3> (279.75 KiB)

The above workflow is the same for saving to the local filesystem, i.e.

$ albaretto <openai-bearer-token> local-filesystem

[albaretto] [local-filesystem] > fetch <task-id>
...

[albaretto] [local-filesystem] > save /path/to/output/directory
...

Installation

$ git clone https:/afparsons/albaretto.git
$ cd albaretto
$ python -m pip install .

Authentication

OpenAI's DALL·E 2

Prerequisite: must have access to OpenAI's DALL·E 2

  1. Navigate to (and possibly log into) https://labs.openai.com/.
  2. Open Developer Tools in your web browser and navigate to the Network tab.
  3. On https://labs.openai.com/, type a prompt and click "Generate".
  4. Look for request to https://labs.openai.com/api/labs/tasks.
  5. Look for authorization in the request header. The bearer token will begin with sess-.
  6. Copy the bearer token.

Google Drive

Required scopes (documentation):

Unaffiliated informational resources:


Limitations

As far as I know, there is no way to pipe | or push > data through Typer or Click commands.

Ideally, the command line interface would work like this:

$ albaretto <openai-bearer-token> google-drive <credentials.json>

# where `save` takes arguments folder-id and a list of files
[albaretto] [google-drive] > fetch <task-id> | save <folder-id>

But I don't know of a way to achieve the above. Instead, the fetch command saves output into the typer.Context, whence the data is retreived by save.

This program does not provide full nor robust UNIX-like utilities for interacting with OpenAI's DALL·E 2 or Google Drive.


Similar projects


Why . . . ?

Why does this program exist? I found it tedious to save and then re-upload the images generated by OpenAI's DALL·E 2 using the user interface.

Why is it named albaretto? Doctors Giuseppe and Mara Albaretto were patrons and collectors of Salvador Dalí's work.

About

A DALL·E 2 image generation downloader. Permits easy upload to cloud services like Google Drive.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages