Package: dalle3
DALLE3 APIA 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 dalle3Usage 🐡Here's a simple example of how to use DALLE3 API:importloggingfromdalle3importDalle# Define cookie using env or empty stringcookie=""# Set up logginglogging.basicConfig(level=logging.INFO)# Instantiate the Dalle class with your cookie valuedalle=Dalle(cookie)# Open the website with your querydalle.create("Fish hivemind swarm in light blue avatar anime in zen garden pond concept art anime art, happy fish")# Get the image URLsurls=dalle.get_urls()# Download the images to your specified folderdalle.download(urls,"images/")DalleDocumentationTable of ContentsIntroductionDalle ClassInitialization ParametersMethods and Usageget_time Methodget_time_save Methoddownload Methodcreate Methodget_urls Methodrun MethodExamplesExample 1: Creating a Dalle InstanceExample 2: Running the Whole ProcessAdditional InformationReferences and Resources1. IntroductionWelcome to the documentation on theDalleclass. 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 PurposeThis library houses the DALL-E 3 Unofficial API, providing tools to download images based on queries. TheDalleclass facilitates this process, allowing users to interact with the API efficiently.1.2 Key FeaturesDALL-E 3 API Interaction:TheDalleclass provides an interface to interact with the DALL-E 3 Unofficial API.Image Download:Dalle3 allows you to download images from the web based on your queries.2. Dalle ClassTheDalleclass is a fundamental module in the Dalle3 library, enabling interactions with the DALL-E 3 Unofficial API.2.1 Initialization ParametersHere are the initialization parameters for theDalleclass:cookie_value(str): A string representing the cookie value to bypass automation detection.2.2 MethodsTheDalleclass provides the following methods:get_time(): Returns the current time in the format "[%d/%m/%Y %H:%M:%S]".get_time_save(): Returns the current time in the format "%d-%m-%Y %H-%M-%S".download(urls: list, save_folder: str): Downloads images from the provided URLs and saves them in the specified folder.create(query: str): Opens the Bing Image Creator (DALL-E 3) and adds a cookie to interact with the API.get_urls(): Extracts and returns image URLs from the website.run(query: str): Runs the whole process of downloading images from the provided query.3. Methods and UsageLet's explore the methods provided by theDalleclass and how to use them effectively.3.1get_timeMethodTheget_timemethod 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.2get_time_saveMethodTheget_time_savemethod returns the current time in the format "%d-%m-%Y %H-%M-%S". It's useful for creating timestamped folders for image downloads.3.3downloadMethodThedownloadmethod 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.4createMethodThecreatemethod 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.5get_urlsMethodTheget_urlsmethod extracts and returns image URLs from the website. It allows you to retrieve the image URLs that match your query.3.6runMethodTherunmethod 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. ExamplesLet's dive into practical examples to demonstrate the usage of theDalleclass.4.1 Example 1: Creating a Dalle InstanceIn this example, we create an instance of theDalleclass with your provided cookie value:# Instantiate the Dalle class with your cookie valuedalle=Dalle("your_cookie_value_here")4.2 Example 2: Running the Whole ProcessHere, we demonstrate how to use theDalleclass to run the whole process of downloading images based on a query:# Run the whole process of downloading images from the provided querydalle.run("Fish hivemind swarm in light blue avatar anime in zen garden pond concept art anime art, happy fish, anime scenery")5. Additional InformationHere are some additional tips and information for using the Dalle3 library and theDalleclass effectively:Thedownloadmethod allows you to specify the folder where downloaded images will be saved. Ensure that you have the necessary permissions to write to that folder.If you encounter issues with image downloads, check the prompt you provided. The quality and specificity of your query can affect the results.6. References and Resources <a name="references-and-resources">For further information and resources related to the Dalle3 library and DALL-E:DALL-E 3 Unofficial API Documentation: The official documentation for the DALL-E 3 Unofficial API, where you can explore additional features and capabilities.This concludes the documentation for the Dalle3 library and theDalleclass. 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:Go toBing Image Creatorin your browser and log in to your account.PressCtrl+Shift+J(orCmd+Option+Jon Mac) to open developer tools.Navigate to theApplicationsection.Click on theCookiessection.Find the variable_Uand copy its value.Paste in the cookie parameter.Now you can use this cookie value to instantiate theDalleclass.8. Edge Cases 🦀If thesave_folderpath you provide when callingdownloaddoes not exist, the function will attempt to create it. Make sure you have the necessary permissions to create directories in the specified location.If the user is not signed in on the browser that Selenium WebDriver is controlling, the script will not be able to retrieve the cookie. Make sure you're signed in to your Bing Image Creator account in the same browser session.If you see:selenium.common.exceptions.WebDriverException: Message: unknown error: cannot connect to chrome at 127.0.0.1:58296 from session not created: This version of ChromeDriver only supports Chrome version 118 Current browser version is 117.0.5938.15then you need to updateyour chrome by going here:t add
chrome://settings/helpFeatures 🌊Easy to Use: With just a few lines of code, you can start generating images.Customizable: You can provide your own creative prompts to generate unique images.Automated Download: The API automatically downloads the generated images to your specified folder.Real-Time Updates: The API provides real-time logging information about the image generation and download process.License 📜DALLE3 API is licensed under the MIT License. See theLICENSEfile for more details.TodoAdd Automatic cookie finding seamlesslyAutomatically upgrade chrome to 118Add automatic browser detection, cross browserLower amount of endpoints to run by 90% =>dalle = Dalle() dalle.run("image")Add gpt4 vision api using same approach, scrape and enter but need to find the right cookieEstablish Idea2Image DocumentationCreate tests for Idea2ImageAdd human feedback for idea2image, prompt -> llm -> dalle -> human feedback -> back to llm -> dalleDifferent output types, svg, jpgAdd bingchat apiAdd chatgpt dalle apiCreate Chatgpt V api