opencomic-ai-bin 1.0.0 → 1.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.
- package/README.md +12 -3
- package/dist/calculate-latency.mjs +3 -3
- package/dist/index.cjs +3 -3
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +3 -3
- package/index.mts +5 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -125,6 +125,7 @@ OpenComicAI.model(model: Model): ModelObject
|
|
|
125
125
|
```
|
|
126
126
|
|
|
127
127
|
### OpenComicAI.pipeline
|
|
128
|
+
|
|
128
129
|
Process an image through one or more AI models.
|
|
129
130
|
|
|
130
131
|
```ts
|
|
@@ -137,6 +138,14 @@ OpenComicAI.pipeline(
|
|
|
137
138
|
): Promise<string>
|
|
138
139
|
```
|
|
139
140
|
|
|
141
|
+
### OpenComicAI.closest
|
|
142
|
+
|
|
143
|
+
Returns the value in the array closest to the target value.
|
|
144
|
+
|
|
145
|
+
```ts
|
|
146
|
+
OpenComicAI.closest(array: number[], target: number): number
|
|
147
|
+
```
|
|
148
|
+
|
|
140
149
|
## Types
|
|
141
150
|
|
|
142
151
|
### `Model`
|
|
@@ -163,14 +172,14 @@ type Upscaler = 'realcugan' | 'upscayl' | 'waifu2x';
|
|
|
163
172
|
### `Speed`
|
|
164
173
|
|
|
165
174
|
```typescript
|
|
166
|
-
type Speed = 'Very Fast' | 'Fast' | '
|
|
175
|
+
type Speed = 'Very Fast' | 'Fast' | 'Medium' | 'Slow' | 'Very Slow';
|
|
167
176
|
```
|
|
168
177
|
|
|
169
178
|
### `OpenComicAIOptions`
|
|
170
179
|
|
|
171
180
|
```typescript
|
|
172
181
|
interface OpenComicAIOptions {
|
|
173
|
-
model?: Model
|
|
182
|
+
model?: Model;
|
|
174
183
|
noise?: 0 | 1 | 2 | 3;
|
|
175
184
|
scale?: number;
|
|
176
185
|
tileSize?: number;
|
|
@@ -190,7 +199,7 @@ interface ModelObject {
|
|
|
190
199
|
type?: ModelType;
|
|
191
200
|
scales: number[];
|
|
192
201
|
noise: number[] | undefined;
|
|
193
|
-
latency: number;
|
|
202
|
+
latency: number; // From 0.5 (Fatest model) to 10 (Slowest model)
|
|
194
203
|
speed?: Speed;
|
|
195
204
|
folder: string;
|
|
196
205
|
path?: string;
|
|
@@ -164,7 +164,7 @@ let models = {
|
|
|
164
164
|
'waifu2x-models-cunet': {
|
|
165
165
|
name: 'Waifu2x CUnet',
|
|
166
166
|
upscaler: 'waifu2x',
|
|
167
|
-
scales: [1, 2, 4, 8, 16, 32],
|
|
167
|
+
scales: [/*1, */ 2, 4, 8, 16, 32],
|
|
168
168
|
noise: [0, 1, 2, 3],
|
|
169
169
|
latency: 2.92,
|
|
170
170
|
folder: './waifu2x/models-cunet',
|
|
@@ -192,7 +192,7 @@ let models = {
|
|
|
192
192
|
'waifu2x-models-upconv': {
|
|
193
193
|
name: 'Waifu2x UpConv',
|
|
194
194
|
upscaler: 'waifu2x',
|
|
195
|
-
scales: [1, 2, 4, 8, 16, 32],
|
|
195
|
+
scales: [/*1, */ 2, 4, 8, 16, 32],
|
|
196
196
|
noise: [0, 1, 2, 3],
|
|
197
197
|
latency: 0.8,
|
|
198
198
|
folder: './waifu2x/models-upconv_7_anime_style_art_rgb',
|
|
@@ -449,7 +449,7 @@ const modelSpeed = (latency) => {
|
|
|
449
449
|
else if (latency <= 4)
|
|
450
450
|
return 'Fast';
|
|
451
451
|
else if (latency <= 7)
|
|
452
|
-
return '
|
|
452
|
+
return 'Medium';
|
|
453
453
|
else if (latency <= 10)
|
|
454
454
|
return 'Slow';
|
|
455
455
|
else
|
package/dist/index.cjs
CHANGED
|
@@ -166,7 +166,7 @@ let models = {
|
|
|
166
166
|
'waifu2x-models-cunet': {
|
|
167
167
|
name: 'Waifu2x CUnet',
|
|
168
168
|
upscaler: 'waifu2x',
|
|
169
|
-
scales: [1, 2, 4, 8, 16, 32],
|
|
169
|
+
scales: [/*1, */ 2, 4, 8, 16, 32],
|
|
170
170
|
noise: [0, 1, 2, 3],
|
|
171
171
|
latency: 2.92,
|
|
172
172
|
folder: './waifu2x/models-cunet',
|
|
@@ -194,7 +194,7 @@ let models = {
|
|
|
194
194
|
'waifu2x-models-upconv': {
|
|
195
195
|
name: 'Waifu2x UpConv',
|
|
196
196
|
upscaler: 'waifu2x',
|
|
197
|
-
scales: [1, 2, 4, 8, 16, 32],
|
|
197
|
+
scales: [/*1, */ 2, 4, 8, 16, 32],
|
|
198
198
|
noise: [0, 1, 2, 3],
|
|
199
199
|
latency: 0.8,
|
|
200
200
|
folder: './waifu2x/models-upconv_7_anime_style_art_rgb',
|
|
@@ -451,7 +451,7 @@ const modelSpeed = (latency) => {
|
|
|
451
451
|
else if (latency <= 4)
|
|
452
452
|
return 'Fast';
|
|
453
453
|
else if (latency <= 7)
|
|
454
|
-
return '
|
|
454
|
+
return 'Medium';
|
|
455
455
|
else if (latency <= 10)
|
|
456
456
|
return 'Slow';
|
|
457
457
|
else
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
type Formats = 'bmp' | 'dib' | 'exr' | 'hdr' | 'jpe' | 'jpeg' | 'jpg' | 'pbm' | 'pgm' | 'pic' | 'png' | 'pnm' | 'ppm' | 'pxm' | 'ras' | 'sr' | 'tif' | 'tiff' | 'webp';
|
|
2
2
|
type ModelType = 'upscale' | 'descreen' | 'artifact-removal';
|
|
3
3
|
type Upscaler = 'realcugan' | 'waifu2x' | 'upscayl';
|
|
4
|
-
type Speed = 'Very Fast' | 'Fast' | '
|
|
4
|
+
type Speed = 'Very Fast' | 'Fast' | 'Medium' | 'Slow' | 'Very Slow';
|
|
5
5
|
interface UpscalerObject {
|
|
6
6
|
name: string;
|
|
7
7
|
binary: string;
|
|
@@ -49,7 +49,7 @@ declare class OpenComicAI {
|
|
|
49
49
|
private static download;
|
|
50
50
|
private static getModels;
|
|
51
51
|
static pipeline: (source: string, dest: string, steps: OpenComicAIOptions[], progress?: ((progress?: number) => void) | false, downloading?: Downloading | false) => Promise<string>;
|
|
52
|
-
|
|
52
|
+
static closest: (array: number[], target: number) => number;
|
|
53
53
|
private static image;
|
|
54
54
|
}
|
|
55
55
|
|
package/dist/index.mjs
CHANGED
|
@@ -164,7 +164,7 @@ let models = {
|
|
|
164
164
|
'waifu2x-models-cunet': {
|
|
165
165
|
name: 'Waifu2x CUnet',
|
|
166
166
|
upscaler: 'waifu2x',
|
|
167
|
-
scales: [1, 2, 4, 8, 16, 32],
|
|
167
|
+
scales: [/*1, */ 2, 4, 8, 16, 32],
|
|
168
168
|
noise: [0, 1, 2, 3],
|
|
169
169
|
latency: 2.92,
|
|
170
170
|
folder: './waifu2x/models-cunet',
|
|
@@ -192,7 +192,7 @@ let models = {
|
|
|
192
192
|
'waifu2x-models-upconv': {
|
|
193
193
|
name: 'Waifu2x UpConv',
|
|
194
194
|
upscaler: 'waifu2x',
|
|
195
|
-
scales: [1, 2, 4, 8, 16, 32],
|
|
195
|
+
scales: [/*1, */ 2, 4, 8, 16, 32],
|
|
196
196
|
noise: [0, 1, 2, 3],
|
|
197
197
|
latency: 0.8,
|
|
198
198
|
folder: './waifu2x/models-upconv_7_anime_style_art_rgb',
|
|
@@ -449,7 +449,7 @@ const modelSpeed = (latency) => {
|
|
|
449
449
|
else if (latency <= 4)
|
|
450
450
|
return 'Fast';
|
|
451
451
|
else if (latency <= 7)
|
|
452
|
-
return '
|
|
452
|
+
return 'Medium';
|
|
453
453
|
else if (latency <= 10)
|
|
454
454
|
return 'Slow';
|
|
455
455
|
else
|
package/index.mts
CHANGED
|
@@ -29,7 +29,7 @@ export type Formats =
|
|
|
29
29
|
|
|
30
30
|
export type ModelType = 'upscale' | 'descreen' | 'artifact-removal';
|
|
31
31
|
export type Upscaler = 'realcugan' | 'waifu2x' | 'upscayl';
|
|
32
|
-
export type Speed = 'Very Fast' | 'Fast' | '
|
|
32
|
+
export type Speed = 'Very Fast' | 'Fast' | 'Medium' | 'Slow' | 'Very Slow';
|
|
33
33
|
|
|
34
34
|
export interface UpscalerObject {
|
|
35
35
|
name: string;
|
|
@@ -212,7 +212,7 @@ let models: Record<ModelType, Record<string, ModelObject>> = {
|
|
|
212
212
|
'waifu2x-models-cunet': {
|
|
213
213
|
name: 'Waifu2x CUnet',
|
|
214
214
|
upscaler: 'waifu2x',
|
|
215
|
-
scales: [1, 2, 4, 8, 16, 32],
|
|
215
|
+
scales: [/*1, */2, 4, 8, 16, 32],
|
|
216
216
|
noise: [0, 1, 2, 3],
|
|
217
217
|
latency: 2.92,
|
|
218
218
|
folder: './waifu2x/models-cunet',
|
|
@@ -240,7 +240,7 @@ let models: Record<ModelType, Record<string, ModelObject>> = {
|
|
|
240
240
|
'waifu2x-models-upconv': {
|
|
241
241
|
name: 'Waifu2x UpConv',
|
|
242
242
|
upscaler: 'waifu2x',
|
|
243
|
-
scales: [1, 2, 4, 8, 16, 32],
|
|
243
|
+
scales: [/*1, */2, 4, 8, 16, 32],
|
|
244
244
|
noise: [0, 1, 2, 3],
|
|
245
245
|
latency: 0.8,
|
|
246
246
|
folder: './waifu2x/models-upconv_7_anime_style_art_rgb',
|
|
@@ -499,7 +499,7 @@ const modelSpeed = (latency: number): Speed => {
|
|
|
499
499
|
else if(latency <= 4)
|
|
500
500
|
return 'Fast';
|
|
501
501
|
else if(latency <= 7)
|
|
502
|
-
return '
|
|
502
|
+
return 'Medium';
|
|
503
503
|
else if(latency <= 10)
|
|
504
504
|
return 'Slow';
|
|
505
505
|
else
|
|
@@ -787,7 +787,7 @@ export default class OpenComicAI {
|
|
|
787
787
|
|
|
788
788
|
}
|
|
789
789
|
|
|
790
|
-
|
|
790
|
+
public static closest = (array: number[], target: number): number => {
|
|
791
791
|
|
|
792
792
|
return array.reduce((prev, curr) => {
|
|
793
793
|
return Math.abs(curr - target) < Math.abs(prev - target) ? curr : prev;
|