Skip to content
This repository was archived by the owner on Oct 16, 2023. It is now read-only.

genai-musings/creating-with-BingImageCreator

Repository files navigation

Creating with Bing Image Creator - README.md

License: MPL 2.0 Bandit Super-Linter [CodeQL Markdown Links Check Spell-Checker Unit-Tests Code-Coverage Docker-Build-Push Docker-Push-README

Archived

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.

Repository for creating with Bing Image creator

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.

Pre-requisites

Install BingImageCreator module

pip3 install --upgrade BingImageCreator

To run program

Your Bing key is passed to program via an environment variable

export BING_KEY="Your Bing key"
python main.py

To Generate a Key

To generate a key browse to the Getting Authentication details section of the BingImageCreator README.md and follow the instructions given.

Program Options

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

To run unit tests

pytest

To build and run an instance of a Docker image locally.

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

Build the Docker image.

docker build -t creating-with-bingimagecreator .

Run

Run the Docker image as a container.

export BING_KEY="Your Bing key"
docker run -it -e BING_KEY=$BING_KEY creating-with-bingimagecreator

To pull and run an instance of the Docker image from Docker Hub

Pull

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.

Run

export BING_KEY="Your Bing key"
docker run -it -e BING_KEY=$BING_KEY <dockerhub-username>/creating-with-bingimagecreator:<tag>

BingImageCreator API Reference

For more information on the API available see the BingImageCreator Repository.

About

Repository for creating with Bing Image Creator

Resources

License

Contributing

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •