# -*- coding: utf-8 -*-
from setuptools import setup

packages = \
['dalle3']

package_data = \
{'': ['*']}

install_requires = \
['pandas', 'requests', 'selenium', 'swarms', 'undetected-chromedriver']

setup_kwargs = {
    'name': 'dalle3',
    'version': '0.0.8',
    'description': 'dalle3 - Pytorch',
    'long_description': '[![Multi-Modality](agorabanner.png)](https://discord.gg/qUtxnK2NMf)\n\n# DALLE3 API\n\nDive into the world of AI-generated images with DALLE3 API! This radically simple Python package allows you to interact with the DALL-E 3 Unofficial API, enabling you to generate and download images based on your creative prompts! \n\nAnd, we\'ve also implemented a simple verison of [Idea2Image](https://huggingface.co/papers/2310.08541) that uses an LLM for prompt enrichement! By passing in the desired prompt into a meta prompting agent we\'re able to guide DALLE3 much better and reliably!\n\n## Features 🌊\n-----------\n\n-   Easy to Use: With just a few lines of code, you can start generating images.\n-   Customizable: You can provide your own creative prompts to generate unique images.\n-   Automated Download: The API automatically downloads the generated images to your specified folder.\n-   Real-Time Updates: The API provides real-time logging information about the image generation and download process.\n\n## Installation 🐠\n---------------\n\nYou can install DALLE3 API using pip:\n\n```\npip3 install --upgrade dalle3\n```\n\n\n## Usage 🐡\n--------\n\nHere\'s a simple example of how to use DALLE3 API:\n\n```python\nimport logging\nfrom dalle3 import Dalle\n\n# Define cookie using env or empty string\ncookie = ""\n\n# Set up logging\nlogging.basicConfig(level=logging.INFO)\n\n# Instantiate the Dalle class with your cookie value\ndalle = Dalle(cookie)\n\n# Open the website with your query\ndalle.create(\n    "Fish hivemind swarm in light blue avatar anime in zen garden pond concept art anime art, happy fish"\n)\n\n# Get the image URLs\nurls = dalle.get_urls()\n\n# Download the images to your specified folder\ndalle.download(urls, "images/")\n\n```\n-----\n\n## Idea to Image prototype\n- A prototype where we use GPT4 to refine a prompt -> then create an image.\n\n```python\nfrom dalle3 import Idea2Image\n\nidea2image = Idea2Image(\n    image="Hashashin Assassin\'s creed ancient persia art",\n    #enter in cookie\n    cookie="",\n    #enter in api key\n    openai_api_key=""\n)\n\nidea2image.run()\n\n\n```\n------\n\n\n# `Dalle` Documentation\n\n## Table of Contents\n\n1. [Introduction](#introduction)\n2. [Dalle Class](#dalle-class)\n   - [Initialization Parameters](#initialization-parameters)\n3. [Methods and Usage](#methods-and-usage)\n   - [get_time Method](#get-time-method)\n   - [get_time_save Method](#get-time-save-method)\n   - [download Method](#download-method)\n   - [create Method](#create-method)\n   - [get_urls Method](#get-urls-method)\n   - [run Method](#run-method)\n4. [Examples](#examples)\n   - [Example 1: Creating a Dalle Instance](#example-1-creating-a-dalle-instance)\n   - [Example 2: Running the Whole Process](#example-2-running-the-whole-process)\n5. [Additional Information](#additional-information)\n6. [References and Resources](#references-and-resources)\n\n---\n\n## 1. Introduction <a name="introduction"></a>\n\nWelcome 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.\n\n### 1.1 Purpose\n\nThis 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.\n\n### 1.2 Key Features\n\n- **DALL-E 3 API Interaction:** The `Dalle` class provides an interface to interact with the DALL-E 3 Unofficial API.\n\n- **Image Download:** Dalle3 allows you to download images from the web based on your queries.\n\n---\n\n## 2. Dalle Class <a name="dalle-class"></a>\n\nThe `Dalle` class is a fundamental module in the Dalle3 library, enabling interactions with the DALL-E 3 Unofficial API.\n\n### 2.1 Initialization Parameters <a name="initialization-parameters"></a>\n\nHere are the initialization parameters for the `Dalle` class:\n\n- `cookie_value` (str): A string representing the cookie value to bypass automation detection.\n\n### 2.2 Methods <a name="methods-and-usage"></a>\n\nThe `Dalle` class provides the following methods:\n\n- `get_time()`: Returns the current time in the format "[%d/%m/%Y %H:%M:%S]".\n\n- `get_time_save()`: Returns the current time in the format "%d-%m-%Y %H-%M-%S".\n\n- `download(urls: list, save_folder: str)`: Downloads images from the provided URLs and saves them in the specified folder.\n\n- `create(query: str)`: Opens the Bing Image Creator (DALL-E 3) and adds a cookie to interact with the API.\n\n- `get_urls()`: Extracts and returns image URLs from the website.\n\n- `run(query: str)`: Runs the whole process of downloading images from the provided query.\n\n---\n\n## 3. Methods and Usage <a name="methods-and-usage"></a>\n\nLet\'s explore the methods provided by the `Dalle` class and how to use them effectively.\n\n### 3.1 `get_time` Method <a name="get-time-method"></a>\n\nThe `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.\n\n### 3.2 `get_time_save` Method <a name="get-time-save-method"></a>\n\nThe `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.\n\n### 3.3 `download` Method <a name="download-method"></a>\n\nThe `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.\n\n### 3.4 `create` Method <a name="create-method"></a>\n\nThe `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.\n\n### 3.5 `get_urls` Method <a name="get-urls-method"></a>\n\nThe `get_urls` method extracts and returns image URLs from the website. It allows you to retrieve the image URLs that match your query.\n\n### 3.6 `run` Method <a name="run-method"></a>\n\nThe `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.\n\n---\n\n## 4. Examples <a name="examples"></a>\n\nLet\'s dive into practical examples to demonstrate the usage of the `Dalle` class.\n\n### 4.1 Example 1: Creating a Dalle Instance <a name="example-1-creating-a-dalle-instance"></a>\n\nIn this example, we create an instance of the `Dalle` class with your provided cookie value:\n\n```python\n# Instantiate the Dalle class with your cookie value\ndalle = Dalle("your_cookie_value_here")\n```\n\n### 4.2 Example 2: Running the Whole Process <a name="example-2-running-the-whole-process"></a>\n\nHere, we demonstrate how to use the `Dalle` class to run the whole process of downloading images based on a query:\n\n```python\n# Run the whole process of downloading images from the provided query\ndalle.run("Fish hivemind swarm in light blue avatar anime in zen garden pond concept art anime art, happy fish, anime scenery")\n```\n\n---\n\n## 5. Additional Information <a name="additional-information"></a>\n\nHere are some additional tips and information for using the Dalle3 library and the `Dalle` class effectively:\n\n- The `download` method allows you to specify the folder where downloaded images will be saved. Ensure that you have the necessary permissions to write to that folder.\n\n- If you encounter issues with image downloads, check the prompt you provided. The quality and specificity of your query can affect the results.\n\n---\n\n## 6. References and Resources <a name="\n\nreferences-and-resources"></a>\n\nFor further information and resources related to the Dalle3 library and DALL-E:\n\n- [DALL-E 3 Unofficial API Documentation](https://www.bing.com/images/create): The official documentation for the DALL-E 3 Unofficial API, where you can explore additional features and capabilities.\n\nThis 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.\n\n## 7. Obtaining Your Cookie 🍪\n------------------------\n\nTo use DALLE3 API, you need to obtain your cookie from Bing Image Creator. Here\'s how you can do it:\n\n1.  Go to\xa0[Bing Image Creator](https://www.bing.com/images/create)\xa0in your browser and log in to your account.\n2.  Press\xa0`Ctrl+Shift+J`\xa0(or\xa0`Cmd+Option+J`\xa0on Mac) to open developer tools.\n3.  Navigate to the\xa0`Application`\xa0section.\n4.  Click on the\xa0`Cookies`\xa0section.\n5.  Find the variable\xa0`_U`\xa0and copy its value.\n6.  Paste in the cookie parameter.\n\nNow you can use this cookie value to instantiate the\xa0`Dalle`\xa0class.\n\n## 8. Edge Cases 🦀\n-------------\n\n-   If the\xa0`save_folder`\xa0path you provide when calling\xa0`download`\xa0does not exist, the function will attempt to create it. Make sure you have the necessary permissions to create directories in the specified location.\n-   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.\n- If you see: `selenium.common.exceptions.WebDriverException: Message: unknown error: cannot connect to chrome at 127.0.0.1:58296\nfrom session not created: This version of ChromeDriver only supports Chrome version 118 Current browser version is 117.0.5938.15` \nthen you need to update [your chrome by going here:](chrome://settings/help)\nt add \nchrome://settings/help\n\n\n## License 📜\n----------\n\nDALLE3 API is licensed under the MIT License. See the\xa0[LICENSE](https://domain.apac.ai/LICENSE)\xa0file for more details.\n\n# Todo\n- [ ] Add Automatic cookie finding seamlessly\n- [ ] Automatically upgrade chrome to 118\n- [ ] Add automatic browser detection, cross browser\n- [ ] Lower amount of endpoints to run by 90% => `dalle = Dalle() dalle.run("image")`\n- [ ] Add gpt4 vision api using same approach, scrape and enter but need to find the right cookie\n- [ ] Establish Idea2Image Documentation\n- [ ] Create tests for Idea2Image\n- [ ] Add human feedback for idea2image, prompt -> llm -> dalle -> human feedback -> back to llm -> dalle\n- [ ] Different output types, svg, jpg\n- [ ] Add bingchat api\n- [ ] Add chatgpt dalle api\n- [ ] Create Chatgpt V api\n',
    'author': 'Kye Gomez',
    'author_email': 'kye@apac.ai',
    'maintainer': 'None',
    'maintainer_email': 'None',
    'url': 'https://github.com/Agora-X/DALLE3-API',
    'packages': packages,
    'package_data': package_data,
    'install_requires': install_requires,
    'python_requires': '>=3.6,<4.0',
}


setup(**setup_kwargs)
