-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathmain.go
51 lines (42 loc) · 1.06 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/*
* @Author: SpenserCai
* @Date: 2023-08-12 14:15:02
* @version:
* @LastEditors: SpenserCai
* @LastEditTime: 2023-08-15 17:13:31
* @Description: file content
*/
package main
import (
"encoding/base64"
"fmt"
"os"
SdClient "github.com/SpenserCai/sd-webui-go"
"github.com/SpenserCai/sd-webui-go/intersvc"
)
func main() {
// init client
sdClient := SdClient.NewStableDiffInterface("127.0.0.1:7860")
var f_factor int64 = 20
var artistic bool = false
// Set Request
deoldify_inter := &intersvc.DeoldifyImage{
RequestItem: &intersvc.DeoldifyImageRequest{
InputImage: "https://media.discordapp.net/attachments/1138408545277190237/1138508881635577947/i7krs1nj1ekla1.jpg",
RenderFactor: &f_factor,
Artistic: &artistic,
},
}
// Call Action
deoldify_inter.Action(sdClient)
if deoldify_inter.Error != nil {
fmt.Println("Error: ", deoldify_inter.Error)
return
}
response := deoldify_inter.GetResponse()
reader, err := base64.StdEncoding.DecodeString(response.Image)
if err != nil {
panic(err)
}
os.WriteFile("output.jpg", reader, 0666)
}