Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to use in golang project? #40

Open
carryinfo opened this issue Nov 19, 2022 · 4 comments
Open

how to use in golang project? #40

carryinfo opened this issue Nov 19, 2022 · 4 comments

Comments

@carryinfo
Copy link

how to use in golang project?

➜ server git:(master) ✗ go get github.com/Stability-AI/api-interfaces@0a4465b
go: errors parsing go.mod:
/Users/tes/Documents/pro/server/go.mod:32:2: usage: require module/path v1.2.3

@arsenetar
Copy link
Contributor

This error appears to be an issue in your go module file at /Users/tes/Documents/pro/server/go.mod:32:2 and likely not related to this repository. I cannot reproduce.

@carryinfo
Copy link
Author

carryinfo commented Dec 20, 2022

I always come across the below error:

err: %s rpc error: code = Unavailable desc = connection error: desc = "error reading server preface: http2: frame too large" panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x30 pc=0x13d77df]

the below is my test code, do you have any idea? @arsenetar

` key := "mykey"
options := grpc.WithAuthority(key)
conn, err := grpc.Dial("grpc.stability.ai:443", grpc.WithCredentialsBundle(insecure.NewBundle()), options)
if err != nil {
fmt.Println("grpc Dial err: ", err)
return
}
defer conn.Close()
grpcClient := generation.NewGenerationServiceClient(conn)
var pros [] *generation.Prompt
var pro generation.Prompt_Text
pro.Text = "houston, we are a 'go' for launch!"
pros = append(pros, &generation.Prompt{
Prompt: &pro,
})

var width uint64 = 512
var height uint64 = 512
var seeds [] uint32
seeds = append(seeds, 34567)
var img_param generation.Request_Image = generation.Request_Image{
	Image: &generation.ImageParameters {
		Width: &width,
		Height: &height,
		Seed: seeds,
	},
}
cli,err := grpcClient.Generate(context.Background(), &generation.Request{
	EngineId: "stable-diffusion-v1-5",
	RequestId: "aadfdfdafdafadfadsfdfaaddssd",
	Prompt: pros,
	Params: &img_param,
})

println("err: %s", err.Error())

ans,err1 := cli.Recv()
if err1 != nil {
	println("recved: %v", ans.Received)
}`

@arsenetar
Copy link
Contributor

@carryinfo I provided some example code over in the other issue.

@carryinfo
Copy link
Author

@carryinfo I provided some example code over in the other issue.

ok , thanks very much

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants