@coreviz/sdk 1.0.11 → 1.0.12
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 +54 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,21 @@
|
|
|
1
1
|
# @coreviz/sdk
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Easily integrate powerful image analysis and manipulation features into your applications with CoreViz (https://coreviz.io/) 's Vision SDK.
|
|
4
|
+
|
|
5
|
+
## Introduction
|
|
6
|
+
|
|
7
|
+
[](https://coreviz.io/)
|
|
8
|
+
|
|
9
|
+
The CoreViz SDK powers the [coreviz.io](https://coreviz.io/) platform and the [CoreViz CLI](https://github.com/coreviz/cli), providing fast, consistent AI image analysis and manipulation capabilities across environments.
|
|
10
|
+
|
|
11
|
+
You can try out the live demos and tools built with this SDK at [coreviz.io/tools](https://coreviz.io/tools), including:
|
|
12
|
+
|
|
13
|
+
- **Image Description**: Generate detailed captions for any image. [→ Demo](https://coreviz.io/tools/describe)
|
|
14
|
+
- **Tagging / Classification**: Classify images with custom or general prompts. [→ Demo](https://coreviz.io/tools/tag)
|
|
15
|
+
- **Image Editing**: Modify or retouch images using generative AI based on text instructions. [→ Demo](https://coreviz.io/tools/edit)
|
|
16
|
+
|
|
17
|
+
Check out [coreviz.io/tools](https://coreviz.io/tools) to explore these features interactively.
|
|
18
|
+
|
|
4
19
|
|
|
5
20
|
## Installation
|
|
6
21
|
|
|
@@ -90,6 +105,43 @@ const editedImage = await coreviz.edit('https://example.com/photo.jpg', {
|
|
|
90
105
|
});
|
|
91
106
|
```
|
|
92
107
|
|
|
108
|
+
### `coreviz.embed(input, options?)`
|
|
109
|
+
|
|
110
|
+
Generates embeddings for image or text inputs, enabling semantic search and similarity comparison. Use with `coreviz.similarity(embeddingA, embeddingB)` to compare two images or an image and a text.
|
|
111
|
+
|
|
112
|
+
**Parameters:**
|
|
113
|
+
- `input` (string): The text string or image (URL/base64) to embed.
|
|
114
|
+
- `options` (object, optional):
|
|
115
|
+
- `type` ('image' | 'text', optional): Explicitly define the input type.
|
|
116
|
+
- `mode` ('api' | 'local', optional): Execution mode (default: `'api'`). `'local'` runs in-browser/node using transformers.js.
|
|
117
|
+
|
|
118
|
+
**Returns:**
|
|
119
|
+
- `Promise<EmbedResponse>`: An object containing:
|
|
120
|
+
- `embedding` (number[]): The high-dimensional vector representation.
|
|
121
|
+
|
|
122
|
+
**Example:**
|
|
123
|
+
|
|
124
|
+
```typescript
|
|
125
|
+
const { embedding } = await coreviz.embed('A photo of a sunset');
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### `coreviz.similarity(embeddingA, embeddingB)`
|
|
129
|
+
|
|
130
|
+
Calculates the degree of similarity between two embeddings.
|
|
131
|
+
|
|
132
|
+
**Parameters:**
|
|
133
|
+
- `embeddingA` (number[]): The first image/text embedding.
|
|
134
|
+
- `embeddingB` (number[]): The second image/text embedding.
|
|
135
|
+
|
|
136
|
+
**Returns:**
|
|
137
|
+
- `number`: A similarity score between -1 and 1.
|
|
138
|
+
|
|
139
|
+
**Example:**
|
|
140
|
+
|
|
141
|
+
```typescript
|
|
142
|
+
const similarity = coreviz.similarity(embeddingA, embeddingB);
|
|
143
|
+
```
|
|
144
|
+
|
|
93
145
|
### `coreviz.resize(input, maxWidth?, maxHeight?)`
|
|
94
146
|
|
|
95
147
|
Utility function to resize images client-side or server-side before processing. Also available as a standalone import.
|
|
@@ -107,8 +159,4 @@ Utility function to resize images client-side or server-side before processing.
|
|
|
107
159
|
```typescript
|
|
108
160
|
const resized = await coreviz.resize(myFileObject, 800, 600);
|
|
109
161
|
// or import { resize } from '@coreviz/sdk';
|
|
110
|
-
```
|
|
111
|
-
|
|
112
|
-
## License
|
|
113
|
-
|
|
114
|
-
MIT
|
|
162
|
+
```
|