Open SPOOKEXE opened 2 weeks ago
*"Below is the code used to hook it up (note that I edited the compiled game and not this builder, also I had to use a python proxy because the stable diffusion webui API has COR5 whitelisting)."
In the example code I provided, it will use whatever model is currently loaded in the stable diffusion webui - if you want to pass a custom model in, edit the following and add the "model" key:
body: JSON.stringify({
model: "MODEL_NAME_HERE",
prompt: prompt,
negative_prompt: "bad_quality, bad_anatomy, pixelated", // Optional: Add any negative prompts if needed
sampler_name: "DPM++ 2M", // You can adjust this based on the sampler you want to use
batch_size: 1,
n_iter: 1,
steps: 20, // Number of inference steps, adjust as needed
width: 512, // Image width
height: 512, // Image height
cfg_scale: 7.0, // Classifier-Free Guidance Scale, adjust for more/less adherence to prompt
seed: null // Optional: Use a specific seed for reproducibility
})
If you want to see what APIs are available in the local stable diffusion webui install, you can go to http://127.0.0.1:7860/docs
. You will need to add them to the proxy though if you cannot find a solution to directly connect to it.
If you want to contribute this code you should open a pull request, not an issue. But unless you commit to maintaining it it's unlikely that SD support will be implemented because it'd be a large effort with technologies that current maintainers don't know, for a significantly worse experience than the existing (though non-free) option, not to mention that it requires players to have the hardware and expertise to run a model locally.
Not really an issue as i've coded it but having the option to generate locally is helpful;
Using this stable diffusion webui repository: https://github.com/Panchovix/stable-diffusion-webui-reForge/releases
Include "--api" in the command line arguments otherwise it won't work.
Below is the code used to hook it up (note that I edited the compiled game and not this builder, also I had to use a python proxy because the command line arguments have COR5 whitelisting).
Setup:
python_proxy_sd_local.py
Edited JavaScript Dalle function