@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.js
CHANGED
|
@@ -8660,13 +8660,17 @@ __export(index_exports, {
|
|
|
8660
8660
|
AnnotationType: () => AnnotationType,
|
|
8661
8661
|
ArtifactType: () => ArtifactType,
|
|
8662
8662
|
AssetStatus: () => AssetStatus,
|
|
8663
|
+
AssetUrlType: () => AssetUrlType,
|
|
8664
|
+
AutoAnnotateStatus: () => AutoAnnotateStatus,
|
|
8663
8665
|
AutoAnnotateTask: () => AutoAnnotateTask,
|
|
8664
8666
|
ChangeType: () => ChangeType,
|
|
8665
8667
|
ContourType: () => ContourType,
|
|
8666
8668
|
DEFAULT_PREDICTION_VERSION: () => DEFAULT_PREDICTION_VERSION,
|
|
8669
|
+
DataApiType: () => DataApiType,
|
|
8667
8670
|
DataEndpoint: () => DataEndpoint,
|
|
8668
8671
|
Endpoint: () => Endpoint,
|
|
8669
8672
|
EndpointState: () => EndpointState,
|
|
8673
|
+
EvaluationStatus: () => EvaluationStatus,
|
|
8670
8674
|
ExportedBy: () => ExportedBy,
|
|
8671
8675
|
EyePop: () => EyePop,
|
|
8672
8676
|
EyepopLineDecoder: () => EyepopLineDecoder,
|
|
@@ -8699,6 +8703,7 @@ __export(index_exports, {
|
|
|
8699
8703
|
WorkerEndpoint: () => WorkerEndpoint,
|
|
8700
8704
|
WorkflowPhase: () => WorkflowPhase,
|
|
8701
8705
|
default: () => index_default,
|
|
8706
|
+
getBaseUrl: () => getBaseUrl,
|
|
8702
8707
|
readableStreamFromString: () => readableStreamFromString
|
|
8703
8708
|
});
|
|
8704
8709
|
module.exports = __toCommonJS(index_exports);
|
|
@@ -10707,6 +10712,28 @@ function urlJoin() {
|
|
|
10707
10712
|
}
|
|
10708
10713
|
|
|
10709
10714
|
// data/data_types.ts
|
|
10715
|
+
var DataApiType = /* @__PURE__ */ ((DataApiType2) => {
|
|
10716
|
+
DataApiType2["dataset"] = "dataset";
|
|
10717
|
+
DataApiType2["vlm"] = "vlm";
|
|
10718
|
+
return DataApiType2;
|
|
10719
|
+
})(DataApiType || {});
|
|
10720
|
+
function getBaseUrl(session, dataApiType) {
|
|
10721
|
+
switch (dataApiType) {
|
|
10722
|
+
case "dataset" /* dataset */:
|
|
10723
|
+
return session.datasetApiUrl ?? "";
|
|
10724
|
+
case "vlm" /* vlm */:
|
|
10725
|
+
return session.vlmApiUrl ?? "";
|
|
10726
|
+
default:
|
|
10727
|
+
throw new Error(`unsupported type ${dataApiType}`);
|
|
10728
|
+
}
|
|
10729
|
+
}
|
|
10730
|
+
var AutoAnnotateStatus = /* @__PURE__ */ ((AutoAnnotateStatus2) => {
|
|
10731
|
+
AutoAnnotateStatus2["error"] = "error";
|
|
10732
|
+
AutoAnnotateStatus2["requested"] = "requested";
|
|
10733
|
+
AutoAnnotateStatus2["in_progress"] = "in_progress";
|
|
10734
|
+
AutoAnnotateStatus2["completed"] = "completed";
|
|
10735
|
+
return AutoAnnotateStatus2;
|
|
10736
|
+
})(AutoAnnotateStatus || {});
|
|
10710
10737
|
var AssetStatus = /* @__PURE__ */ ((AssetStatus2) => {
|
|
10711
10738
|
AssetStatus2["rejected"] = "rejected";
|
|
10712
10739
|
AssetStatus2["upload_in_progress"] = "upload_in_progress";
|
|
@@ -10839,6 +10866,162 @@ var ModelPrecisionType = /* @__PURE__ */ ((ModelPrecisionType2) => {
|
|
|
10839
10866
|
ModelPrecisionType2["uint8"] = "uint8";
|
|
10840
10867
|
return ModelPrecisionType2;
|
|
10841
10868
|
})(ModelPrecisionType || {});
|
|
10869
|
+
var AssetUrlType = /* @__PURE__ */ ((AssetUrlType3) => {
|
|
10870
|
+
AssetUrlType3["gcs"] = "gcs";
|
|
10871
|
+
AssetUrlType3["s3"] = "s3";
|
|
10872
|
+
AssetUrlType3["https_signed"] = "https_signed";
|
|
10873
|
+
return AssetUrlType3;
|
|
10874
|
+
})(AssetUrlType || {});
|
|
10875
|
+
var EvaluationStatus = /* @__PURE__ */ ((EvaluationStatus2) => {
|
|
10876
|
+
EvaluationStatus2["success"] = "success";
|
|
10877
|
+
EvaluationStatus2["failed"] = "failed";
|
|
10878
|
+
return EvaluationStatus2;
|
|
10879
|
+
})(EvaluationStatus || {});
|
|
10880
|
+
|
|
10881
|
+
// data/jobs.ts
|
|
10882
|
+
var InferAssetJob = class {
|
|
10883
|
+
constructor(assetUrl, inferRequest, vlmFetch, requestLogger) {
|
|
10884
|
+
this._response = null;
|
|
10885
|
+
this._runInfo = null;
|
|
10886
|
+
this._controller = new AbortController();
|
|
10887
|
+
this._vlmFetch = vlmFetch;
|
|
10888
|
+
this._assetUrl = assetUrl;
|
|
10889
|
+
this._inferRequest = inferRequest;
|
|
10890
|
+
this._requestLogger = requestLogger;
|
|
10891
|
+
}
|
|
10892
|
+
[Symbol.asyncIterator]() {
|
|
10893
|
+
if (!this._response) {
|
|
10894
|
+
throw Error("logical bug");
|
|
10895
|
+
}
|
|
10896
|
+
let consumed = false;
|
|
10897
|
+
const response_promise = this._response;
|
|
10898
|
+
const controller = this._controller;
|
|
10899
|
+
async function* iterator() {
|
|
10900
|
+
if (consumed) {
|
|
10901
|
+
throw new Error("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");
|
|
10902
|
+
}
|
|
10903
|
+
consumed = true;
|
|
10904
|
+
let done = false;
|
|
10905
|
+
try {
|
|
10906
|
+
const predictions = await response_promise;
|
|
10907
|
+
if (predictions) {
|
|
10908
|
+
for (let prediction of predictions) {
|
|
10909
|
+
yield prediction;
|
|
10910
|
+
}
|
|
10911
|
+
}
|
|
10912
|
+
done = true;
|
|
10913
|
+
} catch (e) {
|
|
10914
|
+
if (e instanceof Error && e.name === "AbortError") return;
|
|
10915
|
+
throw e;
|
|
10916
|
+
} finally {
|
|
10917
|
+
if (!done) controller.abort();
|
|
10918
|
+
}
|
|
10919
|
+
}
|
|
10920
|
+
return iterator();
|
|
10921
|
+
}
|
|
10922
|
+
start(done) {
|
|
10923
|
+
this._response = new Promise(async (resolve, reject) => {
|
|
10924
|
+
try {
|
|
10925
|
+
let requestId = null;
|
|
10926
|
+
while (true) {
|
|
10927
|
+
let response = null;
|
|
10928
|
+
if (requestId) {
|
|
10929
|
+
response = await this._vlmFetch(`/api/v1/requests/${requestId}?timeout=20`, {
|
|
10930
|
+
method: "POST"
|
|
10931
|
+
});
|
|
10932
|
+
} else {
|
|
10933
|
+
const infer_request = new Map(Object.entries(this._inferRequest));
|
|
10934
|
+
infer_request.set("url", this._assetUrl);
|
|
10935
|
+
const body = new FormData();
|
|
10936
|
+
body.append("infer_request", JSON.stringify(Object.fromEntries(infer_request)));
|
|
10937
|
+
response = await this._vlmFetch(`/api/v1/infer?timeout=20`, {
|
|
10938
|
+
method: "POST",
|
|
10939
|
+
body
|
|
10940
|
+
});
|
|
10941
|
+
}
|
|
10942
|
+
const predictions = response["predictions"];
|
|
10943
|
+
const runInfo = response["run_info"];
|
|
10944
|
+
if (predictions) {
|
|
10945
|
+
this._runInfo = runInfo;
|
|
10946
|
+
resolve(predictions);
|
|
10947
|
+
break;
|
|
10948
|
+
} else {
|
|
10949
|
+
requestId = response["request_id"];
|
|
10950
|
+
if (!requestId) {
|
|
10951
|
+
reject(`missing request_id in response: ${JSON.stringify(response)}`);
|
|
10952
|
+
break;
|
|
10953
|
+
}
|
|
10954
|
+
}
|
|
10955
|
+
}
|
|
10956
|
+
} catch (reason) {
|
|
10957
|
+
reject(reason);
|
|
10958
|
+
} finally {
|
|
10959
|
+
done();
|
|
10960
|
+
}
|
|
10961
|
+
});
|
|
10962
|
+
return this;
|
|
10963
|
+
}
|
|
10964
|
+
cancel() {
|
|
10965
|
+
this._controller.abort("cancelled");
|
|
10966
|
+
}
|
|
10967
|
+
};
|
|
10968
|
+
var EvaluateDatasetJob = class {
|
|
10969
|
+
constructor(evaluateRequest, workerRelease, vlmFetch, requestLogger) {
|
|
10970
|
+
this._response = null;
|
|
10971
|
+
this._controller = new AbortController();
|
|
10972
|
+
this._vlmFetch = vlmFetch;
|
|
10973
|
+
this._evaluateRequest = evaluateRequest;
|
|
10974
|
+
this._workerRelease = workerRelease;
|
|
10975
|
+
this._requestLogger = requestLogger;
|
|
10976
|
+
}
|
|
10977
|
+
async response() {
|
|
10978
|
+
if (!this._response) {
|
|
10979
|
+
throw Error("logical bug");
|
|
10980
|
+
}
|
|
10981
|
+
return await this._response;
|
|
10982
|
+
}
|
|
10983
|
+
start(done) {
|
|
10984
|
+
this._response = new Promise(async (resolve, reject) => {
|
|
10985
|
+
try {
|
|
10986
|
+
let requestId = null;
|
|
10987
|
+
while (true) {
|
|
10988
|
+
let response = null;
|
|
10989
|
+
if (requestId) {
|
|
10990
|
+
response = await this._vlmFetch(`/api/v1/evaluations/${requestId}?timeout=20`, {
|
|
10991
|
+
method: "GET"
|
|
10992
|
+
});
|
|
10993
|
+
} else {
|
|
10994
|
+
const workerReleaseQuery = this._workerRelease ? `&worker_release=${this._workerRelease}` : "";
|
|
10995
|
+
response = await this._vlmFetch(`/api/v1/evaluations?timeout=20${workerReleaseQuery}`, {
|
|
10996
|
+
method: "POST",
|
|
10997
|
+
body: JSON.stringify(this._evaluateRequest),
|
|
10998
|
+
headers: { "Content-Type": "application/json" }
|
|
10999
|
+
});
|
|
11000
|
+
}
|
|
11001
|
+
const runInfo = response["run_info"];
|
|
11002
|
+
if (runInfo) {
|
|
11003
|
+
resolve(response);
|
|
11004
|
+
break;
|
|
11005
|
+
} else {
|
|
11006
|
+
requestId = response["request_id"];
|
|
11007
|
+
if (!requestId) {
|
|
11008
|
+
reject(`missing request_id in response: ${JSON.stringify(response)}`);
|
|
11009
|
+
break;
|
|
11010
|
+
}
|
|
11011
|
+
}
|
|
11012
|
+
}
|
|
11013
|
+
} catch (reason) {
|
|
11014
|
+
reject(reason);
|
|
11015
|
+
} finally {
|
|
11016
|
+
done();
|
|
11017
|
+
}
|
|
11018
|
+
});
|
|
11019
|
+
return this;
|
|
11020
|
+
}
|
|
11021
|
+
cancel() {
|
|
11022
|
+
this._controller.abort("cancelled");
|
|
11023
|
+
}
|
|
11024
|
+
};
|
|
10842
11025
|
|
|
10843
11026
|
// data/data_endpoint.ts
|
|
10844
11027
|
var WS_INITIAL_RECONNECT_DELAY = 1e3;
|
|
@@ -10846,7 +11029,8 @@ var WS_MAX_RECONNECT_DELAY = 6e4;
|
|
|
10846
11029
|
var DataEndpoint = class extends Endpoint {
|
|
10847
11030
|
constructor(options) {
|
|
10848
11031
|
super(options);
|
|
10849
|
-
this.
|
|
11032
|
+
this.datasetApiUrl = null;
|
|
11033
|
+
this.vlmApiUrl = null;
|
|
10850
11034
|
this._ws = null;
|
|
10851
11035
|
this._ws_current_reconnect_delay = null;
|
|
10852
11036
|
this._accountId = options.accountId || null;
|
|
@@ -10867,11 +11051,13 @@ var DataEndpoint = class extends Endpoint {
|
|
|
10867
11051
|
accessToken: session.accessToken,
|
|
10868
11052
|
validUntil: session.validUntil,
|
|
10869
11053
|
accountId: this.options().accountId,
|
|
10870
|
-
|
|
11054
|
+
datasetApiUrl: this.datasetApiUrl,
|
|
11055
|
+
vlmApiUrl: this.vlmApiUrl
|
|
10871
11056
|
};
|
|
10872
11057
|
}
|
|
10873
11058
|
async disconnect(wait = true) {
|
|
10874
|
-
this.
|
|
11059
|
+
this.datasetApiUrl = null;
|
|
11060
|
+
this.vlmApiUrl = null;
|
|
10875
11061
|
if (this._ws) {
|
|
10876
11062
|
try {
|
|
10877
11063
|
this._ws.close();
|
|
@@ -10886,7 +11072,9 @@ var DataEndpoint = class extends Endpoint {
|
|
|
10886
11072
|
if (!this._client) {
|
|
10887
11073
|
return Promise.reject("endpoint not initialized");
|
|
10888
11074
|
}
|
|
10889
|
-
|
|
11075
|
+
this._logger.warn("AAA", this.vlmApiUrl);
|
|
11076
|
+
const accountUuidQuery = this._accountId ? `?account_uuid=${this._accountId}` : "";
|
|
11077
|
+
const config_url = `${this.eyepopUrl()}/configs${accountUuidQuery}`;
|
|
10890
11078
|
let headers = {
|
|
10891
11079
|
Authorization: await this.authorizationHeader()
|
|
10892
11080
|
};
|
|
@@ -10906,11 +11094,13 @@ var DataEndpoint = class extends Endpoint {
|
|
|
10906
11094
|
if (response.status != 200) {
|
|
10907
11095
|
this.updateState("Error" /* Error */);
|
|
10908
11096
|
const message = await response.text();
|
|
10909
|
-
return Promise.reject(`Unexpected status ${response.status}: ${message}`);
|
|
11097
|
+
return Promise.reject(`Unexpected status ${response.status} for ${config_url}: ${message}`);
|
|
10910
11098
|
}
|
|
10911
11099
|
let config = await response.json();
|
|
10912
|
-
const
|
|
10913
|
-
this.
|
|
11100
|
+
const datasetApiUrl = new URL(config.dataset_api_url, this.eyepopUrl());
|
|
11101
|
+
this.datasetApiUrl = datasetApiUrl.toString();
|
|
11102
|
+
const vlmApiUrl = new URL(config.vlm_api_url, this.eyepopUrl());
|
|
11103
|
+
this.vlmApiUrl = vlmApiUrl.toString();
|
|
10914
11104
|
if (this.options().disableWs) {
|
|
10915
11105
|
this._logger.info("disabled ws connection");
|
|
10916
11106
|
} else {
|
|
@@ -10918,7 +11108,7 @@ var DataEndpoint = class extends Endpoint {
|
|
|
10918
11108
|
}
|
|
10919
11109
|
if (this.options().useCookie) {
|
|
10920
11110
|
const client = this._client;
|
|
10921
|
-
const url = urlJoin(this.
|
|
11111
|
+
const url = urlJoin(this.datasetApiUrl, "security", "check?set_cookie=true");
|
|
10922
11112
|
const headers2 = {
|
|
10923
11113
|
Authorization: await this.authorizationHeader()
|
|
10924
11114
|
};
|
|
@@ -10939,7 +11129,7 @@ var DataEndpoint = class extends Endpoint {
|
|
|
10939
11129
|
this._ws.close();
|
|
10940
11130
|
this._ws = null;
|
|
10941
11131
|
}
|
|
10942
|
-
const baseUrl = this.
|
|
11132
|
+
const baseUrl = this.datasetApiUrl?.replace("https://", "wss://").replace("http://", "ws://");
|
|
10943
11133
|
if (!baseUrl) {
|
|
10944
11134
|
return;
|
|
10945
11135
|
}
|
|
@@ -10997,16 +11187,15 @@ var DataEndpoint = class extends Endpoint {
|
|
|
10997
11187
|
options() {
|
|
10998
11188
|
return this._options;
|
|
10999
11189
|
}
|
|
11000
|
-
async request(path2, options = {}, disableAuth = false) {
|
|
11190
|
+
async request(path2, options = {}, disableAuth = false, dataApiType = "dataset" /* dataset */) {
|
|
11001
11191
|
const client = this._client;
|
|
11002
|
-
|
|
11003
|
-
if (!baseUrl || !client) {
|
|
11192
|
+
if (!client) {
|
|
11004
11193
|
return Promise.reject("endpoint not connected");
|
|
11005
11194
|
}
|
|
11006
11195
|
let response = await this.fetchWithRetry(async () => {
|
|
11007
11196
|
const session = await this.session();
|
|
11197
|
+
const baseUrl = getBaseUrl(session, dataApiType);
|
|
11008
11198
|
const headers = {
|
|
11009
|
-
"Content-Type": "application/json",
|
|
11010
11199
|
...disableAuth ? {} : { Authorization: `Bearer ${session.accessToken}` },
|
|
11011
11200
|
...options.headers || {}
|
|
11012
11201
|
};
|
|
@@ -11018,8 +11207,8 @@ var DataEndpoint = class extends Endpoint {
|
|
|
11018
11207
|
method: options.method || "GET",
|
|
11019
11208
|
body: options.body
|
|
11020
11209
|
};
|
|
11021
|
-
this._requestLogger.debug("Request - " + ri.method + path2 + " BODY: " + (ri.body ? ri.body : ""));
|
|
11022
|
-
return await client.fetch(urlJoin(
|
|
11210
|
+
this._requestLogger.debug("Request - " + ri.method + " " + path2 + " BODY: " + (ri.body ? ri.body : ""));
|
|
11211
|
+
return await client.fetch(urlJoin(baseUrl ?? "", path2), ri);
|
|
11023
11212
|
});
|
|
11024
11213
|
if (response.status === 204) {
|
|
11025
11214
|
return null;
|
|
@@ -11047,7 +11236,8 @@ var DataEndpoint = class extends Endpoint {
|
|
|
11047
11236
|
async createDataset(data) {
|
|
11048
11237
|
return this.request(`/datasets?account_uuid=${this._accountId}`, {
|
|
11049
11238
|
method: "POST",
|
|
11050
|
-
body: JSON.stringify(data)
|
|
11239
|
+
body: JSON.stringify(data),
|
|
11240
|
+
headers: { "Content-Type": "application/json" }
|
|
11051
11241
|
});
|
|
11052
11242
|
}
|
|
11053
11243
|
async getDataset(dataset_uuid, include_stats = true, dataset_version, modifiable_version_only) {
|
|
@@ -11060,13 +11250,15 @@ var DataEndpoint = class extends Endpoint {
|
|
|
11060
11250
|
async updateDataset(dataset_uuid, data, start_auto_annotate = true) {
|
|
11061
11251
|
return this.request(`/datasets/${dataset_uuid}?start_auto_annotate=${start_auto_annotate}`, {
|
|
11062
11252
|
method: "PATCH",
|
|
11063
|
-
body: JSON.stringify(data)
|
|
11253
|
+
body: JSON.stringify(data),
|
|
11254
|
+
headers: { "Content-Type": "application/json" }
|
|
11064
11255
|
});
|
|
11065
11256
|
}
|
|
11066
11257
|
async updateDatasetHeroAsset(dataset_uuid, update) {
|
|
11067
11258
|
return this.request(`/datasets/${dataset_uuid}/hero_asset`, {
|
|
11068
11259
|
method: "PATCH",
|
|
11069
|
-
body: JSON.stringify(update)
|
|
11260
|
+
body: JSON.stringify(update),
|
|
11261
|
+
headers: { "Content-Type": "application/json" }
|
|
11070
11262
|
});
|
|
11071
11263
|
}
|
|
11072
11264
|
async deleteDataset(dataset_uuid) {
|
|
@@ -11107,6 +11299,30 @@ var DataEndpoint = class extends Endpoint {
|
|
|
11107
11299
|
method: "DELETE"
|
|
11108
11300
|
});
|
|
11109
11301
|
}
|
|
11302
|
+
async createDatasetAutoAnnotate(create, dataset_uuid, dataset_version) {
|
|
11303
|
+
const versionQuery = dataset_version ? `dataset_version=${dataset_version}&` : "";
|
|
11304
|
+
return this.request(`/datasets/${dataset_uuid}/auto_annotates?${versionQuery}`, {
|
|
11305
|
+
method: "POST",
|
|
11306
|
+
body: JSON.stringify(create),
|
|
11307
|
+
headers: { "Content-Type": "application/json" }
|
|
11308
|
+
});
|
|
11309
|
+
}
|
|
11310
|
+
async updateDatasetAutoAnnotate(update, dataset_uuid, auto_annotate, source, dataset_version) {
|
|
11311
|
+
const versionQuery = dataset_version ? `dataset_version=${dataset_version}&` : "";
|
|
11312
|
+
return this.request(`/datasets/${dataset_uuid}/auto_annotates?auto_annotate=${auto_annotate}&source=${encodeURIComponent(source)}&${versionQuery}`, {
|
|
11313
|
+
method: "PATCH",
|
|
11314
|
+
body: JSON.stringify(update),
|
|
11315
|
+
headers: { "Content-Type": "application/json" }
|
|
11316
|
+
});
|
|
11317
|
+
}
|
|
11318
|
+
async listDatasetAutoAnnotates(dataset_uuid, auto_annotate, source, dataset_version) {
|
|
11319
|
+
const versionQuery = dataset_version ? `dataset_version=${dataset_version}&` : "";
|
|
11320
|
+
const autoAnnotateQuery = auto_annotate ? `auto_annotate=${auto_annotate}&` : "";
|
|
11321
|
+
const sourceQuery = source ? `source=${source}&` : "";
|
|
11322
|
+
return this.request(`/datasets/${dataset_uuid}/auto_annotates?${versionQuery}&${autoAnnotateQuery}&${sourceQuery}`, {
|
|
11323
|
+
method: "GET"
|
|
11324
|
+
});
|
|
11325
|
+
}
|
|
11110
11326
|
// Asset methods
|
|
11111
11327
|
async uploadAsset(dataset_uuid, dataset_version, blob, external_id = void 0) {
|
|
11112
11328
|
const versionQuery = dataset_version ? `&dataset_version=${dataset_version}` : "";
|
|
@@ -11175,7 +11391,8 @@ var DataEndpoint = class extends Endpoint {
|
|
|
11175
11391
|
const datasetQuery = dataset_uuid ? `&dataset_uuid=${dataset_uuid}` : "";
|
|
11176
11392
|
return this.request(`/assets/${asset_uuid}/ground_truth?${datasetQuery}${versionQuery}`, {
|
|
11177
11393
|
method: "PATCH",
|
|
11178
|
-
body: JSON.stringify(predictions)
|
|
11394
|
+
body: JSON.stringify(predictions),
|
|
11395
|
+
headers: { "Content-Type": "application/json" }
|
|
11179
11396
|
});
|
|
11180
11397
|
}
|
|
11181
11398
|
async deleteAssetGroundTruth(asset_uuid, dataset_uuid, dataset_version) {
|
|
@@ -11195,17 +11412,45 @@ var DataEndpoint = class extends Endpoint {
|
|
|
11195
11412
|
method: "PATCH"
|
|
11196
11413
|
});
|
|
11197
11414
|
}
|
|
11198
|
-
async
|
|
11415
|
+
async addAssetAnnotation(asset_uuid, dataset_uuid, dataset_version, predictions, auto_annotate, source, user_review, approved_threshold) {
|
|
11416
|
+
const datasetQuery = dataset_uuid ? `dataset_uuid=${dataset_uuid}&` : "";
|
|
11417
|
+
const versionQuery = dataset_version ? `&dataset_version=${dataset_version}&` : "";
|
|
11418
|
+
const autoAnnotateQuery = auto_annotate ? `&auto_annotate=${auto_annotate}&` : "";
|
|
11419
|
+
const sourceQuery = source ? `&source=${encodeURIComponent(source)}&` : "";
|
|
11420
|
+
const userReviewQuery = user_review ? `&user_review=${user_review}&` : "";
|
|
11421
|
+
const approvedThresholdQuery = typeof approved_threshold !== "undefined" ? `&approved_threshold=${approved_threshold}&` : "";
|
|
11422
|
+
return this.request(`/assets/${asset_uuid}/annotations?${datasetQuery}${versionQuery}${autoAnnotateQuery}${sourceQuery}${userReviewQuery}${approvedThresholdQuery}`, {
|
|
11423
|
+
method: "POST",
|
|
11424
|
+
body: JSON.stringify(predictions),
|
|
11425
|
+
headers: { "Content-Type": "application/json" }
|
|
11426
|
+
});
|
|
11427
|
+
}
|
|
11428
|
+
async updateAssetAnnotationApproval(asset_uuid, dataset_uuid, dataset_version, auto_annotate, source, user_review, approved_threshold) {
|
|
11429
|
+
const datasetQuery = dataset_uuid ? `dataset_uuid=${dataset_uuid}&` : "";
|
|
11430
|
+
const versionQuery = dataset_version ? `&dataset_version=${dataset_version}&` : "";
|
|
11431
|
+
const autoAnnotateQuery = auto_annotate ? `&auto_annotate=${auto_annotate}&` : "";
|
|
11432
|
+
const sourceQuery = source ? `&source=${encodeURIComponent(source)}&` : "";
|
|
11433
|
+
const userReviewQuery = user_review ? `&user_review=${user_review}&` : "";
|
|
11434
|
+
const approvedThresholdQuery = approved_threshold ? `&approved_threshold=${approved_threshold}&` : "";
|
|
11435
|
+
return this.request(`/assets/${asset_uuid}/annotations?${datasetQuery}${versionQuery}${autoAnnotateQuery}${sourceQuery}${userReviewQuery}${approvedThresholdQuery}`, {
|
|
11436
|
+
method: "PATCH"
|
|
11437
|
+
});
|
|
11438
|
+
}
|
|
11439
|
+
async downloadAsset(asset_uuid, dataset_uuid, dataset_version, transcode_mode = "original" /* original */, start_timestamp, end_timestamp, url_type) {
|
|
11199
11440
|
const versionQuery = dataset_version ? `&dataset_version=${dataset_version}` : "";
|
|
11200
11441
|
const datasetQuery = dataset_uuid ? `&dataset_uuid=${dataset_uuid}` : "";
|
|
11201
|
-
|
|
11442
|
+
const startTimestampQuery = start_timestamp ? `&start_timestamp=${start_timestamp}` : "";
|
|
11443
|
+
const endTimestampQuery = end_timestamp ? `&end_timestamp=${end_timestamp}` : "";
|
|
11444
|
+
const urlTypeQuery = url_type ? `&url_type=${url_type}` : "";
|
|
11445
|
+
return this.request(`/assets/${asset_uuid}/download?transcode_mode=${transcode_mode}${datasetQuery}${versionQuery}${startTimestampQuery}${endTimestampQuery}${urlTypeQuery}`, {
|
|
11202
11446
|
method: "GET"
|
|
11203
11447
|
});
|
|
11204
11448
|
}
|
|
11205
11449
|
async previewAutoAnnotateAsset(asset_uuid, auto_annotate, auto_annotate_params) {
|
|
11206
11450
|
return this.request(`/assets/${asset_uuid}/preview_auto_annotate?auto_annotate=${auto_annotate}`, {
|
|
11207
11451
|
method: "POST",
|
|
11208
|
-
body: auto_annotate_params ? JSON.stringify(auto_annotate_params) : null
|
|
11452
|
+
body: auto_annotate_params ? JSON.stringify(auto_annotate_params) : null,
|
|
11453
|
+
headers: auto_annotate_params ? { "Content-Type": "application/json" } : {}
|
|
11209
11454
|
});
|
|
11210
11455
|
}
|
|
11211
11456
|
// Model methods
|
|
@@ -11222,7 +11467,8 @@ var DataEndpoint = class extends Endpoint {
|
|
|
11222
11467
|
async createModel(dataset_uuid, dataset_version, data, start_training = true) {
|
|
11223
11468
|
return this.request(`/models?dataset_uuid=${dataset_uuid}&dataset_version=${dataset_version}&start_training=${start_training}`, {
|
|
11224
11469
|
method: "POST",
|
|
11225
|
-
body: JSON.stringify(data)
|
|
11470
|
+
body: JSON.stringify(data),
|
|
11471
|
+
headers: { "Content-Type": "application/json" }
|
|
11226
11472
|
});
|
|
11227
11473
|
}
|
|
11228
11474
|
async getModel(model_uuid) {
|
|
@@ -11238,7 +11484,8 @@ var DataEndpoint = class extends Endpoint {
|
|
|
11238
11484
|
async updateModel(model_uuid, data) {
|
|
11239
11485
|
return this.request(`/models/${model_uuid}`, {
|
|
11240
11486
|
method: "PATCH",
|
|
11241
|
-
body: JSON.stringify(data)
|
|
11487
|
+
body: JSON.stringify(data),
|
|
11488
|
+
headers: { "Content-Type": "application/json" }
|
|
11242
11489
|
});
|
|
11243
11490
|
}
|
|
11244
11491
|
async deleteModel(model_uuid) {
|
|
@@ -11262,7 +11509,8 @@ var DataEndpoint = class extends Endpoint {
|
|
|
11262
11509
|
}
|
|
11263
11510
|
await this.request(`/models/${model_uuid}/exports/qc_ai_hub`, {
|
|
11264
11511
|
method: "POST",
|
|
11265
|
-
body: JSON.stringify(params)
|
|
11512
|
+
body: JSON.stringify(params),
|
|
11513
|
+
headers: { "Content-Type": "application/json" }
|
|
11266
11514
|
});
|
|
11267
11515
|
}
|
|
11268
11516
|
async downloadModelArtifacts(model_uuid, model_formats, device_name, artifact_type) {
|
|
@@ -11334,7 +11582,8 @@ var DataEndpoint = class extends Endpoint {
|
|
|
11334
11582
|
async startWorkflow(account_uuid, template_name, workflow) {
|
|
11335
11583
|
return this.request(`/workflows?account_uuid=${account_uuid}&template_name=${template_name}`, {
|
|
11336
11584
|
method: "POST",
|
|
11337
|
-
body: JSON.stringify(workflow)
|
|
11585
|
+
body: JSON.stringify(workflow),
|
|
11586
|
+
headers: { "Content-Type": "application/json" }
|
|
11338
11587
|
});
|
|
11339
11588
|
}
|
|
11340
11589
|
async getWorkflow(workflow_id, account_uuid) {
|
|
@@ -11351,6 +11600,61 @@ var DataEndpoint = class extends Endpoint {
|
|
|
11351
11600
|
method: "GET"
|
|
11352
11601
|
});
|
|
11353
11602
|
}
|
|
11603
|
+
async inferAsset(asset_uuid, infer_request, dataset_uuid, dataset_version, transcode_mode, start_timestamp, end_timestamp) {
|
|
11604
|
+
const datasetQuery = dataset_uuid ? `dataset_uuid=${dataset_uuid}&` : "";
|
|
11605
|
+
const versionQuery = dataset_version ? `dataset_version=${dataset_version}&` : "";
|
|
11606
|
+
const transcodeModeQuery = transcode_mode ? `transcode_mode=${transcode_mode}&` : "";
|
|
11607
|
+
const startTimestampQuery = start_timestamp ? `start_timestamp=${start_timestamp}&` : "";
|
|
11608
|
+
const endTimestampQuery = end_timestamp ? `end_timestamp=${end_timestamp}&` : "";
|
|
11609
|
+
const assetUrl = `ai.eyepop://data/assets/${asset_uuid}?${transcodeModeQuery}${datasetQuery}${versionQuery}${startTimestampQuery}${endTimestampQuery}`;
|
|
11610
|
+
if (!this.vlmApiUrl || !this._client || !this._limit) {
|
|
11611
|
+
throw new Error("endpoint not connected, use connect()");
|
|
11612
|
+
}
|
|
11613
|
+
await this._limit.acquire();
|
|
11614
|
+
try {
|
|
11615
|
+
this.updateState();
|
|
11616
|
+
const job = new InferAssetJob(
|
|
11617
|
+
assetUrl,
|
|
11618
|
+
infer_request,
|
|
11619
|
+
async (path2, options) => {
|
|
11620
|
+
return await this.request(path2, options, false, "vlm" /* vlm */);
|
|
11621
|
+
},
|
|
11622
|
+
this._requestLogger
|
|
11623
|
+
);
|
|
11624
|
+
return job.start(() => {
|
|
11625
|
+
this.jobDone(job);
|
|
11626
|
+
});
|
|
11627
|
+
} catch (e) {
|
|
11628
|
+
this._limit.release();
|
|
11629
|
+
throw e;
|
|
11630
|
+
}
|
|
11631
|
+
}
|
|
11632
|
+
async evaluateDataset(evaluate_request, worker_release) {
|
|
11633
|
+
if (!this.vlmApiUrl || !this._client || !this._limit) {
|
|
11634
|
+
throw new Error("endpoint not connected, use connect()");
|
|
11635
|
+
}
|
|
11636
|
+
await this._limit.acquire();
|
|
11637
|
+
try {
|
|
11638
|
+
this.updateState();
|
|
11639
|
+
const job = new EvaluateDatasetJob(
|
|
11640
|
+
evaluate_request,
|
|
11641
|
+
worker_release ?? null,
|
|
11642
|
+
async (path2, options) => {
|
|
11643
|
+
return await this.request(path2, options, false, "vlm" /* vlm */);
|
|
11644
|
+
},
|
|
11645
|
+
this._requestLogger
|
|
11646
|
+
);
|
|
11647
|
+
return job.start(() => {
|
|
11648
|
+
this.jobDone(job);
|
|
11649
|
+
});
|
|
11650
|
+
} catch (e) {
|
|
11651
|
+
this._limit.release();
|
|
11652
|
+
throw e;
|
|
11653
|
+
}
|
|
11654
|
+
}
|
|
11655
|
+
jobDone(job) {
|
|
11656
|
+
this._limit?.release();
|
|
11657
|
+
}
|
|
11354
11658
|
async dispatchChangeEvent(change_event) {
|
|
11355
11659
|
switch (change_event.change_type) {
|
|
11356
11660
|
// account event types
|
|
@@ -11593,13 +11897,17 @@ var index_default = EyePop;
|
|
|
11593
11897
|
AnnotationType,
|
|
11594
11898
|
ArtifactType,
|
|
11595
11899
|
AssetStatus,
|
|
11900
|
+
AssetUrlType,
|
|
11901
|
+
AutoAnnotateStatus,
|
|
11596
11902
|
AutoAnnotateTask,
|
|
11597
11903
|
ChangeType,
|
|
11598
11904
|
ContourType,
|
|
11599
11905
|
DEFAULT_PREDICTION_VERSION,
|
|
11906
|
+
DataApiType,
|
|
11600
11907
|
DataEndpoint,
|
|
11601
11908
|
Endpoint,
|
|
11602
11909
|
EndpointState,
|
|
11910
|
+
EvaluationStatus,
|
|
11603
11911
|
ExportedBy,
|
|
11604
11912
|
EyePop,
|
|
11605
11913
|
EyepopLineDecoder,
|
|
@@ -11631,6 +11939,7 @@ var index_default = EyePop;
|
|
|
11631
11939
|
WebrtcWhip,
|
|
11632
11940
|
WorkerEndpoint,
|
|
11633
11941
|
WorkflowPhase,
|
|
11942
|
+
getBaseUrl,
|
|
11634
11943
|
readableStreamFromString
|
|
11635
11944
|
});
|
|
11636
11945
|
/*! Bundled license information:
|