Skip to content

Simatwa/ai-imager

Repository files navigation

AI-Imager

Logo

Github License visitors Progress Code-style Coverage wakatime

Demo

Features

  • Generate image from prompt
    • BingImageCreator
    • DALL-E (2)
  • Edit image with a mask
  • Generate variant of an image
  • User-friendly web interface

Prerequisites

  1. OPENAI-API-KEY
  2. Bing cookies - (optional)
  3. Python >=3.7

Installation and usage

Installation

If you have enough permissions you can clone from official repo:

git clone https://github.com/Simatwa/ai-imager.git
cd ai-imager
bash install.sh

If you're viewing this locally, you can install by executing the install.sh script.

bash install.sh

Usage

Once installed, the site can be fired up as follows:

ai-imager -k $OPENAI_API_KEY

Fire up efficiently - recommended

  • Make KEY an environment variable
export OPENAI_API_KEY=<Your-OPENAI-API-KEY>
  • Fire up the server - $ ai-imager

  • If yout want to use Bing's model, you have to parse the path to the cookie file during start up introduced by -cf <path-to-cookie-file.json.

  • Review how to get the cookie file.

By default, the server has the following configurations.

Argument Default
Port 8000
Logging-level 20
Host False
Debug False

Run $ ai-imager help for more info.


usage: ai-imager [-h] [-v] [-k KEY] [-kp PATH] [-l 10-50] [-o PATH]
                 [-cf COOKIE_FILE] [--host] [--thread] [--debug]
                 [port ...]

Manipulate images with OpenAI's model

positional arguments:
  port                  Port to start the server

options:
  -h, --help            show this help message and exit
  -v, --version         show program's version number and exit
  -k KEY, --key KEY     OpenAI's API key
  -kp PATH, --key-path PATH
                        Path to OpenAI-API-KEY path
  -l 10-50, --logging-level 10-50
                        Log level of the app
  -o PATH, --output PATH
                        Filepath to log to
  -cf COOKIE_FILE, --cookie-file COOKIE_FILE
                        Path to Bing's cookie file
  --host                Host the site on LAN
  --thread              Run server in multiple threads
  --debug               Start as debugging server

This script has no official relation with OpenAI.

Note To developers, execute the test.py script to run server as you modify the contents.

ToDo

  • Generate with BingImageCreator
  • Download button
  • Chat feature
  • Aunthenticate users

Acknowledgements

Disclaimer

This is not an official OpenAI product. This is a personal project and is not affiliated with OpenAI in any way. Don't sue me.