Note: This repository has been archived as it relies on a reverse engineered API located in the BingImageCreator repository which has been archived by its owner.
This repository contains Python code, and associated unit tests, for high quality image generation byMicrosoft Bing Image Creator using the reverse engineered BingImageCreator API. The code takes the input from the user and generates a response using Bing image creator. You just need to provide a description and Bing will generate the image.
Install BingImageCreator module
pip3 install --upgrade BingImageCreator
Your Bing key is passed to program via an environment variable
export BING_KEY="Your Bing key"
python main.py
To generate a key browse to the Getting Authentication details section of the BingImageCreator README.md and follow the instructions given.
usage: main.py [-h] [--output_dir OUTPUT_DIR]
[--download_count DOWNLOAD_COUNT]
Script for generating and saving images using Bing Image Creator.
options:
-h, --help show this help message and exit
--output_dir OUTPUT_DIR
Path to the output directory
--download_count DOWNLOAD_COUNT
Number of images to download
pytest
The username and password for Docker Hub are stored as secrets this GitHub repository.
Note: To set up the secrets in your GitHub repository, go to the repository page, navigate to the "Settings" tab, and then select "Secrets" from the left menu. Add a secret named DOCKERHUB_USERNAME with the Docker Hub username to be used, and another secret named DOCKERHUB_PASSWORD with the Docker Hub password to be used.
Build the Docker image.
docker build -t creating-with-bingimagecreator .
Run the Docker image as a container.
export BING_KEY="Your Bing key"
docker run -it -e BING_KEY=$BING_KEY creating-with-bingimagecreator
docker pull <dockerhub-username>/creating-with-bingimagecreator:<tag>
Replace with your Docker Hub username and with the specific tag of the Docker image you want to pull.
export BING_KEY="Your Bing key"
docker run -it -e BING_KEY=$BING_KEY <dockerhub-username>/creating-with-bingimagecreator:<tag>
For more information on the API available see the BingImageCreator Repository.