ruby-stabilityai 0.0.1 → 0.0.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 17277edf17941172cadec0db6163696718b1a39968f9495df13a621bc8e8f171
4
- data.tar.gz: dde322e316056c9082e8929552a9818d0651b640894b494cb91381bc83def143
3
+ metadata.gz: 4b814e8c1aeac82cff165c034eba5bcc6e3258f2ff39ca7f628b2bb8add74e18
4
+ data.tar.gz: 1af637ffcef438cb4e06c22abfd13650ebfe2d1014b6d865210bfe053e56eea4
5
5
  SHA512:
6
- metadata.gz: bfd2a44b14b3c5ddfa7a8eae1711551fd114229460938e9d33ffa12cffe6ca1631a45dc11d5be1ae94561f06efbf681dac6d6cb8c319879f10bde1ac842884e1
7
- data.tar.gz: 5b013585ad4d464a6ff4ca54895bbc4042d5fb72f1eb39ab27b69cc3306079d26f42e5cb7315d0db2ad4d799f16201fe1c07640dddccaec7603c14e6c98553fc
6
+ metadata.gz: e99c0c9b50d7cd997e381a8ea788e8108adf9acc58bd57b2b861522c819402531ac742bf0e6863c9afb74d5ef1a45f49ce42c8853ed1f551727a5f72657cf113
7
+ data.tar.gz: 49ffc8ea2943b433ba2cac56140bad78264742f353567a1a876f19df9fa1365c092297c8208ef4949f63295cc52d512308ad53fb424cca7de0bd5338c74884b6
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ruby-stabilityai (0.0.1)
4
+ ruby-stabilityai (0.0.2)
5
5
  httparty (>= 0.18.1)
6
6
 
7
7
  GEM
data/README.md CHANGED
@@ -78,7 +78,7 @@ client = StabilityAI::Client.new(
78
78
  or when configuring the gem:
79
79
 
80
80
  ```ruby
81
- OpenAI.configure do |config|
81
+ StabilityAI.configure do |config|
82
82
  config.access_token = ENV.fetch("STABILITYAI_ACCESS_TOKEN")
83
83
  config.organization_id = ENV.fetch("STABILITYAI_ORGANIZATION_ID") # Optional
84
84
  config.engine_id = "/stable-diffusion-v1-5"
@@ -14,6 +14,14 @@ module StabilityAI
14
14
  StabilityAI::Client.json_post(path: "/text-to-image", parameters: parameters)
15
15
  end
16
16
 
17
+ # def image_to_image(parameters: open_files(parameters))
18
+ # StabilityAI::Client.multipart_post(path: "/image-to-image", parameters: parameters)
19
+ # end
20
+
21
+ def images
22
+ @images ||= StabilityAI::Images.new
23
+ end
24
+
17
25
  def engines
18
26
  StabilityAI::Client.get(path: "/engines/list")
19
27
  end
@@ -0,0 +1,28 @@
1
+ module StabilityAI
2
+ class Images
3
+ def initialize(access_token: nil, organization_id: nil)
4
+ StabilityAI.configuration.access_token = access_token if access_token
5
+ StabilityAI.configuration.organization_id = organization_id if organization_id
6
+ end
7
+
8
+ # def edit(parameters: {})
9
+ # OpenAI::Client.multipart_post(path: "/images/edits", parameters: open_files(parameters))
10
+ # end
11
+
12
+ def image_to_image(parameters: {})
13
+ StabilityAI::Client.multipart_post(path: "/image-to-image", parameters: open_files(parameters))
14
+ end
15
+
16
+ def upscale(parameters: {})
17
+ StabilityAI::Client.multipart_post(path: "/image-to-image/upscale", parameters: open_files(parameters))
18
+ end
19
+ private
20
+
21
+ def open_files(parameters)
22
+ parameters = parameters.merge(init_image: File.open(parameters[:init_image])) if parameters[:init_image]
23
+ parameters = parameters.merge(image: File.open(parameters[:image])) if parameters[:image]
24
+ parameters = parameters.merge(mask: File.open(parameters[:mask])) if parameters[:mask]
25
+ parameters
26
+ end
27
+ end
28
+ end
@@ -1,3 +1,3 @@
1
1
  module StabilityAI
2
- VERSION = "0.0.1".freeze
2
+ VERSION = "0.0.2".freeze
3
3
  end
data/lib/stabilityai.rb CHANGED
@@ -2,6 +2,7 @@ require "httparty"
2
2
 
3
3
  require_relative "stabilityai/client"
4
4
  require_relative "stabilityai/version"
5
+ require_relative "stabilityai/images"
5
6
 
6
7
  module StabilityAI
7
8
  class Error < StandardError; end
@@ -26,6 +26,4 @@ Gem::Specification.new do |spec|
26
26
  spec.require_paths = ["lib"]
27
27
 
28
28
  spec.add_dependency "httparty", ">= 0.18.1"
29
-
30
- spec.post_install_message = "Note if upgrading: The `::Ruby::StabilityAI` module has been removed and all classes have been moved under the top level `::StabilityAI` module. To upgrade, change `require 'ruby/stabilityai'` to `require 'stabilityai'` and change all references to `Ruby::StabilityAI` to `StabilityAI`."
31
29
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-stabilityai
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-04-25 00:00:00.000000000 Z
11
+ date: 2023-04-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -45,6 +45,7 @@ files:
45
45
  - lib/stabilityai.rb
46
46
  - lib/stabilityai/client.rb
47
47
  - lib/stabilityai/compatibility.rb
48
+ - lib/stabilityai/images.rb
48
49
  - lib/stabilityai/version.rb
49
50
  - ruby-stabilityai.gemspec
50
51
  homepage: https://github.com/kurbm/ruby-stabilityai
@@ -55,10 +56,7 @@ metadata:
55
56
  source_code_uri: https://github.com/kurbm/ruby-stabilityai
56
57
  changelog_uri: https://github.com/kurbm/ruby-stabilityai/blob/main/CHANGELOG.md
57
58
  rubygems_mfa_required: 'true'
58
- post_install_message: 'Note if upgrading: The `::Ruby::StabilityAI` module has been
59
- removed and all classes have been moved under the top level `::StabilityAI` module.
60
- To upgrade, change `require ''ruby/stabilityai''` to `require ''stabilityai''` and
61
- change all references to `Ruby::StabilityAI` to `StabilityAI`.'
59
+ post_install_message:
62
60
  rdoc_options: []
63
61
  require_paths:
64
62
  - lib