@eyepop.ai/eyepop 3.7.0 → 3.8.1
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/eyepop.index.d.mts +152 -12
- package/dist/eyepop.index.d.ts +152 -12
- package/dist/eyepop.index.js +335 -26
- package/dist/eyepop.index.js.map +1 -1
- package/dist/eyepop.index.mjs +330 -26
- package/dist/eyepop.index.mjs.map +1 -1
- package/dist/eyepop.min.js +1 -1
- package/package.json +1 -1
package/dist/eyepop.index.mjs
CHANGED
|
@@ -10636,6 +10636,28 @@ function urlJoin() {
|
|
|
10636
10636
|
}
|
|
10637
10637
|
|
|
10638
10638
|
// data/data_types.ts
|
|
10639
|
+
var DataApiType = /* @__PURE__ */ ((DataApiType2) => {
|
|
10640
|
+
DataApiType2["dataset"] = "dataset";
|
|
10641
|
+
DataApiType2["vlm"] = "vlm";
|
|
10642
|
+
return DataApiType2;
|
|
10643
|
+
})(DataApiType || {});
|
|
10644
|
+
function getBaseUrl(session, dataApiType) {
|
|
10645
|
+
switch (dataApiType) {
|
|
10646
|
+
case "dataset" /* dataset */:
|
|
10647
|
+
return session.datasetApiUrl ?? "";
|
|
10648
|
+
case "vlm" /* vlm */:
|
|
10649
|
+
return session.vlmApiUrl ?? "";
|
|
10650
|
+
default:
|
|
10651
|
+
throw new Error(`unsupported type ${dataApiType}`);
|
|
10652
|
+
}
|
|
10653
|
+
}
|
|
10654
|
+
var AutoAnnotateStatus = /* @__PURE__ */ ((AutoAnnotateStatus2) => {
|
|
10655
|
+
AutoAnnotateStatus2["error"] = "error";
|
|
10656
|
+
AutoAnnotateStatus2["requested"] = "requested";
|
|
10657
|
+
AutoAnnotateStatus2["in_progress"] = "in_progress";
|
|
10658
|
+
AutoAnnotateStatus2["completed"] = "completed";
|
|
10659
|
+
return AutoAnnotateStatus2;
|
|
10660
|
+
})(AutoAnnotateStatus || {});
|
|
10639
10661
|
var AssetStatus = /* @__PURE__ */ ((AssetStatus2) => {
|
|
10640
10662
|
AssetStatus2["rejected"] = "rejected";
|
|
10641
10663
|
AssetStatus2["upload_in_progress"] = "upload_in_progress";
|
|
@@ -10768,6 +10790,162 @@ var ModelPrecisionType = /* @__PURE__ */ ((ModelPrecisionType2) => {
|
|
|
10768
10790
|
ModelPrecisionType2["uint8"] = "uint8";
|
|
10769
10791
|
return ModelPrecisionType2;
|
|
10770
10792
|
})(ModelPrecisionType || {});
|
|
10793
|
+
var AssetUrlType = /* @__PURE__ */ ((AssetUrlType3) => {
|
|
10794
|
+
AssetUrlType3["gcs"] = "gcs";
|
|
10795
|
+
AssetUrlType3["s3"] = "s3";
|
|
10796
|
+
AssetUrlType3["https_signed"] = "https_signed";
|
|
10797
|
+
return AssetUrlType3;
|
|
10798
|
+
})(AssetUrlType || {});
|
|
10799
|
+
var EvaluationStatus = /* @__PURE__ */ ((EvaluationStatus2) => {
|
|
10800
|
+
EvaluationStatus2["success"] = "success";
|
|
10801
|
+
EvaluationStatus2["failed"] = "failed";
|
|
10802
|
+
return EvaluationStatus2;
|
|
10803
|
+
})(EvaluationStatus || {});
|
|
10804
|
+
|
|
10805
|
+
// data/jobs.ts
|
|
10806
|
+
var InferAssetJob = class {
|
|
10807
|
+
constructor(assetUrl, inferRequest, vlmFetch, requestLogger) {
|
|
10808
|
+
this._response = null;
|
|
10809
|
+
this._runInfo = null;
|
|
10810
|
+
this._controller = new AbortController();
|
|
10811
|
+
this._vlmFetch = vlmFetch;
|
|
10812
|
+
this._assetUrl = assetUrl;
|
|
10813
|
+
this._inferRequest = inferRequest;
|
|
10814
|
+
this._requestLogger = requestLogger;
|
|
10815
|
+
}
|
|
10816
|
+
[Symbol.asyncIterator]() {
|
|
10817
|
+
if (!this._response) {
|
|
10818
|
+
throw Error("logical bug");
|
|
10819
|
+
}
|
|
10820
|
+
let consumed = false;
|
|
10821
|
+
const response_promise = this._response;
|
|
10822
|
+
const controller = this._controller;
|
|
10823
|
+
async function* iterator() {
|
|
10824
|
+
if (consumed) {
|
|
10825
|
+
throw new Error("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");
|
|
10826
|
+
}
|
|
10827
|
+
consumed = true;
|
|
10828
|
+
let done = false;
|
|
10829
|
+
try {
|
|
10830
|
+
const predictions = await response_promise;
|
|
10831
|
+
if (predictions) {
|
|
10832
|
+
for (let prediction of predictions) {
|
|
10833
|
+
yield prediction;
|
|
10834
|
+
}
|
|
10835
|
+
}
|
|
10836
|
+
done = true;
|
|
10837
|
+
} catch (e) {
|
|
10838
|
+
if (e instanceof Error && e.name === "AbortError") return;
|
|
10839
|
+
throw e;
|
|
10840
|
+
} finally {
|
|
10841
|
+
if (!done) controller.abort();
|
|
10842
|
+
}
|
|
10843
|
+
}
|
|
10844
|
+
return iterator();
|
|
10845
|
+
}
|
|
10846
|
+
start(done) {
|
|
10847
|
+
this._response = new Promise(async (resolve, reject) => {
|
|
10848
|
+
try {
|
|
10849
|
+
let requestId = null;
|
|
10850
|
+
while (true) {
|
|
10851
|
+
let response = null;
|
|
10852
|
+
if (requestId) {
|
|
10853
|
+
response = await this._vlmFetch(`/api/v1/requests/${requestId}?timeout=20`, {
|
|
10854
|
+
method: "POST"
|
|
10855
|
+
});
|
|
10856
|
+
} else {
|
|
10857
|
+
const infer_request = new Map(Object.entries(this._inferRequest));
|
|
10858
|
+
infer_request.set("url", this._assetUrl);
|
|
10859
|
+
const body = new FormData();
|
|
10860
|
+
body.append("infer_request", JSON.stringify(Object.fromEntries(infer_request)));
|
|
10861
|
+
response = await this._vlmFetch(`/api/v1/infer?timeout=20`, {
|
|
10862
|
+
method: "POST",
|
|
10863
|
+
body
|
|
10864
|
+
});
|
|
10865
|
+
}
|
|
10866
|
+
const predictions = response["predictions"];
|
|
10867
|
+
const runInfo = response["run_info"];
|
|
10868
|
+
if (predictions) {
|
|
10869
|
+
this._runInfo = runInfo;
|
|
10870
|
+
resolve(predictions);
|
|
10871
|
+
break;
|
|
10872
|
+
} else {
|
|
10873
|
+
requestId = response["request_id"];
|
|
10874
|
+
if (!requestId) {
|
|
10875
|
+
reject(`missing request_id in response: ${JSON.stringify(response)}`);
|
|
10876
|
+
break;
|
|
10877
|
+
}
|
|
10878
|
+
}
|
|
10879
|
+
}
|
|
10880
|
+
} catch (reason) {
|
|
10881
|
+
reject(reason);
|
|
10882
|
+
} finally {
|
|
10883
|
+
done();
|
|
10884
|
+
}
|
|
10885
|
+
});
|
|
10886
|
+
return this;
|
|
10887
|
+
}
|
|
10888
|
+
cancel() {
|
|
10889
|
+
this._controller.abort("cancelled");
|
|
10890
|
+
}
|
|
10891
|
+
};
|
|
10892
|
+
var EvaluateDatasetJob = class {
|
|
10893
|
+
constructor(evaluateRequest, workerRelease, vlmFetch, requestLogger) {
|
|
10894
|
+
this._response = null;
|
|
10895
|
+
this._controller = new AbortController();
|
|
10896
|
+
this._vlmFetch = vlmFetch;
|
|
10897
|
+
this._evaluateRequest = evaluateRequest;
|
|
10898
|
+
this._workerRelease = workerRelease;
|
|
10899
|
+
this._requestLogger = requestLogger;
|
|
10900
|
+
}
|
|
10901
|
+
async response() {
|
|
10902
|
+
if (!this._response) {
|
|
10903
|
+
throw Error("logical bug");
|
|
10904
|
+
}
|
|
10905
|
+
return await this._response;
|
|
10906
|
+
}
|
|
10907
|
+
start(done) {
|
|
10908
|
+
this._response = new Promise(async (resolve, reject) => {
|
|
10909
|
+
try {
|
|
10910
|
+
let requestId = null;
|
|
10911
|
+
while (true) {
|
|
10912
|
+
let response = null;
|
|
10913
|
+
if (requestId) {
|
|
10914
|
+
response = await this._vlmFetch(`/api/v1/evaluations/${requestId}?timeout=20`, {
|
|
10915
|
+
method: "GET"
|
|
10916
|
+
});
|
|
10917
|
+
} else {
|
|
10918
|
+
const workerReleaseQuery = this._workerRelease ? `&worker_release=${this._workerRelease}` : "";
|
|
10919
|
+
response = await this._vlmFetch(`/api/v1/evaluations?timeout=20${workerReleaseQuery}`, {
|
|
10920
|
+
method: "POST",
|
|
10921
|
+
body: JSON.stringify(this._evaluateRequest),
|
|
10922
|
+
headers: { "Content-Type": "application/json" }
|
|
10923
|
+
});
|
|
10924
|
+
}
|
|
10925
|
+
const runInfo = response["run_info"];
|
|
10926
|
+
if (runInfo) {
|
|
10927
|
+
resolve(response);
|
|
10928
|
+
break;
|
|
10929
|
+
} else {
|
|
10930
|
+
requestId = response["request_id"];
|
|
10931
|
+
if (!requestId) {
|
|
10932
|
+
reject(`missing request_id in response: ${JSON.stringify(response)}`);
|
|
10933
|
+
break;
|
|
10934
|
+
}
|
|
10935
|
+
}
|
|
10936
|
+
}
|
|
10937
|
+
} catch (reason) {
|
|
10938
|
+
reject(reason);
|
|
10939
|
+
} finally {
|
|
10940
|
+
done();
|
|
10941
|
+
}
|
|
10942
|
+
});
|
|
10943
|
+
return this;
|
|
10944
|
+
}
|
|
10945
|
+
cancel() {
|
|
10946
|
+
this._controller.abort("cancelled");
|
|
10947
|
+
}
|
|
10948
|
+
};
|
|
10771
10949
|
|
|
10772
10950
|
// data/data_endpoint.ts
|
|
10773
10951
|
var WS_INITIAL_RECONNECT_DELAY = 1e3;
|
|
@@ -10775,7 +10953,8 @@ var WS_MAX_RECONNECT_DELAY = 6e4;
|
|
|
10775
10953
|
var DataEndpoint = class extends Endpoint {
|
|
10776
10954
|
constructor(options) {
|
|
10777
10955
|
super(options);
|
|
10778
|
-
this.
|
|
10956
|
+
this.datasetApiUrl = null;
|
|
10957
|
+
this.vlmApiUrl = null;
|
|
10779
10958
|
this._ws = null;
|
|
10780
10959
|
this._ws_current_reconnect_delay = null;
|
|
10781
10960
|
this._accountId = options.accountId || null;
|
|
@@ -10796,11 +10975,13 @@ var DataEndpoint = class extends Endpoint {
|
|
|
10796
10975
|
accessToken: session.accessToken,
|
|
10797
10976
|
validUntil: session.validUntil,
|
|
10798
10977
|
accountId: this.options().accountId,
|
|
10799
|
-
|
|
10978
|
+
datasetApiUrl: this.datasetApiUrl,
|
|
10979
|
+
vlmApiUrl: this.vlmApiUrl
|
|
10800
10980
|
};
|
|
10801
10981
|
}
|
|
10802
10982
|
async disconnect(wait = true) {
|
|
10803
|
-
this.
|
|
10983
|
+
this.datasetApiUrl = null;
|
|
10984
|
+
this.vlmApiUrl = null;
|
|
10804
10985
|
if (this._ws) {
|
|
10805
10986
|
try {
|
|
10806
10987
|
this._ws.close();
|
|
@@ -10815,7 +10996,9 @@ var DataEndpoint = class extends Endpoint {
|
|
|
10815
10996
|
if (!this._client) {
|
|
10816
10997
|
return Promise.reject("endpoint not initialized");
|
|
10817
10998
|
}
|
|
10818
|
-
|
|
10999
|
+
this._logger.warn("AAA", this.vlmApiUrl);
|
|
11000
|
+
const accountUuidQuery = this._accountId ? `?account_uuid=${this._accountId}` : "";
|
|
11001
|
+
const config_url = `${this.eyepopUrl()}/configs${accountUuidQuery}`;
|
|
10819
11002
|
let headers = {
|
|
10820
11003
|
Authorization: await this.authorizationHeader()
|
|
10821
11004
|
};
|
|
@@ -10835,11 +11018,13 @@ var DataEndpoint = class extends Endpoint {
|
|
|
10835
11018
|
if (response.status != 200) {
|
|
10836
11019
|
this.updateState("Error" /* Error */);
|
|
10837
11020
|
const message = await response.text();
|
|
10838
|
-
return Promise.reject(`Unexpected status ${response.status}: ${message}`);
|
|
11021
|
+
return Promise.reject(`Unexpected status ${response.status} for ${config_url}: ${message}`);
|
|
10839
11022
|
}
|
|
10840
11023
|
let config = await response.json();
|
|
10841
|
-
const
|
|
10842
|
-
this.
|
|
11024
|
+
const datasetApiUrl = new URL(config.dataset_api_url, this.eyepopUrl());
|
|
11025
|
+
this.datasetApiUrl = datasetApiUrl.toString();
|
|
11026
|
+
const vlmApiUrl = new URL(config.vlm_api_url, this.eyepopUrl());
|
|
11027
|
+
this.vlmApiUrl = vlmApiUrl.toString();
|
|
10843
11028
|
if (this.options().disableWs) {
|
|
10844
11029
|
this._logger.info("disabled ws connection");
|
|
10845
11030
|
} else {
|
|
@@ -10847,7 +11032,7 @@ var DataEndpoint = class extends Endpoint {
|
|
|
10847
11032
|
}
|
|
10848
11033
|
if (this.options().useCookie) {
|
|
10849
11034
|
const client = this._client;
|
|
10850
|
-
const url = urlJoin(this.
|
|
11035
|
+
const url = urlJoin(this.datasetApiUrl, "security", "check?set_cookie=true");
|
|
10851
11036
|
const headers2 = {
|
|
10852
11037
|
Authorization: await this.authorizationHeader()
|
|
10853
11038
|
};
|
|
@@ -10868,7 +11053,7 @@ var DataEndpoint = class extends Endpoint {
|
|
|
10868
11053
|
this._ws.close();
|
|
10869
11054
|
this._ws = null;
|
|
10870
11055
|
}
|
|
10871
|
-
const baseUrl = this.
|
|
11056
|
+
const baseUrl = this.datasetApiUrl?.replace("https://", "wss://").replace("http://", "ws://");
|
|
10872
11057
|
if (!baseUrl) {
|
|
10873
11058
|
return;
|
|
10874
11059
|
}
|
|
@@ -10926,16 +11111,15 @@ var DataEndpoint = class extends Endpoint {
|
|
|
10926
11111
|
options() {
|
|
10927
11112
|
return this._options;
|
|
10928
11113
|
}
|
|
10929
|
-
async request(path2, options = {}, disableAuth = false) {
|
|
11114
|
+
async request(path2, options = {}, disableAuth = false, dataApiType = "dataset" /* dataset */) {
|
|
10930
11115
|
const client = this._client;
|
|
10931
|
-
|
|
10932
|
-
if (!baseUrl || !client) {
|
|
11116
|
+
if (!client) {
|
|
10933
11117
|
return Promise.reject("endpoint not connected");
|
|
10934
11118
|
}
|
|
10935
11119
|
let response = await this.fetchWithRetry(async () => {
|
|
10936
11120
|
const session = await this.session();
|
|
11121
|
+
const baseUrl = getBaseUrl(session, dataApiType);
|
|
10937
11122
|
const headers = {
|
|
10938
|
-
"Content-Type": "application/json",
|
|
10939
11123
|
...disableAuth ? {} : { Authorization: `Bearer ${session.accessToken}` },
|
|
10940
11124
|
...options.headers || {}
|
|
10941
11125
|
};
|
|
@@ -10947,8 +11131,8 @@ var DataEndpoint = class extends Endpoint {
|
|
|
10947
11131
|
method: options.method || "GET",
|
|
10948
11132
|
body: options.body
|
|
10949
11133
|
};
|
|
10950
|
-
this._requestLogger.debug("Request - " + ri.method + path2 + " BODY: " + (ri.body ? ri.body : ""));
|
|
10951
|
-
return await client.fetch(urlJoin(
|
|
11134
|
+
this._requestLogger.debug("Request - " + ri.method + " " + path2 + " BODY: " + (ri.body ? ri.body : ""));
|
|
11135
|
+
return await client.fetch(urlJoin(baseUrl ?? "", path2), ri);
|
|
10952
11136
|
});
|
|
10953
11137
|
if (response.status === 204) {
|
|
10954
11138
|
return null;
|
|
@@ -10976,7 +11160,8 @@ var DataEndpoint = class extends Endpoint {
|
|
|
10976
11160
|
async createDataset(data) {
|
|
10977
11161
|
return this.request(`/datasets?account_uuid=${this._accountId}`, {
|
|
10978
11162
|
method: "POST",
|
|
10979
|
-
body: JSON.stringify(data)
|
|
11163
|
+
body: JSON.stringify(data),
|
|
11164
|
+
headers: { "Content-Type": "application/json" }
|
|
10980
11165
|
});
|
|
10981
11166
|
}
|
|
10982
11167
|
async getDataset(dataset_uuid, include_stats = true, dataset_version, modifiable_version_only) {
|
|
@@ -10989,13 +11174,15 @@ var DataEndpoint = class extends Endpoint {
|
|
|
10989
11174
|
async updateDataset(dataset_uuid, data, start_auto_annotate = true) {
|
|
10990
11175
|
return this.request(`/datasets/${dataset_uuid}?start_auto_annotate=${start_auto_annotate}`, {
|
|
10991
11176
|
method: "PATCH",
|
|
10992
|
-
body: JSON.stringify(data)
|
|
11177
|
+
body: JSON.stringify(data),
|
|
11178
|
+
headers: { "Content-Type": "application/json" }
|
|
10993
11179
|
});
|
|
10994
11180
|
}
|
|
10995
11181
|
async updateDatasetHeroAsset(dataset_uuid, update) {
|
|
10996
11182
|
return this.request(`/datasets/${dataset_uuid}/hero_asset`, {
|
|
10997
11183
|
method: "PATCH",
|
|
10998
|
-
body: JSON.stringify(update)
|
|
11184
|
+
body: JSON.stringify(update),
|
|
11185
|
+
headers: { "Content-Type": "application/json" }
|
|
10999
11186
|
});
|
|
11000
11187
|
}
|
|
11001
11188
|
async deleteDataset(dataset_uuid) {
|
|
@@ -11036,6 +11223,30 @@ var DataEndpoint = class extends Endpoint {
|
|
|
11036
11223
|
method: "DELETE"
|
|
11037
11224
|
});
|
|
11038
11225
|
}
|
|
11226
|
+
async createDatasetAutoAnnotate(create, dataset_uuid, dataset_version) {
|
|
11227
|
+
const versionQuery = dataset_version ? `dataset_version=${dataset_version}&` : "";
|
|
11228
|
+
return this.request(`/datasets/${dataset_uuid}/auto_annotates?${versionQuery}`, {
|
|
11229
|
+
method: "POST",
|
|
11230
|
+
body: JSON.stringify(create),
|
|
11231
|
+
headers: { "Content-Type": "application/json" }
|
|
11232
|
+
});
|
|
11233
|
+
}
|
|
11234
|
+
async updateDatasetAutoAnnotate(update, dataset_uuid, auto_annotate, source, dataset_version) {
|
|
11235
|
+
const versionQuery = dataset_version ? `dataset_version=${dataset_version}&` : "";
|
|
11236
|
+
return this.request(`/datasets/${dataset_uuid}/auto_annotates?auto_annotate=${auto_annotate}&source=${encodeURIComponent(source)}&${versionQuery}`, {
|
|
11237
|
+
method: "PATCH",
|
|
11238
|
+
body: JSON.stringify(update),
|
|
11239
|
+
headers: { "Content-Type": "application/json" }
|
|
11240
|
+
});
|
|
11241
|
+
}
|
|
11242
|
+
async listDatasetAutoAnnotates(dataset_uuid, auto_annotate, source, dataset_version) {
|
|
11243
|
+
const versionQuery = dataset_version ? `dataset_version=${dataset_version}&` : "";
|
|
11244
|
+
const autoAnnotateQuery = auto_annotate ? `auto_annotate=${auto_annotate}&` : "";
|
|
11245
|
+
const sourceQuery = source ? `source=${source}&` : "";
|
|
11246
|
+
return this.request(`/datasets/${dataset_uuid}/auto_annotates?${versionQuery}&${autoAnnotateQuery}&${sourceQuery}`, {
|
|
11247
|
+
method: "GET"
|
|
11248
|
+
});
|
|
11249
|
+
}
|
|
11039
11250
|
// Asset methods
|
|
11040
11251
|
async uploadAsset(dataset_uuid, dataset_version, blob, external_id = void 0) {
|
|
11041
11252
|
const versionQuery = dataset_version ? `&dataset_version=${dataset_version}` : "";
|
|
@@ -11104,7 +11315,8 @@ var DataEndpoint = class extends Endpoint {
|
|
|
11104
11315
|
const datasetQuery = dataset_uuid ? `&dataset_uuid=${dataset_uuid}` : "";
|
|
11105
11316
|
return this.request(`/assets/${asset_uuid}/ground_truth?${datasetQuery}${versionQuery}`, {
|
|
11106
11317
|
method: "PATCH",
|
|
11107
|
-
body: JSON.stringify(predictions)
|
|
11318
|
+
body: JSON.stringify(predictions),
|
|
11319
|
+
headers: { "Content-Type": "application/json" }
|
|
11108
11320
|
});
|
|
11109
11321
|
}
|
|
11110
11322
|
async deleteAssetGroundTruth(asset_uuid, dataset_uuid, dataset_version) {
|
|
@@ -11124,17 +11336,45 @@ var DataEndpoint = class extends Endpoint {
|
|
|
11124
11336
|
method: "PATCH"
|
|
11125
11337
|
});
|
|
11126
11338
|
}
|
|
11127
|
-
async
|
|
11339
|
+
async addAssetAnnotation(asset_uuid, dataset_uuid, dataset_version, predictions, auto_annotate, source, user_review, approved_threshold) {
|
|
11340
|
+
const datasetQuery = dataset_uuid ? `dataset_uuid=${dataset_uuid}&` : "";
|
|
11341
|
+
const versionQuery = dataset_version ? `&dataset_version=${dataset_version}&` : "";
|
|
11342
|
+
const autoAnnotateQuery = auto_annotate ? `&auto_annotate=${auto_annotate}&` : "";
|
|
11343
|
+
const sourceQuery = source ? `&source=${encodeURIComponent(source)}&` : "";
|
|
11344
|
+
const userReviewQuery = user_review ? `&user_review=${user_review}&` : "";
|
|
11345
|
+
const approvedThresholdQuery = typeof approved_threshold !== "undefined" ? `&approved_threshold=${approved_threshold}&` : "";
|
|
11346
|
+
return this.request(`/assets/${asset_uuid}/annotations?${datasetQuery}${versionQuery}${autoAnnotateQuery}${sourceQuery}${userReviewQuery}${approvedThresholdQuery}`, {
|
|
11347
|
+
method: "POST",
|
|
11348
|
+
body: JSON.stringify(predictions),
|
|
11349
|
+
headers: { "Content-Type": "application/json" }
|
|
11350
|
+
});
|
|
11351
|
+
}
|
|
11352
|
+
async updateAssetAnnotationApproval(asset_uuid, dataset_uuid, dataset_version, auto_annotate, source, user_review, approved_threshold) {
|
|
11353
|
+
const datasetQuery = dataset_uuid ? `dataset_uuid=${dataset_uuid}&` : "";
|
|
11354
|
+
const versionQuery = dataset_version ? `&dataset_version=${dataset_version}&` : "";
|
|
11355
|
+
const autoAnnotateQuery = auto_annotate ? `&auto_annotate=${auto_annotate}&` : "";
|
|
11356
|
+
const sourceQuery = source ? `&source=${encodeURIComponent(source)}&` : "";
|
|
11357
|
+
const userReviewQuery = user_review ? `&user_review=${user_review}&` : "";
|
|
11358
|
+
const approvedThresholdQuery = approved_threshold ? `&approved_threshold=${approved_threshold}&` : "";
|
|
11359
|
+
return this.request(`/assets/${asset_uuid}/annotations?${datasetQuery}${versionQuery}${autoAnnotateQuery}${sourceQuery}${userReviewQuery}${approvedThresholdQuery}`, {
|
|
11360
|
+
method: "PATCH"
|
|
11361
|
+
});
|
|
11362
|
+
}
|
|
11363
|
+
async downloadAsset(asset_uuid, dataset_uuid, dataset_version, transcode_mode = "original" /* original */, start_timestamp, end_timestamp, url_type) {
|
|
11128
11364
|
const versionQuery = dataset_version ? `&dataset_version=${dataset_version}` : "";
|
|
11129
11365
|
const datasetQuery = dataset_uuid ? `&dataset_uuid=${dataset_uuid}` : "";
|
|
11130
|
-
|
|
11366
|
+
const startTimestampQuery = start_timestamp ? `&start_timestamp=${start_timestamp}` : "";
|
|
11367
|
+
const endTimestampQuery = end_timestamp ? `&end_timestamp=${end_timestamp}` : "";
|
|
11368
|
+
const urlTypeQuery = url_type ? `&url_type=${url_type}` : "";
|
|
11369
|
+
return this.request(`/assets/${asset_uuid}/download?transcode_mode=${transcode_mode}${datasetQuery}${versionQuery}${startTimestampQuery}${endTimestampQuery}${urlTypeQuery}`, {
|
|
11131
11370
|
method: "GET"
|
|
11132
11371
|
});
|
|
11133
11372
|
}
|
|
11134
11373
|
async previewAutoAnnotateAsset(asset_uuid, auto_annotate, auto_annotate_params) {
|
|
11135
11374
|
return this.request(`/assets/${asset_uuid}/preview_auto_annotate?auto_annotate=${auto_annotate}`, {
|
|
11136
11375
|
method: "POST",
|
|
11137
|
-
body: auto_annotate_params ? JSON.stringify(auto_annotate_params) : null
|
|
11376
|
+
body: auto_annotate_params ? JSON.stringify(auto_annotate_params) : null,
|
|
11377
|
+
headers: auto_annotate_params ? { "Content-Type": "application/json" } : {}
|
|
11138
11378
|
});
|
|
11139
11379
|
}
|
|
11140
11380
|
// Model methods
|
|
@@ -11151,7 +11391,8 @@ var DataEndpoint = class extends Endpoint {
|
|
|
11151
11391
|
async createModel(dataset_uuid, dataset_version, data, start_training = true) {
|
|
11152
11392
|
return this.request(`/models?dataset_uuid=${dataset_uuid}&dataset_version=${dataset_version}&start_training=${start_training}`, {
|
|
11153
11393
|
method: "POST",
|
|
11154
|
-
body: JSON.stringify(data)
|
|
11394
|
+
body: JSON.stringify(data),
|
|
11395
|
+
headers: { "Content-Type": "application/json" }
|
|
11155
11396
|
});
|
|
11156
11397
|
}
|
|
11157
11398
|
async getModel(model_uuid) {
|
|
@@ -11167,7 +11408,8 @@ var DataEndpoint = class extends Endpoint {
|
|
|
11167
11408
|
async updateModel(model_uuid, data) {
|
|
11168
11409
|
return this.request(`/models/${model_uuid}`, {
|
|
11169
11410
|
method: "PATCH",
|
|
11170
|
-
body: JSON.stringify(data)
|
|
11411
|
+
body: JSON.stringify(data),
|
|
11412
|
+
headers: { "Content-Type": "application/json" }
|
|
11171
11413
|
});
|
|
11172
11414
|
}
|
|
11173
11415
|
async deleteModel(model_uuid) {
|
|
@@ -11191,7 +11433,8 @@ var DataEndpoint = class extends Endpoint {
|
|
|
11191
11433
|
}
|
|
11192
11434
|
await this.request(`/models/${model_uuid}/exports/qc_ai_hub`, {
|
|
11193
11435
|
method: "POST",
|
|
11194
|
-
body: JSON.stringify(params)
|
|
11436
|
+
body: JSON.stringify(params),
|
|
11437
|
+
headers: { "Content-Type": "application/json" }
|
|
11195
11438
|
});
|
|
11196
11439
|
}
|
|
11197
11440
|
async downloadModelArtifacts(model_uuid, model_formats, device_name, artifact_type) {
|
|
@@ -11263,7 +11506,8 @@ var DataEndpoint = class extends Endpoint {
|
|
|
11263
11506
|
async startWorkflow(account_uuid, template_name, workflow) {
|
|
11264
11507
|
return this.request(`/workflows?account_uuid=${account_uuid}&template_name=${template_name}`, {
|
|
11265
11508
|
method: "POST",
|
|
11266
|
-
body: JSON.stringify(workflow)
|
|
11509
|
+
body: JSON.stringify(workflow),
|
|
11510
|
+
headers: { "Content-Type": "application/json" }
|
|
11267
11511
|
});
|
|
11268
11512
|
}
|
|
11269
11513
|
async getWorkflow(workflow_id, account_uuid) {
|
|
@@ -11280,6 +11524,61 @@ var DataEndpoint = class extends Endpoint {
|
|
|
11280
11524
|
method: "GET"
|
|
11281
11525
|
});
|
|
11282
11526
|
}
|
|
11527
|
+
async inferAsset(asset_uuid, infer_request, dataset_uuid, dataset_version, transcode_mode, start_timestamp, end_timestamp) {
|
|
11528
|
+
const datasetQuery = dataset_uuid ? `dataset_uuid=${dataset_uuid}&` : "";
|
|
11529
|
+
const versionQuery = dataset_version ? `dataset_version=${dataset_version}&` : "";
|
|
11530
|
+
const transcodeModeQuery = transcode_mode ? `transcode_mode=${transcode_mode}&` : "";
|
|
11531
|
+
const startTimestampQuery = start_timestamp ? `start_timestamp=${start_timestamp}&` : "";
|
|
11532
|
+
const endTimestampQuery = end_timestamp ? `end_timestamp=${end_timestamp}&` : "";
|
|
11533
|
+
const assetUrl = `ai.eyepop://data/assets/${asset_uuid}?${transcodeModeQuery}${datasetQuery}${versionQuery}${startTimestampQuery}${endTimestampQuery}`;
|
|
11534
|
+
if (!this.vlmApiUrl || !this._client || !this._limit) {
|
|
11535
|
+
throw new Error("endpoint not connected, use connect()");
|
|
11536
|
+
}
|
|
11537
|
+
await this._limit.acquire();
|
|
11538
|
+
try {
|
|
11539
|
+
this.updateState();
|
|
11540
|
+
const job = new InferAssetJob(
|
|
11541
|
+
assetUrl,
|
|
11542
|
+
infer_request,
|
|
11543
|
+
async (path2, options) => {
|
|
11544
|
+
return await this.request(path2, options, false, "vlm" /* vlm */);
|
|
11545
|
+
},
|
|
11546
|
+
this._requestLogger
|
|
11547
|
+
);
|
|
11548
|
+
return job.start(() => {
|
|
11549
|
+
this.jobDone(job);
|
|
11550
|
+
});
|
|
11551
|
+
} catch (e) {
|
|
11552
|
+
this._limit.release();
|
|
11553
|
+
throw e;
|
|
11554
|
+
}
|
|
11555
|
+
}
|
|
11556
|
+
async evaluateDataset(evaluate_request, worker_release) {
|
|
11557
|
+
if (!this.vlmApiUrl || !this._client || !this._limit) {
|
|
11558
|
+
throw new Error("endpoint not connected, use connect()");
|
|
11559
|
+
}
|
|
11560
|
+
await this._limit.acquire();
|
|
11561
|
+
try {
|
|
11562
|
+
this.updateState();
|
|
11563
|
+
const job = new EvaluateDatasetJob(
|
|
11564
|
+
evaluate_request,
|
|
11565
|
+
worker_release ?? null,
|
|
11566
|
+
async (path2, options) => {
|
|
11567
|
+
return await this.request(path2, options, false, "vlm" /* vlm */);
|
|
11568
|
+
},
|
|
11569
|
+
this._requestLogger
|
|
11570
|
+
);
|
|
11571
|
+
return job.start(() => {
|
|
11572
|
+
this.jobDone(job);
|
|
11573
|
+
});
|
|
11574
|
+
} catch (e) {
|
|
11575
|
+
this._limit.release();
|
|
11576
|
+
throw e;
|
|
11577
|
+
}
|
|
11578
|
+
}
|
|
11579
|
+
jobDone(job) {
|
|
11580
|
+
this._limit?.release();
|
|
11581
|
+
}
|
|
11283
11582
|
async dispatchChangeEvent(change_event) {
|
|
11284
11583
|
switch (change_event.change_type) {
|
|
11285
11584
|
// account event types
|
|
@@ -11521,13 +11820,17 @@ export {
|
|
|
11521
11820
|
AnnotationType,
|
|
11522
11821
|
ArtifactType,
|
|
11523
11822
|
AssetStatus,
|
|
11823
|
+
AssetUrlType,
|
|
11824
|
+
AutoAnnotateStatus,
|
|
11524
11825
|
AutoAnnotateTask,
|
|
11525
11826
|
ChangeType,
|
|
11526
11827
|
ContourType,
|
|
11527
11828
|
DEFAULT_PREDICTION_VERSION,
|
|
11829
|
+
DataApiType,
|
|
11528
11830
|
DataEndpoint,
|
|
11529
11831
|
Endpoint,
|
|
11530
11832
|
EndpointState,
|
|
11833
|
+
EvaluationStatus,
|
|
11531
11834
|
ExportedBy,
|
|
11532
11835
|
EyePop,
|
|
11533
11836
|
EyepopLineDecoder,
|
|
@@ -11560,6 +11863,7 @@ export {
|
|
|
11560
11863
|
WorkerEndpoint,
|
|
11561
11864
|
WorkflowPhase,
|
|
11562
11865
|
index_default as default,
|
|
11866
|
+
getBaseUrl,
|
|
11563
11867
|
readableStreamFromString
|
|
11564
11868
|
};
|
|
11565
11869
|
/*! Bundled license information:
|