stability_sdk 0.3.4 → 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 +1 -0
- data/exe/stability-client +1 -0
- data/lib/stability_sdk/client.rb +11 -8
- data/lib/stability_sdk/version.rb +1 -1
- metadata +2 -2
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
|
@@ -67,6 +67,7 @@ Options:
|
|
|
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
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"
|
|
70
71
|
-v, --verbose
|
|
71
72
|
```
|
|
72
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
|
@@ -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)
|
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-
|
|
11
|
+
date: 2023-11-13 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: grpc
|