Code Monkey home page Code Monkey logo

spensercai / sd-webui-go Goto Github PK

View Code? Open in Web Editor NEW
362.0 4.0 3.0 3.84 MB

This is a Go language version of the SDK based on stable-diffusion-webui. In your code, you can directly use the API interfaces of stable-diffusion-webui through object-oriented operations, instead of dealing with cumbersome JSON. Support extensions API !

License: GNU General Public License v3.0

Go 100.00%
ai aigc api golang sd-webui sdk stable-diffusion stable-diffusion-webui webui

sd-webui-go's People

Contributors

automatic1111 avatar drgrib avatar spensercai avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

sd-webui-go's Issues

Instructions for anyone trying to do a simple txt2img request

I'm confused why you use DeoldifyImage as the first and only example for this repo.

I spent a couple hours trying to get this working for a simple and (imo) much more common txt2img request due to the choice of DeoldifyImage as the base example as well as relying on the intersvc package instead of basic idiomatic Go. For anyone looking for a simple txt2img example, here's one. For the repo owner, I recommend putting this in the README.

package main

import (
	"encoding/base64"
	"fmt"

	SdClient "github.com/SpenserCai/sd-webui-go"
	SdApiOperation "github.com/SpenserCai/sd-webui-go/stablediffusion/client/operations"
	SdApiModel "github.com/SpenserCai/sd-webui-go/stablediffusion/models"
)

func MustBeNil(err error) {
	if err != nil {
		panic(err)
	}
}

var URL = "127.0.0.1:7860"

func main() {
	sdClient := SdClient.NewStableDiffInterface(URL)

	rd := SdApiOperation.NewText2imgapiSdapiV1Txt2imgPostParams()
	rd.Body = &SdApiModel.StableDiffusionProcessingTxt2Img{
		Prompt:         "dog",
		NegativePrompt: "ugly",
		ScriptArgs:     []interface{}{},
	}

	resp, err := sdClient.Client.Operations.Text2imgapiSdapiV1Txt2imgPost(rd)
	MustBeNil(err)

	for i, s := range resp.Payload.Images {
		b, err := base64.StdEncoding.DecodeString(s)
		MustBeNil(err)
		err = os.WriteFile(fmt.Sprintf("%d.png", i), b, 0644)
		MustBeNil(err)
	}
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.