stability_sdk 0.3.4 → 0.3.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9514ef57fb6cd45f5b02713f17ebed4401c260a883192c722a24c5ba4d0a7b41
4
- data.tar.gz: 70f866ca076fcfb3000e880e5a08a127627acf7a611c61efb33dc511b20985e4
3
+ metadata.gz: d9c623b34b265936b3560c9bf2c8bc2f20f1882df4656c8050777cd2bb60b027
4
+ data.tar.gz: d81a22156c80f6f62cb4bb0a3bcd00094dae492ccca4a1e0d0a9e6a62d2e5870
5
5
  SHA512:
6
- metadata.gz: '090226b360d62ed7f17480fad67a5c1f5bbec11f27c3823056c8b3ad71cb279ba0c7b9394cec003fa4f9821efea8a884a3ede0c6e82bd3331e94dedb48a62f41'
7
- data.tar.gz: 2897854946800c939ed67cbb4f3e718e5d8fb94b97e7e06204d35cea3c2ec899962891366a33052e150e5d9dd4a82e18b120491d1b99bafbd4d17aa67b01f692
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
 
@@ -72,10 +72,12 @@ module StabilitySDK
72
72
 
73
73
  prompt_param = []
74
74
  if prompt != ""
75
- prompt_param << Gooseai::Prompt.new(text: prompt)
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
- return Gooseai::Prompt.new(
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)
@@ -1,3 +1,3 @@
1
1
  module StabilitySDK
2
- VERSION = "0.3.4"
2
+ VERSION = "0.3.5"
3
3
  end
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
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-07 00:00:00.000000000 Z
11
+ date: 2023-11-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: grpc