stability_sdk 0.3.3 → 0.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +3 -1
- data/exe/stability-client +1 -0
- data/lib/stability_sdk/client.rb +12 -9
- data/lib/stability_sdk/version.rb +1 -1
- data/stability_sdk.gemspec +1 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d9c623b34b265936b3560c9bf2c8bc2f20f1882df4656c8050777cd2bb60b027
|
4
|
+
data.tar.gz: d81a22156c80f6f62cb4bb0a3bcd00094dae492ccca4a1e0d0a9e6a62d2e5870
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dcba5669c8bc711975c7f2c604c74e79396bf55b5594e1ce1ce3aff7627cf05eb356a3fb672e932670529b55aeaaecb97f02b595dbe274e3f02e27f4b16977ab
|
7
|
+
data.tar.gz: e0ee6ea802ba9ef6b664e3b98238d107c0dc1373e565a6e0a77ddac78c9e7466fb4664faa4beee737c3bbbd67ba53bb5d9ba9aeb72ad673b6a6e366aa41cc12d
|
data/README.md
CHANGED
@@ -56,7 +56,7 @@ Options:
|
|
56
56
|
-p, --prefix=VAL output prefixes for artifacts. default `generation`
|
57
57
|
--no-store do not write out artifacts
|
58
58
|
-n, --num_samples=VAL number of samples to generate. default 1
|
59
|
-
-e, --engine=VAL engine to use for inference. default `stable-diffusion-v1-
|
59
|
+
-e, --engine=VAL engine to use for inference. default `stable-diffusion-xl-1024-v1-0`
|
60
60
|
-i, --init_image=VAL path to init image
|
61
61
|
-m, --mask_image=VAL path to mask image
|
62
62
|
--start_schedule=VAL start schedule for init image (must be greater than 0, 1 is full strength text prompt, no trace of image). default 1.0
|
@@ -66,6 +66,8 @@ Options:
|
|
66
66
|
--guidance_strength=VAL Strength of the guidance. We recommend values in range [0.0,1.0]. A good default is 0.25. default nil
|
67
67
|
--guidance_prompt=VAL Prompt to use for guidance, defaults to `YOUR_PROMPT_TEXT` argument (above) if not specified.
|
68
68
|
--guidance_models=VAL Models to use for guidance. default nil
|
69
|
+
-t, --artifact_types=VAL filter artifacts by type (ARTIFACT_IMAGE, ARTIFACT_TEXT, ARTIFACT_CLASSIFICATIONS, etc)
|
70
|
+
--prompt_weight=VAL Weight of the prompt. Currently multi-prompting is not supported yet. default 1"
|
69
71
|
-v, --verbose
|
70
72
|
```
|
71
73
|
|
data/exe/stability-client
CHANGED
@@ -38,6 +38,7 @@ opt.on("--guidance_strength=VAL", Float, "Strength of the guidance. We recommend
|
|
38
38
|
opt.on("--guidance_prompt=VAL", String, "Prompt to use for guidance, defaults to `YOUR_PROMPT_TEXT` argument (above) if not specified.") {|v| options[:guidance_prompt] = v }
|
39
39
|
opt.on("--guidance_models=VAL", Array, "Models to use for guidance. default nil") {|v| options[:guidance_models] = v }
|
40
40
|
opt.on("-t", "--artifact_types=VAL", Array, "filter artifacts by type (ARTIFACT_IMAGE, ARTIFACT_TEXT, ARTIFACT_CLASSIFICATIONS, etc)") {|v| options[:artifact_types] = v }
|
41
|
+
opt.on("--prompt_weight=VAL", Float, "Weight of the prompt. Currently multi-prompting is not supported yet. default 1") {|v| options[:prompt_weight] = v }
|
41
42
|
opt.on("-v", "--verbose") { logger.level = Logger::DEBUG }
|
42
43
|
opt.parse!(ARGV)
|
43
44
|
|
data/lib/stability_sdk/client.rb
CHANGED
@@ -8,7 +8,7 @@ module StabilitySDK
|
|
8
8
|
DEFAULT_IMAGE_WIDTH = 512
|
9
9
|
DEFAULT_IMAGE_HEIGHT = 512
|
10
10
|
DEFAULT_SAMPLE_SIZE = 1
|
11
|
-
DEFAULT_ENGINE_ID = "stable-diffusion-v1-
|
11
|
+
DEFAULT_ENGINE_ID = "stable-diffusion-xl-1024-v1-0"
|
12
12
|
DEFAULT_CFG_SCALE = 7.0
|
13
13
|
DEFAULT_START_SCHEDULE = 1.0
|
14
14
|
DEFAULT_END_SCHEDULE = 0.01
|
@@ -72,10 +72,12 @@ module StabilitySDK
|
|
72
72
|
|
73
73
|
prompt_param = []
|
74
74
|
if prompt != ""
|
75
|
-
|
75
|
+
param = Gooseai::Prompt.new(text: prompt)
|
76
|
+
param.parameters = Gooseai::PromptParameters.new(weight: options[:prompt_weight]) if options.has_key?(:prompt_weight)
|
77
|
+
prompt_param << param
|
76
78
|
end
|
77
79
|
if options.has_key?(:init_image)
|
78
|
-
prompt_param << init_image_to_prompt(options[:init_image])
|
80
|
+
prompt_param << init_image_to_prompt(options[:init_image], options[:prompt_weight])
|
79
81
|
step_parameter.scaled_step = 0
|
80
82
|
step_parameter.sampler = Gooseai::SamplerParameters.new(
|
81
83
|
cfg_scale: options.has_key?(:cfg_scale) ? options[:cfg_scale] : DEFAULT_CFG_SCALE,
|
@@ -168,17 +170,18 @@ module StabilitySDK
|
|
168
170
|
end
|
169
171
|
end
|
170
172
|
|
171
|
-
def init_image_to_prompt(path)
|
173
|
+
def init_image_to_prompt(path, weight)
|
172
174
|
bin = IO.binread(path)
|
173
|
-
|
175
|
+
prompt = Gooseai::Prompt.new(
|
174
176
|
artifact: Gooseai::Artifact.new(
|
175
177
|
type: Gooseai::ArtifactType::ARTIFACT_IMAGE,
|
176
178
|
binary: bin,
|
177
|
-
)
|
178
|
-
parameters: Gooseai::PromptParameters.new(
|
179
|
-
init: true
|
180
|
-
),
|
179
|
+
)
|
181
180
|
)
|
181
|
+
unless weight.nil?
|
182
|
+
prompt.parameters = Gooseai::PromptParameters.new(weight: weight)
|
183
|
+
end
|
184
|
+
return prompt
|
182
185
|
end
|
183
186
|
|
184
187
|
def mask_image_to_prompt(path)
|
data/stability_sdk.gemspec
CHANGED
@@ -15,6 +15,7 @@ Gem::Specification.new do |spec|
|
|
15
15
|
spec.metadata["homepage_uri"] = spec.homepage
|
16
16
|
spec.metadata["source_code_uri"] = "https://github.com/cou929/stability-sdk-ruby"
|
17
17
|
spec.metadata["changelog_uri"] = "https://github.com/cou929/stability-sdk-ruby"
|
18
|
+
spec.metadata["rubygems_mfa_required"] = "true"
|
18
19
|
|
19
20
|
# Specify which files should be added to the gem when it is released.
|
20
21
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
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.3.
|
4
|
+
version: 0.3.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kosei Moriyama
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-11-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: grpc
|
@@ -125,6 +125,7 @@ metadata:
|
|
125
125
|
homepage_uri: https://github.com/cou929/stability-sdk-ruby
|
126
126
|
source_code_uri: https://github.com/cou929/stability-sdk-ruby
|
127
127
|
changelog_uri: https://github.com/cou929/stability-sdk-ruby
|
128
|
+
rubygems_mfa_required: 'true'
|
128
129
|
post_install_message:
|
129
130
|
rdoc_options: []
|
130
131
|
require_paths:
|
@@ -140,7 +141,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
140
141
|
- !ruby/object:Gem::Version
|
141
142
|
version: '0'
|
142
143
|
requirements: []
|
143
|
-
rubygems_version: 3.1.
|
144
|
+
rubygems_version: 3.1.6
|
144
145
|
signing_key:
|
145
146
|
specification_version: 4
|
146
147
|
summary: Ruby client for interacting with stability.ai APIs (e.g. stable diffusion
|