@eyepop.ai/eyepop 0.20.1 → 0.21.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 CHANGED
@@ -27,7 +27,7 @@ Configuration and authorization with explicit defaults:
27
27
  ```typescript
28
28
  import { EyePop } from '@eyepop.ai/eyepop'
29
29
  (async() => {
30
- const endpoint = EyePop.endpoint({
30
+ const endpoint = EyePop.workerEndpoint({
31
31
  // This is the default and can be omitted
32
32
  popId: process.env['EYEPOP_POP_ID'],
33
33
  // This is the default and can be omitted
@@ -42,17 +42,19 @@ Equivalent, but shorter:
42
42
  ```typescript
43
43
  import { EyePop } from '@eyepop.ai/eyepop'
44
44
  (async() => {
45
- const endpoint = await EyePop.endpoint().connect()
45
+ const endpoint = await EyePop.workerEndpoint().connect()
46
46
  // do work ....
47
47
  await endpoint.disconnect()
48
48
  })
49
49
  ```
50
50
  ### Authentication with session generated from Api Key
51
51
  #### Server Side
52
+
52
53
  ```javascript
53
- import { EyePop } from '@eyepop.ai/eyepop'
54
+ import {EyePop} from '@eyepop.ai/eyepop'
55
+
54
56
  const getSession = async function (req, res) {
55
- const endpoint = await EyePop.endpoint().connect();
57
+ const endpoint = await EyePop.workerEndpoint().connect();
56
58
  res.setHeader("Content-Type", "application/json");
57
59
  res.writeHead(200);
58
60
  res.end(JSON.stringify(await endpoint.session()));
@@ -60,17 +62,20 @@ const getSession = async function (req, res) {
60
62
  const server = http.createServer(getSession);
61
63
  server.listen(8080, '127.0.0.1');
62
64
  ```
63
- #### Client Side
65
+ #### Client Side
66
+
64
67
  ```javascript
65
- import { EyePop } from '@eyepop.ai/eyepop'
66
- (async() => {
68
+ import {EyePop} from '@eyepop.ai/eyepop'
69
+
70
+ (async () => {
67
71
  const session = await (await fetch("http://127.0.0.1:8080")).json();
68
- const endpoint = await EyePop.endpoint({ auth: { session: session } }).connect();
72
+ const endpoint = await EyePop.workerEndpoint({auth: {session: session}}).connect();
69
73
  // do work ....
70
74
  await endpoint.disconnect();
71
75
  })();
72
76
  ```
73
77
  ### Authentication with Current Browser Session
78
+
74
79
  ```html
75
80
  <!DOCTYPE html>
76
81
  <html lang="en">
@@ -81,7 +86,7 @@ import { EyePop } from '@eyepop.ai/eyepop'
81
86
  <body>
82
87
  <script>
83
88
  document.addEventListener("DOMContentLoaded", async (event) => {
84
- let endpoint = await EyePop.endpoint({ auth: { oAuth2: true }, popId: '< Pop Id>' }).connect();
89
+ let endpoint = await EyePop.workerEndpoint({auth: {oAuth2: true}, popId: '< Pop Id>'}).connect();
85
90
  // do work ....
86
91
  await endpoint.disconnect();
87
92
  });
@@ -89,14 +94,18 @@ import { EyePop } from '@eyepop.ai/eyepop'
89
94
  </body>
90
95
  ```
91
96
  To use an alternative environment, e.g. STAGING vs PRODUCTION, pass in the adjusted Auth0 configuration:
97
+
92
98
  ```javascript
93
99
  // ...
94
- let endpoint = await EyePop.endpoint({
95
- auth: { oAuth2: {
96
- audience: "https://dev-app.eyepop.ai",
97
- domain: "dev-eyepop.us.auth0.com",
98
- clientId: "jktx3YO2UnbkNPvr05PQWf26t1kNTJyg"
99
- } }, popId: '< Pop Id>' }).connect();
100
+ let endpoint = await EyePop.workerEndpoint({
101
+ auth: {
102
+ oAuth2: {
103
+ audience: "https://dev-app.eyepop.ai",
104
+ domain: "dev-eyepop.us.auth0.com",
105
+ clientId: "jktx3YO2UnbkNPvr05PQWf26t1kNTJyg"
106
+ }
107
+ }, popId: '< Pop Id>'
108
+ }).connect();
100
109
  // ...
101
110
  ```
102
111
  ## Usage Examples
@@ -107,7 +116,7 @@ import { EyePop } from '@eyepop.ai/eyepop'
107
116
  const example_image_path = 'examples/example.jpg';
108
117
 
109
118
  (async() => {
110
- const endpoint = await EyePop.endpoint().connect()
119
+ const endpoint = await EyePop.workerEndpoint().connect()
111
120
  try {
112
121
  let results = await endpoint.process({path: example_image_path})
113
122
  for await (let result of results) {
@@ -118,8 +127,8 @@ const example_image_path = 'examples/example.jpg';
118
127
  }
119
128
  })();
120
129
  ```
121
- 1. `EyePop.endpoint()` returns a local endpoint object, that will authenticate with the Api Key found in
122
- EYEPOP_SECRET_KEY and load the worker configuration for the Pop identified by EYEPOP_POP_ID.
130
+ 1. `EyePop.workerEndpoint()` returns a local endpoint object, that will authenticate with the Api Key found in
131
+ EYEPOP_SECRET_KEY and load the worker configuration for the Pop identified by EYEPOP_POP_ID.
123
132
  2. Call `endpoint.connect()` before any job is submitted and `endpoint.disconnect()` to release all resources.
124
133
  3. `endpoint.process({path:'examples/example.jpg'})` initiates the upload to the local file to the worker service.
125
134
  The image will be queued and processed immediately when the worker becomes available.
@@ -136,6 +145,10 @@ until the entire file has been processed.
136
145
  endpoint.upload({stream: readableStream, mimeType: 'image/jpeg'})
137
146
  // ...
138
147
  ```
148
+
149
+ Note: since v0.21.0 `EyePop.workerEndpoint()` was introduced and replaces `EyePop.endpoint()` which is now deprecated.
150
+ Support for `EyePop.endpoint()` will be removed in v1.0.0.
151
+
139
152
  ### Visualizing Results
140
153
  Visualization components are provided as separate modules. Please refer to the module's documentation for usage examples.
141
154
  * [EyePop Render 2d](https://www.npmjs.com/package/@eyepop.ai/eyepop-render-2d)
@@ -149,7 +162,7 @@ import { EyePop } from '@eyepop.ai/eyepop';
149
162
  const example_image_path = 'examples/example.jpg';
150
163
 
151
164
  (async() => {
152
- const endpoint = await EyePop.endpoint().connect()
165
+ const endpoint = await EyePop.workerEndpoint().connect()
153
166
  try {
154
167
  for (let i = 0; i < 100; i++) {
155
168
  endpoint.process({path: example_image_path}).then(async (results) => {
@@ -176,7 +189,7 @@ import { EyePop } from '@eyepop.ai/eyepop';
176
189
  const example_image_url = 'https://farm2.staticflickr.com/1080/1301049949_532835a8b5_z.jpg';
177
190
 
178
191
  (async() => {
179
- const endpoint = await EyePop.endpoint().connect()
192
+ const endpoint = await EyePop.workerEndpoint().connect()
180
193
  try {
181
194
  let results = await endpoint.process({url: example_image_url})
182
195
  for await (let result of results) {
@@ -197,7 +210,7 @@ import { EyePop } from '@eyepop.ai/eyepop'
197
210
  const example_video_url = 'https://demo-eyepop-videos.s3.amazonaws.com/test1_vlog.mp4';
198
211
 
199
212
  (async() => {
200
- const endpoint = await EyePop.endpoint().connect()
213
+ const endpoint = await EyePop.workerEndpoint().connect()
201
214
  try {
202
215
  let results = await endpoint.process({url: example_image_url})
203
216
  for await (let result of results) {
@@ -217,7 +230,7 @@ import { EyePop } from '@eyepop.ai/eyepop'
217
230
  const example_video_url = 'https://demo-eyepop-videos.s3.amazonaws.com/test1_vlog.mp4';
218
231
 
219
232
  (async() => {
220
- const endpoint = EyePop.endpoint().connect()
233
+ const endpoint = EyePop.workerEndpoint().connect()
221
234
  try {
222
235
  let results = await endpoint.process({url: example_image_url})
223
236
  for await (let result of results) {
@@ -233,13 +246,17 @@ const example_video_url = 'https://demo-eyepop-videos.s3.amazonaws.com/test1_vlo
233
246
  ```
234
247
  ## Other Usage Options
235
248
  #### Auto start workers
236
- By default, `EyePop.endpoint().connect()` will start a worker if none is running yet. To disable this behavior
249
+ By default, `EyePop.workerEndpoint().connect()` will start a worker if none is running yet. To disable this behavior
237
250
  create an endpoint with `EyePop.endpoint({autoStart: false})`.
238
251
  #### Stop pending jobs
239
- By default, `EyePop.endpoint().connect()` will cancel all currently running or queued jobs on the worker.
252
+ By default, `EyePop.workerEndpoint().connect()` will cancel all currently running or queued jobs on the worker.
240
253
  It is assumed that the caller _takes full control_ of that worker. To disable this behavior create an endpoint with
241
254
  `EyePop.endpoint({stopJobs: false})`.
242
255
 
256
+ ## Data endpoint (experimental)
257
+ To support managing your own datasets and control model optimization v0.21.0 introduces `EyePop.dataEndpoint()`,
258
+ an experimental pre-release which is subject to change. An officially supported version will be released with v1.0.0
259
+
243
260
 
244
261
 
245
262