Skip to content

Instantly share code, notes, and snippets.

@radames
Last active February 1, 2023 01:57
Show Gist options
  • Save radames/1161a14d96a6488ba7c6a275240c1923 to your computer and use it in GitHub Desktop.
Save radames/1161a14d96a6488ba7c6a275240c1923 to your computer and use it in GitHub Desktop.
Minimal Stable Diffusion UI as a browser bookmark

Bookmark this javascript code to make the minimal Stable Diffusion UI thanks to @huggingface inference API pic.twitter.com/i1slI4ObdH

— Radamés Ajna (@radamar) February 1, 2023
<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>

Bookmark this code

javascript:p=prompt("Enter your prompt:");fetch("https://api-inference.huggingface.co/models/runwayml/stable-diffusion-v1-5",{method:"POST",headers:{"content-type":"application/json","X-Wait-For-Model":"true"},body:JSON.stringify({inputs:p})}).then(e=>e.blob()).then(e=>window.open(URL.createObjectURL(e),"_self"))

const p = prompt("Enter your prompt:");
fetch(
"https://api-inference.huggingface.co/models/runwayml/stable-diffusion-v1-5",
{
method: "POST",
headers: { "content-type": "application/json", "X-Wait-For-Model": "true" },
body: JSON.stringify({ inputs: p }),
}
)
.then((e) => e.blob())
.then((e) => window.open(URL.createObjectURL(e), "_self"));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment