leoandruby 0.1.2 → 0.2.0

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: 9d4a487c7ba83376e79ce73f898ebe75378f2df1d3fbedb6668a5b51b3641ece
4
- data.tar.gz: 954f1e0cb9f0f3ced2fc853059e77825693a1cf6f57cdf84f827049ddb862add
3
+ metadata.gz: 638e39f8fb7c349a1f6bd4c4dbcd548d6a552f826d20bbe7f95d5f9064267ed3
4
+ data.tar.gz: f5fafdb80e01a028eba24a0232f0e2725c3927a4c73daff75f0a75a09fdb1b66
5
5
  SHA512:
6
- metadata.gz: 46c3a77f0c5a3bd4970f9b137b64bbeda9595e3a454e71bf5aaa53784f578534feb5984867a9d97860d1a85234b2c6e1f2af80751ce3d649a9be64a84b088f54
7
- data.tar.gz: dd969b602250d6eb442b465c483faf8a5be90d32178b9b83ee978493f4dd26418e3f8857bd71a76e3384010030b0340d7ce89c5aef0565bd5889d27567e10330
6
+ metadata.gz: bf2a5818986f0057e76bf7577a4907334a1eacc47adc718ff28a3afcd1fc846627e5d2d56f7a15b3d4c070f7f67f0dce1ce1050ee90a6bb3a5bf3d164c817b83
7
+ data.tar.gz: '08baacb5984c10741d5264a4ed4f888e560a428ccf3f19bdbfbc62350b64b51da02eb29009d54fa41698b59c9199b8ceabdf5c6c6badf7a186f749c5f6931a3e'
data/CHANGELOG.md CHANGED
@@ -6,4 +6,12 @@
6
6
 
7
7
  ## [0.1.1] - 2024-11-21
8
8
 
9
- - Bug Fixes
9
+ - Bug Fixes
10
+
11
+ ## [0.1.2] - 2024-11-21
12
+
13
+ - Improved: Refactored code to use StandardRB style.
14
+
15
+ ## [0.2.0] - 2024-11-22
16
+
17
+ - Added: New Feature allows user to specify how many images to generate, defaulting to 1.
data/README.md CHANGED
@@ -59,14 +59,15 @@ client = LeoAndRuby::Client.new(api_key)
59
59
 
60
60
  ### 2. Generate an Image
61
61
 
62
- You can generate an image by providing the prompt, model ID, width, and height:
62
+ You can generate an image by providing the prompt, model ID, width, height, and optionally the number of images:
63
63
 
64
64
  ```ruby
65
65
  generation_response = client.generate_image(
66
66
  prompt: 'An oil painting of a cat',
67
67
  model_id: '6bef9f1b-29cb-40c7-b9df-32b51c1f67d3',
68
68
  width: 512,
69
- height: 512
69
+ height: 512,
70
+ num_images: 1 # Optional, defaults to 1 if not specified
70
71
  )
71
72
 
72
73
  generation_id = generation_response['sdGenerationJob']['generationId']
@@ -119,7 +120,8 @@ generation_response = client.generate_image(
119
120
  prompt: 'A futuristic cityscape at sunset',
120
121
  model_id: '6bef9f1b-29cb-40c7-b9df-32b51c1f67d3',
121
122
  width: 1024,
122
- height: 768
123
+ height: 768,
124
+ num_images: 1 # Optional, defaults to 1 if not specified
123
125
  )
124
126
 
125
127
  generation_id = generation_response['sdGenerationJob']['generationId']
@@ -10,7 +10,7 @@ module LeoAndRuby
10
10
  @api_key = api_key
11
11
  end
12
12
 
13
- def generate_image(prompt:, model_id:, width:, height:)
13
+ def generate_image(prompt:, model_id:, width:, height:, num_images: 1)
14
14
  uri = URI("#{API_BASE_URL}/generations")
15
15
  request = Net::HTTP::Post.new(uri)
16
16
  request["Accept"] = "application/json"
@@ -21,7 +21,8 @@ module LeoAndRuby
21
21
  prompt: prompt,
22
22
  modelId: model_id,
23
23
  width: width,
24
- height: height
24
+ height: height,
25
+ num_images: num_images
25
26
  }.to_json
26
27
 
27
28
  response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Leoandruby
4
- VERSION = "0.1.2"
4
+ VERSION = "0.2.0"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: leoandruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Richard HW Baldwin