getimg 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/getimg/client/enhancements.rb +34 -0
- data/lib/getimg/client/stable_diffusion.rb +30 -1
- data/lib/getimg/client/stable_diffusion_xl.rb +22 -1
- data/lib/getimg/client.rb +5 -0
- data/lib/getimg/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f1afb7594cb526ab50ac78d45fe06296e3dddb7f0c405c46379ab01486c9391b
|
4
|
+
data.tar.gz: 998563e15a69918d5838a16d8246c5390367ca0abbd509942830b89b2c759763
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 45cf177d08c98576490f2ac4b6945efd0557b1e8368f193f0c25d634228aa8d14a4a63dfa78b6f4ba02e5490d267d97790a03d9e68859fb6a205b912fc85a351
|
7
|
+
data.tar.gz: b1343f3d6204d16ceafed56e158a6ad77dfb298a5d2502c145ab44679d3dbb911902eb5fe664abb50cbc28a3784459051f70323b49270da4e9309a930ef5b756
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Getimg
|
4
|
+
class Client
|
5
|
+
class Enhancements
|
6
|
+
def initialize(client)
|
7
|
+
@client = client
|
8
|
+
end
|
9
|
+
|
10
|
+
# Body Params
|
11
|
+
# model string
|
12
|
+
# image string
|
13
|
+
# scale numbe
|
14
|
+
# output_format string
|
15
|
+
|
16
|
+
# gen = client.enhancements.upscale({model: "real-esrgan-4x", image: Getimg::Image.new.file_to_base64("xl-test.PNG"), scale: 4, output_format: "png"})
|
17
|
+
# Getimg::Image.new.base64_to_file(gen["image"])
|
18
|
+
def upscale(options = {})
|
19
|
+
@client.post("/enhancements/upscale", options)
|
20
|
+
end
|
21
|
+
|
22
|
+
# Body Params
|
23
|
+
# model string
|
24
|
+
# image string
|
25
|
+
# output_format string
|
26
|
+
|
27
|
+
# gen = client.enhancements.face_fix({model: "gfpgan-v1-3", image: Getimg::Image.new.file_to_base64("test.PNG"), output_format: "png"})
|
28
|
+
# Getimg::Image.new.base64_to_file(gen["image"])
|
29
|
+
def face_fix(options = {})
|
30
|
+
@client.post("/enhancements/face-fix", options)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -19,10 +19,39 @@ module Getimg
|
|
19
19
|
# scheduler string
|
20
20
|
# output_format string
|
21
21
|
|
22
|
-
# client.stable_diffusion.text_to_image({model: "stable-diffusion-v1-5", prompt: "a photo of an astronaut riding a horse
|
22
|
+
# gen = client.stable_diffusion.text_to_image({model: "stable-diffusion-v1-5", prompt: "a photo of an astronaut riding a horse", guidance: 7.5, width: 256, height: 256, steps: 25, output_format: "png"})
|
23
|
+
# Getimg::Image.new.base64_to_file(gen["image"])
|
23
24
|
def text_to_image(options = {})
|
24
25
|
@client.post("/stable-diffusion/text-to-image", options)
|
25
26
|
end
|
27
|
+
|
28
|
+
# Body Params
|
29
|
+
# model string
|
30
|
+
# prompt string, required
|
31
|
+
# negative_prompt string
|
32
|
+
# image string, required
|
33
|
+
# strength number
|
34
|
+
# steps integer
|
35
|
+
# guidance number
|
36
|
+
# seed integer
|
37
|
+
# scheduler string
|
38
|
+
# output_format string
|
39
|
+
|
40
|
+
# client.stable_diffusion.image_to_image(
|
41
|
+
# {
|
42
|
+
# model: "stable-diffusion-v1-5",
|
43
|
+
# prompt: "mars",
|
44
|
+
# image: Getimg::Image.new.file_to_base64("test.PNG"),
|
45
|
+
# strength: 0.5,
|
46
|
+
# steps: 25,
|
47
|
+
# guidance: 7.5,
|
48
|
+
# output_format: "png"
|
49
|
+
# }
|
50
|
+
# )
|
51
|
+
# Getimg::Image.new.base64_to_file(gen["image"])
|
52
|
+
def image_to_image(options = {})
|
53
|
+
@client.post("/stable-diffusion/image-to-image", options)
|
54
|
+
end
|
26
55
|
end
|
27
56
|
end
|
28
57
|
end
|
@@ -21,10 +21,31 @@ module Getimg
|
|
21
21
|
# scheduler string
|
22
22
|
# output_format string
|
23
23
|
|
24
|
-
# client.stable_diffusion_xl.text_to_image({model: "stable-diffusion-xl-v1-0", prompt: "a photo of an astronaut riding a horse
|
24
|
+
# gen = client.stable_diffusion_xl.text_to_image({model: "stable-diffusion-xl-v1-0", prompt: "a photo of an astronaut riding a horse", guidance: 7.5, width: 1024, height: 1024, steps: 30, output_format: "png"})
|
25
|
+
# Getimg::Image.new.base64_to_file(gen["image"])
|
25
26
|
def text_to_image(options = {})
|
26
27
|
@client.post("/stable-diffusion-xl/text-to-image", options)
|
27
28
|
end
|
29
|
+
|
30
|
+
# Body Params
|
31
|
+
# model string
|
32
|
+
# prompt string, required
|
33
|
+
# negative_prompt string
|
34
|
+
# prompt_2 string
|
35
|
+
# negative_prompt_2 string
|
36
|
+
# image string, required
|
37
|
+
# strength number
|
38
|
+
# steps integer
|
39
|
+
# guidance number
|
40
|
+
# seed integer
|
41
|
+
# scheduler string
|
42
|
+
# output_format string
|
43
|
+
|
44
|
+
# gen = client.stable_diffusion_xl.image_to_image({model: "stable-diffusion-xl-v1-0", prompt: "mars background", image: Getimg::Image.new.file_to_base64("xl-test.PNG"), strength: 0.5, steps: 50, guidance: 7.5, output_format: "png"})
|
45
|
+
# Getimg::Image.new.base64_to_file(gen["image"])
|
46
|
+
def image_to_image(options = {})
|
47
|
+
@client.post("/stable-diffusion-xl/image-to-image", options)
|
48
|
+
end
|
28
49
|
end
|
29
50
|
end
|
30
51
|
end
|
data/lib/getimg/client.rb
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
require "getimg/client/models"
|
4
4
|
require "getimg/client/stable_diffusion"
|
5
5
|
require "getimg/client/stable_diffusion_xl"
|
6
|
+
require "getimg/client/enhancements"
|
6
7
|
require "getimg/client/account"
|
7
8
|
|
8
9
|
module Getimg
|
@@ -34,6 +35,10 @@ module Getimg
|
|
34
35
|
@stable_diffusion_xl ||= StableDiffusionXl.new(self)
|
35
36
|
end
|
36
37
|
|
38
|
+
def enhancements
|
39
|
+
@enhancements ||= Enhancements.new(self)
|
40
|
+
end
|
41
|
+
|
37
42
|
def account
|
38
43
|
@account ||= Account.new(self)
|
39
44
|
end
|
data/lib/getimg/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: getimg
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- acidtib
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-11-
|
11
|
+
date: 2023-11-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -60,6 +60,7 @@ files:
|
|
60
60
|
- lib/getimg.rb
|
61
61
|
- lib/getimg/client.rb
|
62
62
|
- lib/getimg/client/account.rb
|
63
|
+
- lib/getimg/client/enhancements.rb
|
63
64
|
- lib/getimg/client/models.rb
|
64
65
|
- lib/getimg/client/stable_diffusion.rb
|
65
66
|
- lib/getimg/client/stable_diffusion_xl.rb
|