@coreviz/sdk 1.1.5 → 1.1.6
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/dist/coreviz.js +4 -4
- package/dist/resize.js +1 -1
- package/package.json +1 -1
package/dist/coreviz.js
CHANGED
|
@@ -186,8 +186,8 @@ class CoreViz {
|
|
|
186
186
|
formData.append('path', options.path);
|
|
187
187
|
if (typeof file === 'string') {
|
|
188
188
|
// Node.js: treat as a file path — dynamic import fs to stay browser-compatible
|
|
189
|
-
const fs = await Promise.resolve().then(() => __importStar(require('fs')));
|
|
190
|
-
const path = await Promise.resolve().then(() => __importStar(require('path')));
|
|
189
|
+
const fs = await Promise.resolve().then(() => __importStar(require('node:fs')));
|
|
190
|
+
const path = await Promise.resolve().then(() => __importStar(require('node:path')));
|
|
191
191
|
const buffer = fs.readFileSync(file);
|
|
192
192
|
const ext = path.extname(file).slice(1).toLowerCase();
|
|
193
193
|
const mimeTypes = {
|
|
@@ -418,7 +418,7 @@ class CoreViz {
|
|
|
418
418
|
async tagLocal(imageInput, options) {
|
|
419
419
|
try {
|
|
420
420
|
// Dynamic import to avoid loading transformers if not used
|
|
421
|
-
const { AutoProcessor, AutoModelForImageTextToText, RawImage, env } = await Promise.resolve().then(() => __importStar(require('@huggingface/transformers')));
|
|
421
|
+
const { AutoProcessor, AutoModelForImageTextToText, RawImage, env } = await Promise.resolve().then(() => __importStar(require(/* webpackIgnore: true */ /* turbopackIgnore: true */ '@huggingface/transformers')));
|
|
422
422
|
// Configure transformers.js for browser usage
|
|
423
423
|
env.allowRemoteModels = true;
|
|
424
424
|
const processor = await AutoProcessor.from_pretrained('onnx-community/FastVLM-0.5B-ONNX');
|
|
@@ -557,7 +557,7 @@ Output:
|
|
|
557
557
|
async embedLocal(input, options) {
|
|
558
558
|
try {
|
|
559
559
|
// Dynamic import to avoid loading transformers if not used
|
|
560
|
-
const { AutoTokenizer, AutoProcessor, CLIPTextModelWithProjection, CLIPVisionModelWithProjection, RawImage } = await Promise.resolve().then(() => __importStar(require('@huggingface/transformers')));
|
|
560
|
+
const { AutoTokenizer, AutoProcessor, CLIPTextModelWithProjection, CLIPVisionModelWithProjection, RawImage } = await Promise.resolve().then(() => __importStar(require(/* webpackIgnore: true */ /* turbopackIgnore: true */ '@huggingface/transformers')));
|
|
561
561
|
const MODEL_ID = 'Xenova/clip-vit-large-patch14';
|
|
562
562
|
const start = Date.now();
|
|
563
563
|
// Load tokenizer and processor
|
package/dist/resize.js
CHANGED
|
@@ -113,7 +113,7 @@ async function serverResize(inputStr, maxWidth, maxHeight) {
|
|
|
113
113
|
try {
|
|
114
114
|
// Dynamic import to prevent bundling sharp on the client
|
|
115
115
|
// Note: `sharp` is an optional dependency (for RN/Expo compatibility). If missing, we gracefully fall back.
|
|
116
|
-
const sharpModule = await Promise.resolve().then(() => __importStar(require('sharp')));
|
|
116
|
+
const sharpModule = await Promise.resolve().then(() => __importStar(require(/* webpackIgnore: true */ /* turbopackIgnore: true */ 'sharp')));
|
|
117
117
|
const sharp = sharpModule.default;
|
|
118
118
|
let buffer;
|
|
119
119
|
let mimeType = 'image/jpeg';
|