leoandruby 0.2.2 → 0.3.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 +4 -4
- data/CHANGELOG.md +5 -1
- data/LICENSE.txt +1 -1
- data/README.md +38 -1
- data/lib/leoandruby/client.rb +13 -0
- data/lib/leoandruby/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: 7522b23651a0856c37a0c3dd0905b35f630f4b5eb57dba784b0a1d907dbcf670
|
4
|
+
data.tar.gz: 429364affc88fd9b428aa8bceb05414077918d2a20aacb8d72db0de4b79189b8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b977f50edc64edc3963ce25169dc4e300160c7a22a2606ff262ffe3b1076d205ba1c109ad4841ba9abff95da4c1e83041a710df6597caa1de8fc9afbfeadb750
|
7
|
+
data.tar.gz: 25679bce91e27cd095c8de5a9317560097dd932069e9daa0a6a415fb677335736cae1be8a56c98bc824f0dd8258de9a2a19a5dac68cf164302a58e5c8c61e3d7
|
data/CHANGELOG.md
CHANGED
data/LICENSE.txt
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
The MIT License (MIT)
|
2
2
|
|
3
|
-
Copyright (c) 2024 Richard HW Baldwin
|
3
|
+
Copyright (c) 2024 Richard HW Baldwin and Empire Creative, LLC
|
4
4
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
data/README.md
CHANGED
@@ -73,7 +73,18 @@ generation_response = client.generate_image(
|
|
73
73
|
generation_id = generation_response['sdGenerationJob']['generationId']
|
74
74
|
```
|
75
75
|
|
76
|
-
### 3.
|
76
|
+
### 3. List Available Models
|
77
|
+
|
78
|
+
You can fetch a list of all available platform models using the `list_models` method:
|
79
|
+
|
80
|
+
```ruby
|
81
|
+
models_response = client.list_models
|
82
|
+
puts models_response
|
83
|
+
```
|
84
|
+
|
85
|
+
This will return a list of models available in the Leonardo.ai platform.
|
86
|
+
|
87
|
+
### 4. Retrieve the Generated Image
|
77
88
|
|
78
89
|
Wait a few seconds for the image to be generated, then retrieve it using the generation ID:
|
79
90
|
|
@@ -105,6 +116,32 @@ client = LeoAndRuby::Client.new(api_key)
|
|
105
116
|
|
106
117
|
---
|
107
118
|
|
119
|
+
## Expected Response for List Models
|
120
|
+
|
121
|
+
The `list_models` method will return a response in the following format:
|
122
|
+
|
123
|
+
```json
|
124
|
+
{
|
125
|
+
"custom_models": [
|
126
|
+
{
|
127
|
+
"id": "model_id_1",
|
128
|
+
"name": "Model Name 1",
|
129
|
+
"description": "Description of Model 1",
|
130
|
+
"nsfw": false,
|
131
|
+
},
|
132
|
+
{
|
133
|
+
"id": "model_id_2",
|
134
|
+
"name": "Model Name 2",
|
135
|
+
"description": "Description of Model 2",
|
136
|
+
"nsfw": false,
|
137
|
+
}
|
138
|
+
// More models...
|
139
|
+
]
|
140
|
+
}
|
141
|
+
```
|
142
|
+
|
143
|
+
Each model object contains the `id`, `name`, `description`, and `created_at` fields.
|
144
|
+
|
108
145
|
## Example Script
|
109
146
|
|
110
147
|
Here's a full example script:
|
data/lib/leoandruby/client.rb
CHANGED
@@ -45,6 +45,19 @@ module LeoAndRuby
|
|
45
45
|
handle_response(response)
|
46
46
|
end
|
47
47
|
|
48
|
+
def list_models
|
49
|
+
uri = URI("#{API_BASE_URL}/platformModels")
|
50
|
+
request = Net::HTTP::Get.new(uri)
|
51
|
+
request["Accept"] = "application/json"
|
52
|
+
request["Authorization"] = "Bearer #{@api_key}"
|
53
|
+
|
54
|
+
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
|
55
|
+
http.request(request)
|
56
|
+
end
|
57
|
+
|
58
|
+
handle_response(response)
|
59
|
+
end
|
60
|
+
|
48
61
|
private
|
49
62
|
|
50
63
|
def handle_response(response)
|
data/lib/leoandruby/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: leoandruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Richard HW Baldwin
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-11-
|
11
|
+
date: 2024-11-25 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: LeoAndRuby is a Ruby gem for integrating with the Leonardo.ai API, enabling
|
14
14
|
seamless image generation within Ruby applications. It provides a simple and intuitive
|