Agora-X / Dalle3

An API for DALLE-3
https://discord.gg/qUtxnK2NMf
MIT License
182 stars 14 forks source link
api api-client artificial-intelligence dalle dalle-api dalle-images dalle3 genai generative-ai gpt4 selenium selenium-webdriver transformer

Multi-Modality

DALLE3 API

A radically simple Dalle3 API.

Disclaimer: This code is provided "as-is" and is not affiliated with or endorsed by the source website. Use responsibly and at your own risk.

Installation 🐠


You can install DALLE3 API using pip:

pip3 install --upgrade dalle3

Usage 🐡


Here's a simple example of how to use DALLE3 API:

import logging
from dalle3 import Dalle

# Define cookie using env or empty string
cookie = ""

# Set up logging
logging.basicConfig(level=logging.INFO)

# Instantiate the Dalle class with your cookie value
dalle = Dalle(cookie)

# Open the website with your query
dalle.create(
    "Fish hivemind swarm in light blue avatar anime in zen garden pond concept art anime art, happy fish"
)

# Get the image URLs
urls = dalle.get_urls()

# Download the images to your specified folder
dalle.download(urls, "images/")

Dalle Documentation

Table of Contents

  1. Introduction
  2. Dalle Class
  3. Methods and Usage
  4. Examples
  5. Additional Information
  6. References and Resources

1. Introduction

Welcome to the documentation on the Dalle class. This comprehensive guide provides in-depth information about the Dalle library and its core components. Before we dive into the details, it's crucial to understand the purpose and significance of this library.

1.1 Purpose

This library houses the DALL-E 3 Unofficial API, providing tools to download images based on queries. The Dalle class facilitates this process, allowing users to interact with the API efficiently.

1.2 Key Features


2. Dalle Class

The Dalle class is a fundamental module in the Dalle3 library, enabling interactions with the DALL-E 3 Unofficial API.

2.1 Initialization Parameters

Here are the initialization parameters for the Dalle class:

2.2 Methods

The Dalle class provides the following methods:


3. Methods and Usage

Let's explore the methods provided by the Dalle class and how to use them effectively.

3.1 get_time Method

The get_time method returns the current time in the format "[%d/%m/%Y %H:%M:%S]". It's a utility function to help with logging and timestamping.

3.2 get_time_save Method

The get_time_save method returns the current time in the format "%d-%m-%Y %H-%M-%S". It's useful for creating timestamped folders for image downloads.

3.3 download Method

The download method takes a list of image URLs and a save folder path. It downloads images from the provided URLs and saves them in the specified folder. This method is crucial for downloading images based on your queries.

3.4 create Method

The create method opens the Bing Image Creator (DALL-E 3) website and adds a cookie to bypass automation detection. It prepares the environment for querying and downloading images.

3.5 get_urls Method

The get_urls method extracts and returns image URLs from the website. It allows you to retrieve the image URLs that match your query.

3.6 run Method

The run method combines the previous methods to execute the whole process of downloading images based on the provided query. It's a convenient way to automate the image download process.


4. Examples

Let's dive into practical examples to demonstrate the usage of the Dalle class.

4.1 Example 1: Creating a Dalle Instance

In this example, we create an instance of the Dalle class with your provided cookie value:

# Instantiate the Dalle class with your cookie value
dalle = Dalle("your_cookie_value_here")

4.2 Example 2: Running the Whole Process

Here, we demonstrate how to use the Dalle class to run the whole process of downloading images based on a query:

# Run the whole process of downloading images from the provided query
dalle.run("Fish hivemind swarm in light blue avatar anime in zen garden pond concept art anime art, happy fish, anime scenery")

5. Additional Information

Here are some additional tips and information for using the Dalle3 library and the Dalle class effectively:


6. References and Resources

For further information and resources related to the Dalle3 library and DALL-E:

This concludes the documentation for the Dalle3 library and the Dalle class. You now have a comprehensive guide on how to interact with the DALL-E 3 Unofficial API and download images based on your queries using Dalle3.

7. Obtaining Your Cookie 🍪


To use DALLE3 API, you need to obtain your cookie from Bing Image Creator. Here's how you can do it:

  1. Go to Bing Image Creator in your browser and log in to your account.
  2. Press Ctrl+Shift+J (or Cmd+Option+J on Mac) to open developer tools.
  3. Navigate to the Application section.
  4. Click on the Cookies section.
  5. Find the variable _U and copy its value.
  6. Paste in the cookie parameter.

Now you can use this cookie value to instantiate the Dalle class.

8. Edge Cases 🦀



Features 🌊


License 📜


DALLE3 API is licensed under the MIT License. See the LICENSE file for more details.

Todo