opencomic-ai-bin 1.0.2 → 1.0.4
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 +23 -0
- package/dist/calculate-latency.mjs +53 -1
- package/dist/index.cjs +53 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.mjs +53 -1
- package/index.mts +56 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -31,6 +31,9 @@ import OpenComicAI from 'opencomic-ai-bin';
|
|
|
31
31
|
|
|
32
32
|
(async () => {
|
|
33
33
|
|
|
34
|
+
// Set the base directory for binary paths, for example change to app.asar.unpacked path in Electron apps
|
|
35
|
+
OpenComicAI.setDirname(OpenComicAI.__dirname.replace(/app(-(?:arm64|x64))?\.asar/, 'app$1.asar.unpacked'));
|
|
36
|
+
|
|
34
37
|
// Models path, if the model is not found in this folder, it will be downloaded
|
|
35
38
|
OpenComicAI.setModelsPath('./models');
|
|
36
39
|
|
|
@@ -68,6 +71,14 @@ import OpenComicAI from 'opencomic-ai-bin';
|
|
|
68
71
|
})();
|
|
69
72
|
```
|
|
70
73
|
|
|
74
|
+
### OpenComicAI.setDirname
|
|
75
|
+
|
|
76
|
+
Set the base directory for binary paths.
|
|
77
|
+
|
|
78
|
+
```ts
|
|
79
|
+
OpenComicAI.setDirname(dirname: string): void
|
|
80
|
+
```
|
|
81
|
+
|
|
71
82
|
### OpenComicAI.setModelsPath
|
|
72
83
|
|
|
73
84
|
Set the directory where models will be downloaded and stored.
|
|
@@ -76,6 +87,14 @@ Set the directory where models will be downloaded and stored.
|
|
|
76
87
|
OpenComicAI.setModelsPath(path: string): void
|
|
77
88
|
```
|
|
78
89
|
|
|
90
|
+
### OpenComicAI.\_\_dirname
|
|
91
|
+
|
|
92
|
+
Get the base directory for binary paths.
|
|
93
|
+
|
|
94
|
+
```ts
|
|
95
|
+
OpenComicAI.__dirname: string
|
|
96
|
+
```
|
|
97
|
+
|
|
79
98
|
### OpenComicAI.models
|
|
80
99
|
|
|
81
100
|
Object containing all available models organized by type (upscale, descreen, artifact-removal).
|
|
@@ -227,6 +246,7 @@ Model | Name | Upscaler | Source
|
|
|
227
246
|
`1x_NMKD-Jaywreck3-Lite_320k` | NMKD Jaywreck3 Lite | `upscayl` | [NMKD.de](https://nmkd.de/?esrgan)
|
|
228
247
|
`1x_NMKD-Jaywreck3-Soft-Lite_320k` | NMKD Jaywreck3 Soft Lite | `upscayl` | [NMKD.de](https://nmkd.de/?esrgan)
|
|
229
248
|
`1x-SaiyaJin-DeJpeg` | SaiyaJin DeJpeg | `upscayl` | [OpenModelDB](https://openmodeldb.info/models/1x-SaiyaJin-DeJpeg)
|
|
249
|
+
`1x_JPEGDestroyerV2_96000G` | JPEG Destroyer V2 | `upscayl` | [Hugging Face](https://huggingface.co/utnah/esrgan)
|
|
230
250
|
|
|
231
251
|
### Descreen
|
|
232
252
|
|
|
@@ -250,6 +270,9 @@ Model | Name | Upscaler | Source
|
|
|
250
270
|
`remacri-4x` | Remacri | `upscayl` | [upscayl/upscayl](https://github.com/upscayl/upscayl/tree/d6e9a36b894d302e6268dc239e8a51ff29c49ded/resources/models)
|
|
251
271
|
`ultramix-balanced-4x` | Ultramix Balanced | `upscayl` | [upscayl/upscayl](https://github.com/upscayl/upscayl/tree/d6e9a36b894d302e6268dc239e8a51ff29c49ded/resources/models)
|
|
252
272
|
`ultrasharp-4x` | Ultrasharp | `upscayl` | [upscayl/upscayl](https://github.com/upscayl/upscayl/tree/d6e9a36b894d302e6268dc239e8a51ff29c49ded/resources/models)
|
|
273
|
+
`4xInt-RemAnime` | Int-RemAnime | `upscayl` | [Phhofm/models](https://github.com/Phhofm/models)
|
|
274
|
+
`AI-Forever_x4plus` | AI-Forever x4plus | `upscayl` | [Hugging Face](https://huggingface.co/leonelhs/realesrgan)
|
|
275
|
+
`4xNomosWebPhoto_esrgan` | Nomos Web Photo ESRGAN | `upscayl` | [OpenModelDB](https://openmodeldb.info/models/4x-NomosWebPhoto-esrgan)
|
|
253
276
|
`4xHFA2k` | HFA2k | `upscayl` | [upscayl/custom-models](https://github.com/upscayl/custom-models/tree/4b6d2cfa59c7442af115dfc6e50fd8d7d40b96ef/models)
|
|
254
277
|
`4xLSDIRCompactC3` | LSDIR Compact C3 | `upscayl` | [upscayl/custom-models](https://github.com/upscayl/custom-models/tree/4b6d2cfa59c7442af115dfc6e50fd8d7d40b96ef/models)
|
|
255
278
|
`4xLSDIRplusC` | LSDIR Plus C | `upscayl` | [upscayl/custom-models](https://github.com/upscayl/custom-models/tree/4b6d2cfa59c7442af115dfc6e50fd8d7d40b96ef/models)
|
|
@@ -269,6 +269,42 @@ let models = {
|
|
|
269
269
|
'2x-AnimeSharpV4_RCAN_fp16_op17.param',
|
|
270
270
|
],
|
|
271
271
|
},*/
|
|
272
|
+
'4xInt-RemAnime': {
|
|
273
|
+
name: 'Int-RemAnime',
|
|
274
|
+
upscaler: 'upscayl',
|
|
275
|
+
scales: [2, 3, 4],
|
|
276
|
+
noise: undefined,
|
|
277
|
+
latency: 7.26,
|
|
278
|
+
folder: './models',
|
|
279
|
+
files: [
|
|
280
|
+
'4xInt-RemAnime.bin',
|
|
281
|
+
'4xInt-RemAnime.param',
|
|
282
|
+
],
|
|
283
|
+
},
|
|
284
|
+
'AI-Forever_x4plus': {
|
|
285
|
+
name: 'AI-Forever x4plus',
|
|
286
|
+
upscaler: 'upscayl',
|
|
287
|
+
scales: [2, 3, 4],
|
|
288
|
+
noise: undefined,
|
|
289
|
+
latency: 7.77,
|
|
290
|
+
folder: './models',
|
|
291
|
+
files: [
|
|
292
|
+
'AI-Forever_x4plus.bin',
|
|
293
|
+
'AI-Forever_x4plus.param',
|
|
294
|
+
],
|
|
295
|
+
},
|
|
296
|
+
'4xNomosWebPhoto_esrgan': {
|
|
297
|
+
name: 'Nomos Web Photo ESRGAN',
|
|
298
|
+
upscaler: 'upscayl',
|
|
299
|
+
scales: [2, 3, 4],
|
|
300
|
+
noise: undefined,
|
|
301
|
+
latency: 7.29,
|
|
302
|
+
folder: './models',
|
|
303
|
+
files: [
|
|
304
|
+
'4xNomosWebPhoto_esrgan.bin',
|
|
305
|
+
'4xNomosWebPhoto_esrgan.param',
|
|
306
|
+
],
|
|
307
|
+
},
|
|
272
308
|
'4xHFA2k': {
|
|
273
309
|
name: 'HFA2k',
|
|
274
310
|
upscaler: 'upscayl',
|
|
@@ -441,6 +477,18 @@ let models = {
|
|
|
441
477
|
'1x-SaiyaJin-DeJpeg.param',
|
|
442
478
|
],
|
|
443
479
|
},
|
|
480
|
+
'1x_JPEGDestroyerV2_96000G': {
|
|
481
|
+
name: 'JPEG Destroyer V2',
|
|
482
|
+
upscaler: 'upscayl',
|
|
483
|
+
scales: [1],
|
|
484
|
+
noise: undefined,
|
|
485
|
+
latency: 6.37,
|
|
486
|
+
folder: './models',
|
|
487
|
+
files: [
|
|
488
|
+
'1x_JPEGDestroyerV2_96000G.bin',
|
|
489
|
+
'1x_JPEGDestroyerV2_96000G.param',
|
|
490
|
+
],
|
|
491
|
+
},
|
|
444
492
|
},
|
|
445
493
|
};
|
|
446
494
|
const modelSpeed = (latency) => {
|
|
@@ -486,6 +534,7 @@ class OpenComicAI {
|
|
|
486
534
|
static modelsList = modelsList;
|
|
487
535
|
static modelsTypeList = modelsTypeList;
|
|
488
536
|
static modelsPath = undefined;
|
|
537
|
+
static __dirname = ___dirname;
|
|
489
538
|
static resolve = (path) => {
|
|
490
539
|
if (!p.isAbsolute(path)) {
|
|
491
540
|
if (typeof module !== 'undefined')
|
|
@@ -501,6 +550,9 @@ class OpenComicAI {
|
|
|
501
550
|
throw new Error(`Models path does not exist: ${path}`);
|
|
502
551
|
OpenComicAI.modelsPath = path;
|
|
503
552
|
};
|
|
553
|
+
static setDirname = (dirname) => {
|
|
554
|
+
OpenComicAI.__dirname = OpenComicAI.resolve(dirname);
|
|
555
|
+
};
|
|
504
556
|
static model = (model = DEFAULT_MODEL) => {
|
|
505
557
|
if (!modelsList.includes(model))
|
|
506
558
|
throw new Error(`Model not found: ${model}`);
|
|
@@ -515,7 +567,7 @@ class OpenComicAI {
|
|
|
515
567
|
static binary = (model) => {
|
|
516
568
|
if (!modelsList.includes(model))
|
|
517
569
|
throw new Error(`Model not found: ${model}`);
|
|
518
|
-
const base = p.join(
|
|
570
|
+
const base = p.join(OpenComicAI.__dirname, '..');
|
|
519
571
|
const upscaler = OpenComicAI.model(model).upscaler;
|
|
520
572
|
const result = upscalers[upscaler].platforms[process.platform]?.[process.arch] ?? upscalers[upscaler].platforms[process.platform]?.x64 ?? upscalers[upscaler].platforms.linux?.x64 ?? '';
|
|
521
573
|
return p.join(base, result);
|
package/dist/index.cjs
CHANGED
|
@@ -271,6 +271,42 @@ let models = {
|
|
|
271
271
|
'2x-AnimeSharpV4_RCAN_fp16_op17.param',
|
|
272
272
|
],
|
|
273
273
|
},*/
|
|
274
|
+
'4xInt-RemAnime': {
|
|
275
|
+
name: 'Int-RemAnime',
|
|
276
|
+
upscaler: 'upscayl',
|
|
277
|
+
scales: [2, 3, 4],
|
|
278
|
+
noise: undefined,
|
|
279
|
+
latency: 7.26,
|
|
280
|
+
folder: './models',
|
|
281
|
+
files: [
|
|
282
|
+
'4xInt-RemAnime.bin',
|
|
283
|
+
'4xInt-RemAnime.param',
|
|
284
|
+
],
|
|
285
|
+
},
|
|
286
|
+
'AI-Forever_x4plus': {
|
|
287
|
+
name: 'AI-Forever x4plus',
|
|
288
|
+
upscaler: 'upscayl',
|
|
289
|
+
scales: [2, 3, 4],
|
|
290
|
+
noise: undefined,
|
|
291
|
+
latency: 7.77,
|
|
292
|
+
folder: './models',
|
|
293
|
+
files: [
|
|
294
|
+
'AI-Forever_x4plus.bin',
|
|
295
|
+
'AI-Forever_x4plus.param',
|
|
296
|
+
],
|
|
297
|
+
},
|
|
298
|
+
'4xNomosWebPhoto_esrgan': {
|
|
299
|
+
name: 'Nomos Web Photo ESRGAN',
|
|
300
|
+
upscaler: 'upscayl',
|
|
301
|
+
scales: [2, 3, 4],
|
|
302
|
+
noise: undefined,
|
|
303
|
+
latency: 7.29,
|
|
304
|
+
folder: './models',
|
|
305
|
+
files: [
|
|
306
|
+
'4xNomosWebPhoto_esrgan.bin',
|
|
307
|
+
'4xNomosWebPhoto_esrgan.param',
|
|
308
|
+
],
|
|
309
|
+
},
|
|
274
310
|
'4xHFA2k': {
|
|
275
311
|
name: 'HFA2k',
|
|
276
312
|
upscaler: 'upscayl',
|
|
@@ -443,6 +479,18 @@ let models = {
|
|
|
443
479
|
'1x-SaiyaJin-DeJpeg.param',
|
|
444
480
|
],
|
|
445
481
|
},
|
|
482
|
+
'1x_JPEGDestroyerV2_96000G': {
|
|
483
|
+
name: 'JPEG Destroyer V2',
|
|
484
|
+
upscaler: 'upscayl',
|
|
485
|
+
scales: [1],
|
|
486
|
+
noise: undefined,
|
|
487
|
+
latency: 6.37,
|
|
488
|
+
folder: './models',
|
|
489
|
+
files: [
|
|
490
|
+
'1x_JPEGDestroyerV2_96000G.bin',
|
|
491
|
+
'1x_JPEGDestroyerV2_96000G.param',
|
|
492
|
+
],
|
|
493
|
+
},
|
|
446
494
|
},
|
|
447
495
|
};
|
|
448
496
|
const modelSpeed = (latency) => {
|
|
@@ -488,6 +536,7 @@ class OpenComicAI {
|
|
|
488
536
|
static modelsList = modelsList;
|
|
489
537
|
static modelsTypeList = modelsTypeList;
|
|
490
538
|
static modelsPath = undefined;
|
|
539
|
+
static __dirname = ___dirname;
|
|
491
540
|
static resolve = (path) => {
|
|
492
541
|
if (!p.isAbsolute(path)) {
|
|
493
542
|
if (typeof module !== 'undefined')
|
|
@@ -503,6 +552,9 @@ class OpenComicAI {
|
|
|
503
552
|
throw new Error(`Models path does not exist: ${path}`);
|
|
504
553
|
OpenComicAI.modelsPath = path;
|
|
505
554
|
};
|
|
555
|
+
static setDirname = (dirname) => {
|
|
556
|
+
OpenComicAI.__dirname = OpenComicAI.resolve(dirname);
|
|
557
|
+
};
|
|
506
558
|
static model = (model = DEFAULT_MODEL) => {
|
|
507
559
|
if (!modelsList.includes(model))
|
|
508
560
|
throw new Error(`Model not found: ${model}`);
|
|
@@ -517,7 +569,7 @@ class OpenComicAI {
|
|
|
517
569
|
static binary = (model) => {
|
|
518
570
|
if (!modelsList.includes(model))
|
|
519
571
|
throw new Error(`Model not found: ${model}`);
|
|
520
|
-
const base = p.join(
|
|
572
|
+
const base = p.join(OpenComicAI.__dirname, '..');
|
|
521
573
|
const upscaler = OpenComicAI.model(model).upscaler;
|
|
522
574
|
const result = upscalers[upscaler].platforms[process.platform]?.[process.arch] ?? upscalers[upscaler].platforms[process.platform]?.x64 ?? upscalers[upscaler].platforms.linux?.x64 ?? '';
|
|
523
575
|
return p.join(base, result);
|
package/dist/index.d.ts
CHANGED
|
@@ -42,8 +42,10 @@ declare class OpenComicAI {
|
|
|
42
42
|
static modelsList: string[];
|
|
43
43
|
static modelsTypeList: Record<ModelType, string[]>;
|
|
44
44
|
static modelsPath: string | undefined;
|
|
45
|
+
static __dirname: any;
|
|
45
46
|
private static resolve;
|
|
46
47
|
static setModelsPath: (path: string) => void;
|
|
48
|
+
static setDirname: (dirname: string) => void;
|
|
47
49
|
static model: (model?: Model) => ModelObject;
|
|
48
50
|
static binary: (model: Model) => string;
|
|
49
51
|
private static download;
|
package/dist/index.mjs
CHANGED
|
@@ -269,6 +269,42 @@ let models = {
|
|
|
269
269
|
'2x-AnimeSharpV4_RCAN_fp16_op17.param',
|
|
270
270
|
],
|
|
271
271
|
},*/
|
|
272
|
+
'4xInt-RemAnime': {
|
|
273
|
+
name: 'Int-RemAnime',
|
|
274
|
+
upscaler: 'upscayl',
|
|
275
|
+
scales: [2, 3, 4],
|
|
276
|
+
noise: undefined,
|
|
277
|
+
latency: 7.26,
|
|
278
|
+
folder: './models',
|
|
279
|
+
files: [
|
|
280
|
+
'4xInt-RemAnime.bin',
|
|
281
|
+
'4xInt-RemAnime.param',
|
|
282
|
+
],
|
|
283
|
+
},
|
|
284
|
+
'AI-Forever_x4plus': {
|
|
285
|
+
name: 'AI-Forever x4plus',
|
|
286
|
+
upscaler: 'upscayl',
|
|
287
|
+
scales: [2, 3, 4],
|
|
288
|
+
noise: undefined,
|
|
289
|
+
latency: 7.77,
|
|
290
|
+
folder: './models',
|
|
291
|
+
files: [
|
|
292
|
+
'AI-Forever_x4plus.bin',
|
|
293
|
+
'AI-Forever_x4plus.param',
|
|
294
|
+
],
|
|
295
|
+
},
|
|
296
|
+
'4xNomosWebPhoto_esrgan': {
|
|
297
|
+
name: 'Nomos Web Photo ESRGAN',
|
|
298
|
+
upscaler: 'upscayl',
|
|
299
|
+
scales: [2, 3, 4],
|
|
300
|
+
noise: undefined,
|
|
301
|
+
latency: 7.29,
|
|
302
|
+
folder: './models',
|
|
303
|
+
files: [
|
|
304
|
+
'4xNomosWebPhoto_esrgan.bin',
|
|
305
|
+
'4xNomosWebPhoto_esrgan.param',
|
|
306
|
+
],
|
|
307
|
+
},
|
|
272
308
|
'4xHFA2k': {
|
|
273
309
|
name: 'HFA2k',
|
|
274
310
|
upscaler: 'upscayl',
|
|
@@ -441,6 +477,18 @@ let models = {
|
|
|
441
477
|
'1x-SaiyaJin-DeJpeg.param',
|
|
442
478
|
],
|
|
443
479
|
},
|
|
480
|
+
'1x_JPEGDestroyerV2_96000G': {
|
|
481
|
+
name: 'JPEG Destroyer V2',
|
|
482
|
+
upscaler: 'upscayl',
|
|
483
|
+
scales: [1],
|
|
484
|
+
noise: undefined,
|
|
485
|
+
latency: 6.37,
|
|
486
|
+
folder: './models',
|
|
487
|
+
files: [
|
|
488
|
+
'1x_JPEGDestroyerV2_96000G.bin',
|
|
489
|
+
'1x_JPEGDestroyerV2_96000G.param',
|
|
490
|
+
],
|
|
491
|
+
},
|
|
444
492
|
},
|
|
445
493
|
};
|
|
446
494
|
const modelSpeed = (latency) => {
|
|
@@ -486,6 +534,7 @@ class OpenComicAI {
|
|
|
486
534
|
static modelsList = modelsList;
|
|
487
535
|
static modelsTypeList = modelsTypeList;
|
|
488
536
|
static modelsPath = undefined;
|
|
537
|
+
static __dirname = ___dirname;
|
|
489
538
|
static resolve = (path) => {
|
|
490
539
|
if (!p.isAbsolute(path)) {
|
|
491
540
|
if (typeof module !== 'undefined')
|
|
@@ -501,6 +550,9 @@ class OpenComicAI {
|
|
|
501
550
|
throw new Error(`Models path does not exist: ${path}`);
|
|
502
551
|
OpenComicAI.modelsPath = path;
|
|
503
552
|
};
|
|
553
|
+
static setDirname = (dirname) => {
|
|
554
|
+
OpenComicAI.__dirname = OpenComicAI.resolve(dirname);
|
|
555
|
+
};
|
|
504
556
|
static model = (model = DEFAULT_MODEL) => {
|
|
505
557
|
if (!modelsList.includes(model))
|
|
506
558
|
throw new Error(`Model not found: ${model}`);
|
|
@@ -515,7 +567,7 @@ class OpenComicAI {
|
|
|
515
567
|
static binary = (model) => {
|
|
516
568
|
if (!modelsList.includes(model))
|
|
517
569
|
throw new Error(`Model not found: ${model}`);
|
|
518
|
-
const base = p.join(
|
|
570
|
+
const base = p.join(OpenComicAI.__dirname, '..');
|
|
519
571
|
const upscaler = OpenComicAI.model(model).upscaler;
|
|
520
572
|
const result = upscalers[upscaler].platforms[process.platform]?.[process.arch] ?? upscalers[upscaler].platforms[process.platform]?.x64 ?? upscalers[upscaler].platforms.linux?.x64 ?? '';
|
|
521
573
|
return p.join(base, result);
|
package/index.mts
CHANGED
|
@@ -317,6 +317,42 @@ let models: Record<ModelType, Record<string, ModelObject>> = {
|
|
|
317
317
|
'2x-AnimeSharpV4_RCAN_fp16_op17.param',
|
|
318
318
|
],
|
|
319
319
|
},*/
|
|
320
|
+
'4xInt-RemAnime': {
|
|
321
|
+
name: 'Int-RemAnime',
|
|
322
|
+
upscaler: 'upscayl',
|
|
323
|
+
scales: [2, 3, 4],
|
|
324
|
+
noise: undefined,
|
|
325
|
+
latency: 7.26,
|
|
326
|
+
folder: './models',
|
|
327
|
+
files: [
|
|
328
|
+
'4xInt-RemAnime.bin',
|
|
329
|
+
'4xInt-RemAnime.param',
|
|
330
|
+
],
|
|
331
|
+
},
|
|
332
|
+
'AI-Forever_x4plus': {
|
|
333
|
+
name: 'AI-Forever x4plus',
|
|
334
|
+
upscaler: 'upscayl',
|
|
335
|
+
scales: [2, 3, 4],
|
|
336
|
+
noise: undefined,
|
|
337
|
+
latency: 7.77,
|
|
338
|
+
folder: './models',
|
|
339
|
+
files: [
|
|
340
|
+
'AI-Forever_x4plus.bin',
|
|
341
|
+
'AI-Forever_x4plus.param',
|
|
342
|
+
],
|
|
343
|
+
},
|
|
344
|
+
'4xNomosWebPhoto_esrgan': {
|
|
345
|
+
name: 'Nomos Web Photo ESRGAN',
|
|
346
|
+
upscaler: 'upscayl',
|
|
347
|
+
scales: [2, 3, 4],
|
|
348
|
+
noise: undefined,
|
|
349
|
+
latency: 7.29,
|
|
350
|
+
folder: './models',
|
|
351
|
+
files: [
|
|
352
|
+
'4xNomosWebPhoto_esrgan.bin',
|
|
353
|
+
'4xNomosWebPhoto_esrgan.param',
|
|
354
|
+
],
|
|
355
|
+
},
|
|
320
356
|
'4xHFA2k': {
|
|
321
357
|
name: 'HFA2k',
|
|
322
358
|
upscaler: 'upscayl',
|
|
@@ -489,6 +525,18 @@ let models: Record<ModelType, Record<string, ModelObject>> = {
|
|
|
489
525
|
'1x-SaiyaJin-DeJpeg.param',
|
|
490
526
|
],
|
|
491
527
|
},
|
|
528
|
+
'1x_JPEGDestroyerV2_96000G': {
|
|
529
|
+
name: 'JPEG Destroyer V2',
|
|
530
|
+
upscaler: 'upscayl',
|
|
531
|
+
scales: [1],
|
|
532
|
+
noise: undefined,
|
|
533
|
+
latency: 6.37,
|
|
534
|
+
folder: './models',
|
|
535
|
+
files: [
|
|
536
|
+
'1x_JPEGDestroyerV2_96000G.bin',
|
|
537
|
+
'1x_JPEGDestroyerV2_96000G.param',
|
|
538
|
+
],
|
|
539
|
+
},
|
|
492
540
|
},
|
|
493
541
|
};
|
|
494
542
|
|
|
@@ -566,6 +614,7 @@ export default class OpenComicAI {
|
|
|
566
614
|
public static modelsList = modelsList;
|
|
567
615
|
public static modelsTypeList = modelsTypeList;
|
|
568
616
|
public static modelsPath: string | undefined = undefined;
|
|
617
|
+
public static __dirname = ___dirname;
|
|
569
618
|
|
|
570
619
|
private static resolve = (path: string): string => {
|
|
571
620
|
|
|
@@ -592,6 +641,12 @@ export default class OpenComicAI {
|
|
|
592
641
|
|
|
593
642
|
}
|
|
594
643
|
|
|
644
|
+
public static setDirname = (dirname: string): void => {
|
|
645
|
+
|
|
646
|
+
OpenComicAI.__dirname = OpenComicAI.resolve(dirname);
|
|
647
|
+
|
|
648
|
+
}
|
|
649
|
+
|
|
595
650
|
public static model = (model: Model = DEFAULT_MODEL): ModelObject => {
|
|
596
651
|
|
|
597
652
|
if(!modelsList.includes(model as Model))
|
|
@@ -612,7 +667,7 @@ export default class OpenComicAI {
|
|
|
612
667
|
if(!modelsList.includes(model as Model))
|
|
613
668
|
throw new Error(`Model not found: ${model}`);
|
|
614
669
|
|
|
615
|
-
const base = p.join(
|
|
670
|
+
const base = p.join(OpenComicAI.__dirname, '..');
|
|
616
671
|
|
|
617
672
|
const upscaler = OpenComicAI.model(model as Model).upscaler;
|
|
618
673
|
const result = upscalers[upscaler].platforms[process.platform]?.[process.arch] ?? upscalers[upscaler].platforms[process.platform]?.x64 ?? upscalers[upscaler].platforms.linux?.x64 ?? '';
|