@eyepop.ai/eyepop 3.7.2 → 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 +141 -10
- package/dist/eyepop.index.d.ts +141 -10
- package/dist/eyepop.index.js +325 -30
- package/dist/eyepop.index.js.map +1 -1
- package/dist/eyepop.index.mjs +321 -30
- 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";
|
|
@@ -10774,6 +10796,156 @@ var AssetUrlType = /* @__PURE__ */ ((AssetUrlType3) => {
|
|
|
10774
10796
|
AssetUrlType3["https_signed"] = "https_signed";
|
|
10775
10797
|
return AssetUrlType3;
|
|
10776
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
|
+
};
|
|
10777
10949
|
|
|
10778
10950
|
// data/data_endpoint.ts
|
|
10779
10951
|
var WS_INITIAL_RECONNECT_DELAY = 1e3;
|
|
@@ -10781,7 +10953,8 @@ var WS_MAX_RECONNECT_DELAY = 6e4;
|
|
|
10781
10953
|
var DataEndpoint = class extends Endpoint {
|
|
10782
10954
|
constructor(options) {
|
|
10783
10955
|
super(options);
|
|
10784
|
-
this.
|
|
10956
|
+
this.datasetApiUrl = null;
|
|
10957
|
+
this.vlmApiUrl = null;
|
|
10785
10958
|
this._ws = null;
|
|
10786
10959
|
this._ws_current_reconnect_delay = null;
|
|
10787
10960
|
this._accountId = options.accountId || null;
|
|
@@ -10802,11 +10975,13 @@ var DataEndpoint = class extends Endpoint {
|
|
|
10802
10975
|
accessToken: session.accessToken,
|
|
10803
10976
|
validUntil: session.validUntil,
|
|
10804
10977
|
accountId: this.options().accountId,
|
|
10805
|
-
|
|
10978
|
+
datasetApiUrl: this.datasetApiUrl,
|
|
10979
|
+
vlmApiUrl: this.vlmApiUrl
|
|
10806
10980
|
};
|
|
10807
10981
|
}
|
|
10808
10982
|
async disconnect(wait = true) {
|
|
10809
|
-
this.
|
|
10983
|
+
this.datasetApiUrl = null;
|
|
10984
|
+
this.vlmApiUrl = null;
|
|
10810
10985
|
if (this._ws) {
|
|
10811
10986
|
try {
|
|
10812
10987
|
this._ws.close();
|
|
@@ -10821,7 +10996,9 @@ var DataEndpoint = class extends Endpoint {
|
|
|
10821
10996
|
if (!this._client) {
|
|
10822
10997
|
return Promise.reject("endpoint not initialized");
|
|
10823
10998
|
}
|
|
10824
|
-
|
|
10999
|
+
this._logger.warn("AAA", this.vlmApiUrl);
|
|
11000
|
+
const accountUuidQuery = this._accountId ? `?account_uuid=${this._accountId}` : "";
|
|
11001
|
+
const config_url = `${this.eyepopUrl()}/configs${accountUuidQuery}`;
|
|
10825
11002
|
let headers = {
|
|
10826
11003
|
Authorization: await this.authorizationHeader()
|
|
10827
11004
|
};
|
|
@@ -10841,11 +11018,13 @@ var DataEndpoint = class extends Endpoint {
|
|
|
10841
11018
|
if (response.status != 200) {
|
|
10842
11019
|
this.updateState("Error" /* Error */);
|
|
10843
11020
|
const message = await response.text();
|
|
10844
|
-
return Promise.reject(`Unexpected status ${response.status}: ${message}`);
|
|
11021
|
+
return Promise.reject(`Unexpected status ${response.status} for ${config_url}: ${message}`);
|
|
10845
11022
|
}
|
|
10846
11023
|
let config = await response.json();
|
|
10847
|
-
const
|
|
10848
|
-
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();
|
|
10849
11028
|
if (this.options().disableWs) {
|
|
10850
11029
|
this._logger.info("disabled ws connection");
|
|
10851
11030
|
} else {
|
|
@@ -10853,7 +11032,7 @@ var DataEndpoint = class extends Endpoint {
|
|
|
10853
11032
|
}
|
|
10854
11033
|
if (this.options().useCookie) {
|
|
10855
11034
|
const client = this._client;
|
|
10856
|
-
const url = urlJoin(this.
|
|
11035
|
+
const url = urlJoin(this.datasetApiUrl, "security", "check?set_cookie=true");
|
|
10857
11036
|
const headers2 = {
|
|
10858
11037
|
Authorization: await this.authorizationHeader()
|
|
10859
11038
|
};
|
|
@@ -10874,7 +11053,7 @@ var DataEndpoint = class extends Endpoint {
|
|
|
10874
11053
|
this._ws.close();
|
|
10875
11054
|
this._ws = null;
|
|
10876
11055
|
}
|
|
10877
|
-
const baseUrl = this.
|
|
11056
|
+
const baseUrl = this.datasetApiUrl?.replace("https://", "wss://").replace("http://", "ws://");
|
|
10878
11057
|
if (!baseUrl) {
|
|
10879
11058
|
return;
|
|
10880
11059
|
}
|
|
@@ -10932,16 +11111,15 @@ var DataEndpoint = class extends Endpoint {
|
|
|
10932
11111
|
options() {
|
|
10933
11112
|
return this._options;
|
|
10934
11113
|
}
|
|
10935
|
-
async request(path2, options = {}, disableAuth = false) {
|
|
11114
|
+
async request(path2, options = {}, disableAuth = false, dataApiType = "dataset" /* dataset */) {
|
|
10936
11115
|
const client = this._client;
|
|
10937
|
-
|
|
10938
|
-
if (!baseUrl || !client) {
|
|
11116
|
+
if (!client) {
|
|
10939
11117
|
return Promise.reject("endpoint not connected");
|
|
10940
11118
|
}
|
|
10941
11119
|
let response = await this.fetchWithRetry(async () => {
|
|
10942
11120
|
const session = await this.session();
|
|
11121
|
+
const baseUrl = getBaseUrl(session, dataApiType);
|
|
10943
11122
|
const headers = {
|
|
10944
|
-
"Content-Type": "application/json",
|
|
10945
11123
|
...disableAuth ? {} : { Authorization: `Bearer ${session.accessToken}` },
|
|
10946
11124
|
...options.headers || {}
|
|
10947
11125
|
};
|
|
@@ -10953,8 +11131,8 @@ var DataEndpoint = class extends Endpoint {
|
|
|
10953
11131
|
method: options.method || "GET",
|
|
10954
11132
|
body: options.body
|
|
10955
11133
|
};
|
|
10956
|
-
this._requestLogger.debug("Request - " + ri.method + path2 + " BODY: " + (ri.body ? ri.body : ""));
|
|
10957
|
-
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);
|
|
10958
11136
|
});
|
|
10959
11137
|
if (response.status === 204) {
|
|
10960
11138
|
return null;
|
|
@@ -10982,7 +11160,8 @@ var DataEndpoint = class extends Endpoint {
|
|
|
10982
11160
|
async createDataset(data) {
|
|
10983
11161
|
return this.request(`/datasets?account_uuid=${this._accountId}`, {
|
|
10984
11162
|
method: "POST",
|
|
10985
|
-
body: JSON.stringify(data)
|
|
11163
|
+
body: JSON.stringify(data),
|
|
11164
|
+
headers: { "Content-Type": "application/json" }
|
|
10986
11165
|
});
|
|
10987
11166
|
}
|
|
10988
11167
|
async getDataset(dataset_uuid, include_stats = true, dataset_version, modifiable_version_only) {
|
|
@@ -10995,13 +11174,15 @@ var DataEndpoint = class extends Endpoint {
|
|
|
10995
11174
|
async updateDataset(dataset_uuid, data, start_auto_annotate = true) {
|
|
10996
11175
|
return this.request(`/datasets/${dataset_uuid}?start_auto_annotate=${start_auto_annotate}`, {
|
|
10997
11176
|
method: "PATCH",
|
|
10998
|
-
body: JSON.stringify(data)
|
|
11177
|
+
body: JSON.stringify(data),
|
|
11178
|
+
headers: { "Content-Type": "application/json" }
|
|
10999
11179
|
});
|
|
11000
11180
|
}
|
|
11001
11181
|
async updateDatasetHeroAsset(dataset_uuid, update) {
|
|
11002
11182
|
return this.request(`/datasets/${dataset_uuid}/hero_asset`, {
|
|
11003
11183
|
method: "PATCH",
|
|
11004
|
-
body: JSON.stringify(update)
|
|
11184
|
+
body: JSON.stringify(update),
|
|
11185
|
+
headers: { "Content-Type": "application/json" }
|
|
11005
11186
|
});
|
|
11006
11187
|
}
|
|
11007
11188
|
async deleteDataset(dataset_uuid) {
|
|
@@ -11042,6 +11223,30 @@ var DataEndpoint = class extends Endpoint {
|
|
|
11042
11223
|
method: "DELETE"
|
|
11043
11224
|
});
|
|
11044
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
|
+
}
|
|
11045
11250
|
// Asset methods
|
|
11046
11251
|
async uploadAsset(dataset_uuid, dataset_version, blob, external_id = void 0) {
|
|
11047
11252
|
const versionQuery = dataset_version ? `&dataset_version=${dataset_version}` : "";
|
|
@@ -11110,7 +11315,8 @@ var DataEndpoint = class extends Endpoint {
|
|
|
11110
11315
|
const datasetQuery = dataset_uuid ? `&dataset_uuid=${dataset_uuid}` : "";
|
|
11111
11316
|
return this.request(`/assets/${asset_uuid}/ground_truth?${datasetQuery}${versionQuery}`, {
|
|
11112
11317
|
method: "PATCH",
|
|
11113
|
-
body: JSON.stringify(predictions)
|
|
11318
|
+
body: JSON.stringify(predictions),
|
|
11319
|
+
headers: { "Content-Type": "application/json" }
|
|
11114
11320
|
});
|
|
11115
11321
|
}
|
|
11116
11322
|
async deleteAssetGroundTruth(asset_uuid, dataset_uuid, dataset_version) {
|
|
@@ -11130,23 +11336,45 @@ var DataEndpoint = class extends Endpoint {
|
|
|
11130
11336
|
method: "PATCH"
|
|
11131
11337
|
});
|
|
11132
11338
|
}
|
|
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
|
+
}
|
|
11133
11363
|
async downloadAsset(asset_uuid, dataset_uuid, dataset_version, transcode_mode = "original" /* original */, start_timestamp, end_timestamp, url_type) {
|
|
11134
11364
|
const versionQuery = dataset_version ? `&dataset_version=${dataset_version}` : "";
|
|
11135
11365
|
const datasetQuery = dataset_uuid ? `&dataset_uuid=${dataset_uuid}` : "";
|
|
11136
11366
|
const startTimestampQuery = start_timestamp ? `&start_timestamp=${start_timestamp}` : "";
|
|
11137
11367
|
const endTimestampQuery = end_timestamp ? `&end_timestamp=${end_timestamp}` : "";
|
|
11138
11368
|
const urlTypeQuery = url_type ? `&url_type=${url_type}` : "";
|
|
11139
|
-
return this.request(
|
|
11140
|
-
|
|
11141
|
-
|
|
11142
|
-
method: "GET"
|
|
11143
|
-
}
|
|
11144
|
-
);
|
|
11369
|
+
return this.request(`/assets/${asset_uuid}/download?transcode_mode=${transcode_mode}${datasetQuery}${versionQuery}${startTimestampQuery}${endTimestampQuery}${urlTypeQuery}`, {
|
|
11370
|
+
method: "GET"
|
|
11371
|
+
});
|
|
11145
11372
|
}
|
|
11146
11373
|
async previewAutoAnnotateAsset(asset_uuid, auto_annotate, auto_annotate_params) {
|
|
11147
11374
|
return this.request(`/assets/${asset_uuid}/preview_auto_annotate?auto_annotate=${auto_annotate}`, {
|
|
11148
11375
|
method: "POST",
|
|
11149
|
-
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" } : {}
|
|
11150
11378
|
});
|
|
11151
11379
|
}
|
|
11152
11380
|
// Model methods
|
|
@@ -11163,7 +11391,8 @@ var DataEndpoint = class extends Endpoint {
|
|
|
11163
11391
|
async createModel(dataset_uuid, dataset_version, data, start_training = true) {
|
|
11164
11392
|
return this.request(`/models?dataset_uuid=${dataset_uuid}&dataset_version=${dataset_version}&start_training=${start_training}`, {
|
|
11165
11393
|
method: "POST",
|
|
11166
|
-
body: JSON.stringify(data)
|
|
11394
|
+
body: JSON.stringify(data),
|
|
11395
|
+
headers: { "Content-Type": "application/json" }
|
|
11167
11396
|
});
|
|
11168
11397
|
}
|
|
11169
11398
|
async getModel(model_uuid) {
|
|
@@ -11179,7 +11408,8 @@ var DataEndpoint = class extends Endpoint {
|
|
|
11179
11408
|
async updateModel(model_uuid, data) {
|
|
11180
11409
|
return this.request(`/models/${model_uuid}`, {
|
|
11181
11410
|
method: "PATCH",
|
|
11182
|
-
body: JSON.stringify(data)
|
|
11411
|
+
body: JSON.stringify(data),
|
|
11412
|
+
headers: { "Content-Type": "application/json" }
|
|
11183
11413
|
});
|
|
11184
11414
|
}
|
|
11185
11415
|
async deleteModel(model_uuid) {
|
|
@@ -11203,7 +11433,8 @@ var DataEndpoint = class extends Endpoint {
|
|
|
11203
11433
|
}
|
|
11204
11434
|
await this.request(`/models/${model_uuid}/exports/qc_ai_hub`, {
|
|
11205
11435
|
method: "POST",
|
|
11206
|
-
body: JSON.stringify(params)
|
|
11436
|
+
body: JSON.stringify(params),
|
|
11437
|
+
headers: { "Content-Type": "application/json" }
|
|
11207
11438
|
});
|
|
11208
11439
|
}
|
|
11209
11440
|
async downloadModelArtifacts(model_uuid, model_formats, device_name, artifact_type) {
|
|
@@ -11275,7 +11506,8 @@ var DataEndpoint = class extends Endpoint {
|
|
|
11275
11506
|
async startWorkflow(account_uuid, template_name, workflow) {
|
|
11276
11507
|
return this.request(`/workflows?account_uuid=${account_uuid}&template_name=${template_name}`, {
|
|
11277
11508
|
method: "POST",
|
|
11278
|
-
body: JSON.stringify(workflow)
|
|
11509
|
+
body: JSON.stringify(workflow),
|
|
11510
|
+
headers: { "Content-Type": "application/json" }
|
|
11279
11511
|
});
|
|
11280
11512
|
}
|
|
11281
11513
|
async getWorkflow(workflow_id, account_uuid) {
|
|
@@ -11292,6 +11524,61 @@ var DataEndpoint = class extends Endpoint {
|
|
|
11292
11524
|
method: "GET"
|
|
11293
11525
|
});
|
|
11294
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
|
+
}
|
|
11295
11582
|
async dispatchChangeEvent(change_event) {
|
|
11296
11583
|
switch (change_event.change_type) {
|
|
11297
11584
|
// account event types
|
|
@@ -11534,13 +11821,16 @@ export {
|
|
|
11534
11821
|
ArtifactType,
|
|
11535
11822
|
AssetStatus,
|
|
11536
11823
|
AssetUrlType,
|
|
11824
|
+
AutoAnnotateStatus,
|
|
11537
11825
|
AutoAnnotateTask,
|
|
11538
11826
|
ChangeType,
|
|
11539
11827
|
ContourType,
|
|
11540
11828
|
DEFAULT_PREDICTION_VERSION,
|
|
11829
|
+
DataApiType,
|
|
11541
11830
|
DataEndpoint,
|
|
11542
11831
|
Endpoint,
|
|
11543
11832
|
EndpointState,
|
|
11833
|
+
EvaluationStatus,
|
|
11544
11834
|
ExportedBy,
|
|
11545
11835
|
EyePop,
|
|
11546
11836
|
EyepopLineDecoder,
|
|
@@ -11573,6 +11863,7 @@ export {
|
|
|
11573
11863
|
WorkerEndpoint,
|
|
11574
11864
|
WorkflowPhase,
|
|
11575
11865
|
index_default as default,
|
|
11866
|
+
getBaseUrl,
|
|
11576
11867
|
readableStreamFromString
|
|
11577
11868
|
};
|
|
11578
11869
|
/*! Bundled license information:
|