stability_sdk 0.2.9 → 0.2.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/exe/stability-client +6 -0
- data/lib/stability_sdk/client.rb +5 -0
- data/lib/stability_sdk/version.rb +1 -1
- data/lib/stability_sdk.rb +1 -0
- data/stability_sdk.gemspec +1 -0
- metadata +22 -3
- data/Gemfile.lock +0 -35
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0b45f00aa32974424860512f59fb3c1745b6c3b8b08f359e95ccd603f637642d
|
4
|
+
data.tar.gz: a67397bdc2b10b0bc49b7a508e3283c20fa4d7ea4ae4b4598b086b0ecc43b323
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f2fe617756b1d720e1d3a5c63807a7dbde52b70df2eb7a3c11a2bde803245f0e00c25b29d0d1893359de2243d333cf82ce274e23e03f220dadcad1d6f661261c
|
7
|
+
data.tar.gz: e50e38e2260d9e376581c03555468273c4378dea33cefdce1fb3e00e0d32db8aa592a63ba0e87f9685d0c89cdbd95c75af5093fc3e724711d862727d346028ba
|
data/.gitignore
CHANGED
data/exe/stability-client
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
require "optparse"
|
4
4
|
require "mime/types"
|
5
|
+
require "fastimage"
|
5
6
|
require "logger"
|
6
7
|
require "stability_sdk"
|
7
8
|
|
@@ -42,6 +43,11 @@ raise StabilitySDK::InsufficientParameter, "api key is required" if !options.has
|
|
42
43
|
|
43
44
|
raise StabilitySDK::InsufficientParameter, "init_image is required if mask_image is provided" if options.has_key?(:mask_image) && !options.has_key?(:init_image)
|
44
45
|
|
46
|
+
if options.has_key?(:init_image)
|
47
|
+
size = FastImage.size(options[:init_image])
|
48
|
+
raise StabilitySDK::InvalidParameter, "width and height of init_image must be a multiple of 64" if size[0] % 64 != 0 || size[1] % 64 != 0
|
49
|
+
end
|
50
|
+
|
45
51
|
client = StabilitySDK::Client.new(api_key: options[:api_key])
|
46
52
|
|
47
53
|
client.generate(prompt, options) do |answer|
|
data/lib/stability_sdk/client.rb
CHANGED
@@ -42,6 +42,11 @@ module StabilitySDK
|
|
42
42
|
def generate(prompt, options, &block)
|
43
43
|
width = options.has_key?(:width) ? options[:width].to_i : DEFAULT_IMAGE_WIDTH
|
44
44
|
height = options.has_key?(:height) ? options[:height].to_i : DEFAULT_IMAGE_HEIGHT
|
45
|
+
|
46
|
+
if width % 64 != 0 || height % 64 != 0
|
47
|
+
raise InvalidParameter, "width and height must be a multiple of 64"
|
48
|
+
end
|
49
|
+
|
45
50
|
samples = options.has_key?(:num_samples) ? options[:num_samples].to_i : DEFAULT_SAMPLE_SIZE
|
46
51
|
steps = options.has_key?(:steps) ? options[:steps].to_i : DEFAULT_STEPS
|
47
52
|
seed = options.has_key?(:seed) ? [options[:seed].to_i] : [rand(4294967295)]
|
data/lib/stability_sdk.rb
CHANGED
data/stability_sdk.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stability_sdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kosei Moriyama
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-10-
|
11
|
+
date: 2022-10-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: grpc
|
@@ -38,6 +38,26 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 3.0.0
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: fastimage
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '2.2'
|
48
|
+
- - ">="
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: 2.2.6
|
51
|
+
type: :runtime
|
52
|
+
prerelease: false
|
53
|
+
version_requirements: !ruby/object:Gem::Requirement
|
54
|
+
requirements:
|
55
|
+
- - "~>"
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
version: '2.2'
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: 2.2.6
|
41
61
|
- !ruby/object:Gem::Dependency
|
42
62
|
name: grpc-tools
|
43
63
|
requirement: !ruby/object:Gem::Requirement
|
@@ -65,7 +85,6 @@ files:
|
|
65
85
|
- ".gitmodules"
|
66
86
|
- ".travis.yml"
|
67
87
|
- Gemfile
|
68
|
-
- Gemfile.lock
|
69
88
|
- LICENSE
|
70
89
|
- README.md
|
71
90
|
- Rakefile
|
data/Gemfile.lock
DELETED
@@ -1,35 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
stability_sdk (0.2.9)
|
5
|
-
grpc (>= 1.41.1)
|
6
|
-
mime-types (>= 3.0.0)
|
7
|
-
|
8
|
-
GEM
|
9
|
-
remote: https://rubygems.org/
|
10
|
-
specs:
|
11
|
-
google-protobuf (3.21.7)
|
12
|
-
googleapis-common-protos-types (1.4.0)
|
13
|
-
google-protobuf (~> 3.14)
|
14
|
-
grpc (1.49.1)
|
15
|
-
google-protobuf (~> 3.21)
|
16
|
-
googleapis-common-protos-types (~> 1.0)
|
17
|
-
grpc-tools (1.48.0)
|
18
|
-
mime-types (3.4.1)
|
19
|
-
mime-types-data (~> 3.2015)
|
20
|
-
mime-types-data (3.2022.0105)
|
21
|
-
minitest (5.16.3)
|
22
|
-
rake (12.3.3)
|
23
|
-
|
24
|
-
PLATFORMS
|
25
|
-
arm64-darwin-20
|
26
|
-
ruby
|
27
|
-
|
28
|
-
DEPENDENCIES
|
29
|
-
grpc-tools
|
30
|
-
minitest (~> 5.0)
|
31
|
-
rake (~> 12.0)
|
32
|
-
stability_sdk!
|
33
|
-
|
34
|
-
BUNDLED WITH
|
35
|
-
2.2.2
|