microdalle icon indicating copy to clipboard operation
microdalle copied to clipboard

support stable diffusion

Open mwmeyer opened this issue 2 years ago • 2 comments

maybe via https://platform.stability.ai

mwmeyer avatar Nov 21 '23 02:11 mwmeyer

Hi, that sound interesting. I am open to add another backend. However the thing that I really like about the current UI is that it is simple. And that's because the OpenAPI is really simple: https://platform.openai.com/docs/api-reference/images/create?lang=python

The only parameters that you should set to generate and image are:

  • prompt
  • size
  • quality
  • style

It's easy to expose to the user, and easy to understand (I did not expose style on purpose because I wanted to keep the UI simple)

However the stability AI API is a lot more complex: https://platform.stability.ai/docs/api-reference#tag/v1generation/operation/textToImage

  • prompts (with weights!)
  • heigh / width (with different values allowed depending on the other parameters)
  • cfg_scale
  • clip_guidance_preset
  • sampler
  • samples
  • seed
  • steps
  • style_preset

That's a LOT of settings, and they are really not easy to understand.

I really like having a simple checkbox "HD", but we could instead expose "presets" in a dropdown. And have a configuration file that would select the arguments to the API based on the preset, something like:

engine: stability
engines:
  openai:
    sizes:
      - 1024x1024
      - 1024x1792
      - 1792x1024
    presets:
      HD:
        quality: hd
      standard:
        quality: standard
  stability:
    sizes:
      - 1024x1024
      - 512x512
  presets:
    digital-art:
      style_preset: digital-art
      steps: 30
      sampler: DDIM
    standard:
      style_preset: cinematic
      steps: 10

Then every user would be able to tweak their generator as they please.

I have never used stability AI in the past, do you have some presets that I could use? Is there a way to have a higher quality image?

Blizarre avatar Nov 21 '23 09:11 Blizarre

The API endpoint on the stability AI SDK: https://github.com/Stability-AI/stability-sdk/blob/ff797c0741ce2ad6070ea2f81c38e3305cd3342c/src/stability_sdk/client.py#L153

Blizarre avatar Nov 21 '23 10:11 Blizarre