Skip to content

An app that generates ai images based on user text. Built to consume OpenAI DALL.E 2 API

License

Notifications You must be signed in to change notification settings

MabeyC/ai-image-generator

Repository files navigation

OpenAI Image Generator App

An app to generate images using OpenAI's DALL.E 2 API

Openai API documentation

Under Active Development

TODO

- Set up in-memory database (redis) - Switch authentication from JWT to session

  • Add userId to the openai api calls
  • Save images to redis cache instead of local disk storage
  • Finish CRUD endpoints on /file/image
  • Update tests

Installation


To install all dependencies, use the npm install command:

npm install

Testing

To run the test suite, use the npm run test command:

npm run test

Enpoints


  • /openai

    • POST /generateimage

    • PARAMS formdata: { prompt: String, size: ['small', 'medium', 'large']}

    • DESCRIPTION Generates an image based on user text prompt

    • POST /variantimage

    • PARAMS formdata: { name: String, size: ['small', 'medium', 'large'], numVariants: 1-3 }

    • DESCRIPTION Generates up to 3 variants of a saved image

  • /file

    • POST /uploadimage

    • PARAMS formdata: { file }

    • DESCRIPTION Allows for a png image file to be uploaded

    • GET /file/:filename

    • PARAMS params: { filename: String }

    • DESCRIPTION Gets an image from the database

  • /user

    • POST /
    • PARAMS json: { name: String, email: String, password: String }
    • DESCRIPTION Register an new user
  • /auth

    • GET /

    • PARAMS valid session cookie

    • DESCRIPTION Gets an authenticated user's id

    • POST /

    • PARAMS json: { name: String, email: String, password: String }

    • DESCRIPTION Authenticates a user and returns a valid session cookie