InvokeAI/frontend/README.md
psychedelicious d1a2c4cd8c
React web UI with flask-socketio API (#429)
* Implements rudimentary api
* Fixes blocking in API
* Adds UI to monorepo > src/frontend/
* Updates frontend/README
* Reverts conda env name to `ldm`
* Fixes environment yamls
* CORS config for testing
* Fixes LogViewer position
* API WID
* Adds actions to image viewer
* Increases vite chunkSizeWarningLimit to 1500
* Implements init image
* Implements state persistence in localStorage
* Improve progress data handling
* Final build
* Fixes mimetypes error on windows
* Adds error logging
* Fixes bugged img2img strength component
* Adds sourcemaps to dev build
* Fixes missing key
* Changes connection status indicator to text
* Adds ability to serve other hosts than localhost
* Adding Flask API server
* Removes source maps from config
* Fixes prop transfer
* Add missing packages and add CORS support
* Adding API doc
* Remove defaults from openapi doc
* Adds basic error handling for server config query
* Mostly working socket.io implementation.
* Fixes bug preventing mask upload
* Fixes bug with sampler name not written to metadata
* UI Overhaul, numerous fixes

Co-authored-by: Kyle Schouviller <kyle0654@hotmail.com>
Co-authored-by: Lincoln Stein <lincoln.stein@gmail.com>
2022-09-16 13:18:15 -04:00

2.1 KiB

Stable Diffusion Web UI

Demo at https://peaceful-otter-7a427f.netlify.app/ (not connected to back end)

much of this readme is just notes for myself during dev work

numpy rand: 0 to 4294967295

Test and Build

from frontend/:

  • yarn dev runs tsc-watch, which runs vite build on successful tsc transpilation

from .:

API

backend/server.py serves the UI and provides a socket.io API via flask-socketio.

Server Listeners

The server listens for these socket.io events:

cancel

  • Cancels in-progress image generation
  • Returns ack only

generateImage

  • Accepts object of image parameters
  • Generates an image
  • Returns ack only (image generation function sends progress and result via separate events)

deleteImage

  • Accepts file path to image
  • Deletes image
  • Returns ack only

deleteAllImages WIP

  • Deletes all images in outputs/
  • Returns ack only

requestAllImages

  • Returns array of all images in outputs/

requestCapabilities WIP

  • Returns capabilities of server (torch device, GFPGAN and ESRGAN availability, ???)

sendImage WIP

  • Accepts a File and attributes
  • Saves image
  • Used to save init images which are not generated images

Server Emitters

progress

  • Emitted during each step in generation
  • Sends a number from 0 to 1 representing percentage of steps completed

result WIP

  • Emitted when an image generation has completed
  • Sends a object:
{
    url: relative_file_path,
    metadata: image_metadata_object
}

TODO

  • Search repo for "TODO"
  • My one gripe with Chakra: no way to disable all animations right now and drop the dependence on framer-motion. I would prefer to save the ~30kb on bundle and have zero animations. This is on the Chakra roadmap. See https://github.com/chakra-ui/chakra-ui/pull/6368 for last discussion on this. Need to check in on this issue periodically.