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.
- package/README.md +4 -4
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +2 -2
- package/package.json +1 -1
- package/src/index.ts +5 -4
package/README.md
CHANGED
|
@@ -27,7 +27,7 @@ import { TryItOn } from "tryiton";
|
|
|
27
27
|
const client = new TryItOn({ apiKey: process.env.TRYITON_API_KEY });
|
|
28
28
|
|
|
29
29
|
// Submit a clothing try-on
|
|
30
|
-
const jobId = await client.
|
|
30
|
+
const jobId = await client.tryOnFashion({
|
|
31
31
|
modelImage: "https://example.com/model.jpg",
|
|
32
32
|
garmentImage: "https://example.com/tshirt.jpg",
|
|
33
33
|
category: "clothing",
|
|
@@ -43,13 +43,13 @@ Image inputs accept a public URL or a base64 data URL (`data:image/png;base64,..
|
|
|
43
43
|
|
|
44
44
|
## Core parameters
|
|
45
45
|
|
|
46
|
-
`
|
|
46
|
+
`tryOnFashion` covers clothing and accessory try-on. The most important parameters:
|
|
47
47
|
|
|
48
48
|
| Parameter | Type | Required | Description |
|
|
49
49
|
| --------- | ---- | -------- | ----------- |
|
|
50
50
|
| `modelImage` | string | Yes | URL or base64 data URL of the person. |
|
|
51
51
|
| `garmentImage` | string | Yes | URL or base64 data URL of the garment or accessory. |
|
|
52
|
-
| `category` | string | No | Item type: `auto`, `clothing`, `eyewear`, `footwear`, `headwear`, `jewelry`, or `
|
|
52
|
+
| `category` | string | No | Item type: `auto`, `clothing`, `eyewear`, `footwear`, `headwear`, `jewelry`, `accessories`, or `others`. `auto` detects it for you. |
|
|
53
53
|
| `subcategory` | string | No | Required for `clothing` (`tops`, `bottoms`, `dresses`), `jewelry`, and `accessories`. |
|
|
54
54
|
|
|
55
55
|
Additional options (`mode` and `moderationLevel` for clothing; `numSamples` 1–4 and `outputFormat` `png`/`jpeg` for every try-on, including hairstyle and tattoo) are documented in the [API reference](https://docs.tryiton.now).
|
|
@@ -78,7 +78,7 @@ All failures throw `TryItOnError`, which carries the HTTP status code and the AP
|
|
|
78
78
|
import { TryItOn, TryItOnError } from "tryiton";
|
|
79
79
|
|
|
80
80
|
try {
|
|
81
|
-
await client.
|
|
81
|
+
await client.tryOnFashion({ /* ... */ });
|
|
82
82
|
} catch (err) {
|
|
83
83
|
if (err instanceof TryItOnError) {
|
|
84
84
|
console.error(err.status, err.errorName, err.message); // e.g. 429, "OutOfCredits"
|
package/dist/index.cjs
CHANGED
|
@@ -102,7 +102,7 @@ var TryItOn = class {
|
|
|
102
102
|
this.fetchImpl = f;
|
|
103
103
|
}
|
|
104
104
|
/** Put a garment or accessory on a person. Returns the job id. */
|
|
105
|
-
async
|
|
105
|
+
async tryOnFashion(params) {
|
|
106
106
|
const body = {
|
|
107
107
|
model_image: params.modelImage,
|
|
108
108
|
garment_image: params.garmentImage,
|
|
@@ -113,7 +113,7 @@ var TryItOn = class {
|
|
|
113
113
|
output_format: params.outputFormat,
|
|
114
114
|
moderation_level: params.moderationLevel
|
|
115
115
|
};
|
|
116
|
-
const res = await this.request("POST", "/tryon/
|
|
116
|
+
const res = await this.request("POST", "/tryon/fashion", body);
|
|
117
117
|
return res.jobId;
|
|
118
118
|
}
|
|
119
119
|
/** Restyle a person's hair. Returns the job id. */
|
package/dist/index.d.cts
CHANGED
|
@@ -34,11 +34,11 @@ interface Credits {
|
|
|
34
34
|
purchased: number;
|
|
35
35
|
reserved: number;
|
|
36
36
|
}
|
|
37
|
-
type Category = "auto" | "clothing" | "eyewear" | "footwear" | "headwear" | "jewelry" | "accessories";
|
|
37
|
+
type Category = "auto" | "clothing" | "eyewear" | "footwear" | "headwear" | "jewelry" | "accessories" | "others";
|
|
38
38
|
type Mode = "performance" | "balanced" | "quality";
|
|
39
39
|
type OutputFormat = "png" | "jpeg";
|
|
40
40
|
type ModerationLevel = "conservative" | "permissive" | "none";
|
|
41
|
-
interface
|
|
41
|
+
interface TryOnFashionParams {
|
|
42
42
|
/** URL or base64 data URL of the person. */
|
|
43
43
|
modelImage: string;
|
|
44
44
|
/** URL or base64 data URL of the garment/accessory. */
|
|
@@ -131,7 +131,7 @@ declare class TryItOn {
|
|
|
131
131
|
private readonly fetchImpl;
|
|
132
132
|
constructor(options: TryItOnOptions);
|
|
133
133
|
/** Put a garment or accessory on a person. Returns the job id. */
|
|
134
|
-
|
|
134
|
+
tryOnFashion(params: TryOnFashionParams): Promise<string>;
|
|
135
135
|
/** Restyle a person's hair. Returns the job id. */
|
|
136
136
|
tryOnHairstyle(params: TryOnHairstyleParams): Promise<string>;
|
|
137
137
|
/** Ink a design onto skin. Returns the job id. */
|
|
@@ -148,4 +148,4 @@ declare class TryItOn {
|
|
|
148
148
|
private request;
|
|
149
149
|
}
|
|
150
150
|
|
|
151
|
-
export { type Category, type Credits, type FetchLike, HAIRCUTS, type JobError, type JobStatus, type Mode, type ModerationLevel, type OutputFormat, type StatusResponse, type TattooRegion, TryItOn, TryItOnError, type TryItOnOptions, type
|
|
151
|
+
export { type Category, type Credits, type FetchLike, HAIRCUTS, type JobError, type JobStatus, type Mode, type ModerationLevel, type OutputFormat, type StatusResponse, type TattooRegion, TryItOn, TryItOnError, type TryItOnOptions, type TryOnFashionParams, type TryOnHairstyleParams, type TryOnTattooParams, type WaitOptions, TryItOn as default };
|
package/dist/index.d.ts
CHANGED
|
@@ -34,11 +34,11 @@ interface Credits {
|
|
|
34
34
|
purchased: number;
|
|
35
35
|
reserved: number;
|
|
36
36
|
}
|
|
37
|
-
type Category = "auto" | "clothing" | "eyewear" | "footwear" | "headwear" | "jewelry" | "accessories";
|
|
37
|
+
type Category = "auto" | "clothing" | "eyewear" | "footwear" | "headwear" | "jewelry" | "accessories" | "others";
|
|
38
38
|
type Mode = "performance" | "balanced" | "quality";
|
|
39
39
|
type OutputFormat = "png" | "jpeg";
|
|
40
40
|
type ModerationLevel = "conservative" | "permissive" | "none";
|
|
41
|
-
interface
|
|
41
|
+
interface TryOnFashionParams {
|
|
42
42
|
/** URL or base64 data URL of the person. */
|
|
43
43
|
modelImage: string;
|
|
44
44
|
/** URL or base64 data URL of the garment/accessory. */
|
|
@@ -131,7 +131,7 @@ declare class TryItOn {
|
|
|
131
131
|
private readonly fetchImpl;
|
|
132
132
|
constructor(options: TryItOnOptions);
|
|
133
133
|
/** Put a garment or accessory on a person. Returns the job id. */
|
|
134
|
-
|
|
134
|
+
tryOnFashion(params: TryOnFashionParams): Promise<string>;
|
|
135
135
|
/** Restyle a person's hair. Returns the job id. */
|
|
136
136
|
tryOnHairstyle(params: TryOnHairstyleParams): Promise<string>;
|
|
137
137
|
/** Ink a design onto skin. Returns the job id. */
|
|
@@ -148,4 +148,4 @@ declare class TryItOn {
|
|
|
148
148
|
private request;
|
|
149
149
|
}
|
|
150
150
|
|
|
151
|
-
export { type Category, type Credits, type FetchLike, HAIRCUTS, type JobError, type JobStatus, type Mode, type ModerationLevel, type OutputFormat, type StatusResponse, type TattooRegion, TryItOn, TryItOnError, type TryItOnOptions, type
|
|
151
|
+
export { type Category, type Credits, type FetchLike, HAIRCUTS, type JobError, type JobStatus, type Mode, type ModerationLevel, type OutputFormat, type StatusResponse, type TattooRegion, TryItOn, TryItOnError, type TryItOnOptions, type TryOnFashionParams, type TryOnHairstyleParams, type TryOnTattooParams, type WaitOptions, TryItOn as default };
|
package/dist/index.js
CHANGED
|
@@ -75,7 +75,7 @@ var TryItOn = class {
|
|
|
75
75
|
this.fetchImpl = f;
|
|
76
76
|
}
|
|
77
77
|
/** Put a garment or accessory on a person. Returns the job id. */
|
|
78
|
-
async
|
|
78
|
+
async tryOnFashion(params) {
|
|
79
79
|
const body = {
|
|
80
80
|
model_image: params.modelImage,
|
|
81
81
|
garment_image: params.garmentImage,
|
|
@@ -86,7 +86,7 @@ var TryItOn = class {
|
|
|
86
86
|
output_format: params.outputFormat,
|
|
87
87
|
moderation_level: params.moderationLevel
|
|
88
88
|
};
|
|
89
|
-
const res = await this.request("POST", "/tryon/
|
|
89
|
+
const res = await this.request("POST", "/tryon/fashion", body);
|
|
90
90
|
return res.jobId;
|
|
91
91
|
}
|
|
92
92
|
/** Restyle a person's hair. Returns the job id. */
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -50,7 +50,8 @@ export type Category =
|
|
|
50
50
|
| "footwear"
|
|
51
51
|
| "headwear"
|
|
52
52
|
| "jewelry"
|
|
53
|
-
| "accessories"
|
|
53
|
+
| "accessories"
|
|
54
|
+
| "others";
|
|
54
55
|
|
|
55
56
|
export type Mode = "performance" | "balanced" | "quality";
|
|
56
57
|
|
|
@@ -58,7 +59,7 @@ export type OutputFormat = "png" | "jpeg";
|
|
|
58
59
|
|
|
59
60
|
export type ModerationLevel = "conservative" | "permissive" | "none";
|
|
60
61
|
|
|
61
|
-
export interface
|
|
62
|
+
export interface TryOnFashionParams {
|
|
62
63
|
/** URL or base64 data URL of the person. */
|
|
63
64
|
modelImage: string;
|
|
64
65
|
/** URL or base64 data URL of the garment/accessory. */
|
|
@@ -199,7 +200,7 @@ export class TryItOn {
|
|
|
199
200
|
}
|
|
200
201
|
|
|
201
202
|
/** Put a garment or accessory on a person. Returns the job id. */
|
|
202
|
-
async
|
|
203
|
+
async tryOnFashion(params: TryOnFashionParams): Promise<string> {
|
|
203
204
|
const body = {
|
|
204
205
|
model_image: params.modelImage,
|
|
205
206
|
garment_image: params.garmentImage,
|
|
@@ -210,7 +211,7 @@ export class TryItOn {
|
|
|
210
211
|
output_format: params.outputFormat,
|
|
211
212
|
moderation_level: params.moderationLevel,
|
|
212
213
|
};
|
|
213
|
-
const res = await this.request<{ jobId: string }>("POST", "/tryon/
|
|
214
|
+
const res = await this.request<{ jobId: string }>("POST", "/tryon/fashion", body);
|
|
214
215
|
return res.jobId;
|
|
215
216
|
}
|
|
216
217
|
|