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

packages = \
['dalle3']

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

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

setup_kwargs = {
    'name': 'dalle3',
    'version': '0.0.6',
    '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```\npip install dalle3\n```\n\n\n## Usage 🐡\n--------\n\nHere\'s a simple example of how to use DALLE3 API:\n\n```python\n# Import the necessary module\nimport os\nimport logging\nfrom dalle3 import Dalle\n\n# Define cookie using env or empty string\ncookie = os.getenv("BING_COOKIE") or ""\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, anime scenery"\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## Idea to Image prototype\n- A prototype where we use GPT4 to refine a prompt -> then create an image.\n\n`python idea_to_image.py`\n\n### Arguments\n\n-   `--image_to_generate`: This is a required argument. It is the text prompt for the image you want to generate.\n\n-   `--openai_api_key`: This is a required argument. It is your OpenAI API key.\n\n-   `--cookie`: This is a required argument. It is your cookie value for DALLE-3.\n\n-   `--output_folder`: This is an optional argument. It is the folder where you want to save the generated images. If not provided, it defaults to\xa0`"images/"`.\n\n### Examples\n--------\n\nHere are some examples of how to use the script from the command line:\n\n#### Example 1\n\nGenerate an image with the prompt "Fish hivemind swarm in light blue avatar anime in zen garden pond concept art anime art, happy fish, anime scenery", using your OpenAI API key and cookie value, and save the images in the default folder (`"images/"`):\n\n```bash\npython idea_to_image.py --image_to_generate "Fish hivemind swarm in light blue avatar anime in zen garden pond concept art anime art, happy fish, anime scenery" --openai_api_key "your_openai_api_key" --cookie "your_cookie_value"\n```\n\n#### Example 2\n\nGenerate an image with the prompt "A futuristic city skyline at sunset", using your OpenAI API key and cookie value, and save the images in a folder named\xa0`"futuristic_city_images/"`:\n\n```bash\npython idea_to_image.py --image_to_generate "A futuristic city skyline at sunset" --openai_api_key "your_openai_api_key" --cookie "your_cookie_value" --output_folder "futuristic_city_images/"\n```\n\nRemember to replace\xa0`"your_openai_api_key"`\xa0and\xa0`"your_cookie_value"`\xa0with your actual OpenAI API key and cookie value.\n\n------\n\n## 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## 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',
    '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)
