tryiton 1.1.0 → 2.0.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/README.md +4 -4
- data/lib/tryiton/client.rb +3 -3
- data/lib/tryiton/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: '097cafef70c6dc514c07c210bab0ab6f14689de7dc2ad4a66117009e159831c6'
|
|
4
|
+
data.tar.gz: 814198bb65bfc55761267344ea53e35a334b02d19f5e92e6e0a79830c22373d3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ffe674da6cc6caf4b03fd11e2cf4c9ba85c5c8ffec4f580bc657e3b62bfb4c7c8c5ff7d9c2ca44b14c5e845cd143badc28b5809a99f2242d7036c2cbc9130bc4
|
|
7
|
+
data.tar.gz: 9c905fe3606de104c25ff63ca180c6579c29ce334b4d4453ef176414faac2055a0011e3e1204acc4c1e51109905ae7116a0c7249630fa0afa4d74f568bfd65dc
|
data/README.md
CHANGED
|
@@ -32,7 +32,7 @@ require "tryiton"
|
|
|
32
32
|
client = Tryiton::Client.new(api_key: ENV["TRYITON_API_KEY"])
|
|
33
33
|
|
|
34
34
|
# Submit a clothing try-on
|
|
35
|
-
job_id = client.
|
|
35
|
+
job_id = client.try_on_fashion(
|
|
36
36
|
model_image: "https://example.com/model.jpg",
|
|
37
37
|
garment_image: "https://example.com/tshirt.jpg",
|
|
38
38
|
category: "clothing",
|
|
@@ -48,13 +48,13 @@ Image inputs accept a public URL or a base64 data URL (`data:image/png;base64,..
|
|
|
48
48
|
|
|
49
49
|
## Core parameters
|
|
50
50
|
|
|
51
|
-
`
|
|
51
|
+
`try_on_fashion` covers clothing and accessory try-on. The most important parameters:
|
|
52
52
|
|
|
53
53
|
| Parameter | Type | Required | Description |
|
|
54
54
|
| --------- | ---- | -------- | ----------- |
|
|
55
55
|
| `model_image` | String | Yes | URL or base64 data URL of the person. |
|
|
56
56
|
| `garment_image` | String | Yes | URL or base64 data URL of the garment or accessory. |
|
|
57
|
-
| `category` | String | No | Item type: `auto`, `clothing`, `eyewear`, `footwear`, `headwear`, `jewelry`, or `
|
|
57
|
+
| `category` | String | No | Item type: `auto`, `clothing`, `eyewear`, `footwear`, `headwear`, `jewelry`, `accessories`, or `others`. `auto` detects it for you. |
|
|
58
58
|
| `subcategory` | String | No | Required for `clothing` (`tops`, `bottoms`, `dresses`), `jewelry`, and `accessories`. |
|
|
59
59
|
|
|
60
60
|
Additional options (`mode` and `moderation_level` for clothing; `num_samples` 1–4 and `output_format` `png`/`jpeg` for every try-on, including hairstyle and tattoo) are documented in the [API reference](https://docs.tryiton.now).
|
|
@@ -81,7 +81,7 @@ All failures raise `Tryiton::Error`, which carries the HTTP status code and the
|
|
|
81
81
|
|
|
82
82
|
```ruby
|
|
83
83
|
begin
|
|
84
|
-
client.
|
|
84
|
+
client.try_on_fashion(...)
|
|
85
85
|
rescue Tryiton::Error => e
|
|
86
86
|
puts "#{e.status} #{e.error_name} #{e.message}" # e.g. 429 OutOfCredits
|
|
87
87
|
end
|
data/lib/tryiton/client.rb
CHANGED
|
@@ -31,7 +31,7 @@ module Tryiton
|
|
|
31
31
|
# Client for the TryItOn virtual try-on API.
|
|
32
32
|
#
|
|
33
33
|
# client = Tryiton::Client.new(api_key: ENV["TRYITON_API_KEY"])
|
|
34
|
-
# job_id = client.
|
|
34
|
+
# job_id = client.try_on_fashion(
|
|
35
35
|
# model_image: "https://example.com/model.jpg",
|
|
36
36
|
# garment_image: "https://example.com/tshirt.jpg",
|
|
37
37
|
# category: "clothing", subcategory: "tops"
|
|
@@ -54,8 +54,8 @@ module Tryiton
|
|
|
54
54
|
# Keys: model_image (required), garment_image (required), category,
|
|
55
55
|
# subcategory, mode, num_samples (1-4), output_format ("png"/"jpeg"),
|
|
56
56
|
# moderation_level ("conservative"/"permissive"/"none").
|
|
57
|
-
def
|
|
58
|
-
request(:post, "/tryon/
|
|
57
|
+
def try_on_fashion(**params)
|
|
58
|
+
request(:post, "/tryon/fashion", params)["jobId"]
|
|
59
59
|
end
|
|
60
60
|
|
|
61
61
|
# Restyle a person's hair. Returns the job id.
|
data/lib/tryiton/version.rb
CHANGED