@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.js
CHANGED
|
@@ -8661,13 +8661,16 @@ __export(index_exports, {
|
|
|
8661
8661
|
ArtifactType: () => ArtifactType,
|
|
8662
8662
|
AssetStatus: () => AssetStatus,
|
|
8663
8663
|
AssetUrlType: () => AssetUrlType,
|
|
8664
|
+
AutoAnnotateStatus: () => AutoAnnotateStatus,
|
|
8664
8665
|
AutoAnnotateTask: () => AutoAnnotateTask,
|
|
8665
8666
|
ChangeType: () => ChangeType,
|
|
8666
8667
|
ContourType: () => ContourType,
|
|
8667
8668
|
DEFAULT_PREDICTION_VERSION: () => DEFAULT_PREDICTION_VERSION,
|
|
8669
|
+
DataApiType: () => DataApiType,
|
|
8668
8670
|
DataEndpoint: () => DataEndpoint,
|
|
8669
8671
|
Endpoint: () => Endpoint,
|
|
8670
8672
|
EndpointState: () => EndpointState,
|
|
8673
|
+
EvaluationStatus: () => EvaluationStatus,
|
|
8671
8674
|
ExportedBy: () => ExportedBy,
|
|
8672
8675
|
EyePop: () => EyePop,
|
|
8673
8676
|
EyepopLineDecoder: () => EyepopLineDecoder,
|
|
@@ -8700,6 +8703,7 @@ __export(index_exports, {
|
|
|
8700
8703
|
WorkerEndpoint: () => WorkerEndpoint,
|
|
8701
8704
|
WorkflowPhase: () => WorkflowPhase,
|
|
8702
8705
|
default: () => index_default,
|
|
8706
|
+
getBaseUrl: () => getBaseUrl,
|
|
8703
8707
|
readableStreamFromString: () => readableStreamFromString
|
|
8704
8708
|
});
|
|
8705
8709
|
module.exports = __toCommonJS(index_exports);
|
|
@@ -10708,6 +10712,28 @@ function urlJoin() {
|
|
|
10708
10712
|
}
|
|
10709
10713
|
|
|
10710
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 || {});
|
|
10711
10737
|
var AssetStatus = /* @__PURE__ */ ((AssetStatus2) => {
|
|
10712
10738
|
AssetStatus2["rejected"] = "rejected";
|
|
10713
10739
|
AssetStatus2["upload_in_progress"] = "upload_in_progress";
|
|
@@ -10846,6 +10872,156 @@ var AssetUrlType = /* @__PURE__ */ ((AssetUrlType3) => {
|
|
|
10846
10872
|
AssetUrlType3["https_signed"] = "https_signed";
|
|
10847
10873
|
return AssetUrlType3;
|
|
10848
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
|
+
};
|
|
10849
11025
|
|
|
10850
11026
|
// data/data_endpoint.ts
|
|
10851
11027
|
var WS_INITIAL_RECONNECT_DELAY = 1e3;
|
|
@@ -10853,7 +11029,8 @@ var WS_MAX_RECONNECT_DELAY = 6e4;
|
|
|
10853
11029
|
var DataEndpoint = class extends Endpoint {
|
|
10854
11030
|
constructor(options) {
|
|
10855
11031
|
super(options);
|
|
10856
|
-
this.
|
|
11032
|
+
this.datasetApiUrl = null;
|
|
11033
|
+
this.vlmApiUrl = null;
|
|
10857
11034
|
this._ws = null;
|
|
10858
11035
|
this._ws_current_reconnect_delay = null;
|
|
10859
11036
|
this._accountId = options.accountId || null;
|
|
@@ -10874,11 +11051,13 @@ var DataEndpoint = class extends Endpoint {
|
|
|
10874
11051
|
accessToken: session.accessToken,
|
|
10875
11052
|
validUntil: session.validUntil,
|
|
10876
11053
|
accountId: this.options().accountId,
|
|
10877
|
-
|
|
11054
|
+
datasetApiUrl: this.datasetApiUrl,
|
|
11055
|
+
vlmApiUrl: this.vlmApiUrl
|
|
10878
11056
|
};
|
|
10879
11057
|
}
|
|
10880
11058
|
async disconnect(wait = true) {
|
|
10881
|
-
this.
|
|
11059
|
+
this.datasetApiUrl = null;
|
|
11060
|
+
this.vlmApiUrl = null;
|
|
10882
11061
|
if (this._ws) {
|
|
10883
11062
|
try {
|
|
10884
11063
|
this._ws.close();
|
|
@@ -10893,7 +11072,9 @@ var DataEndpoint = class extends Endpoint {
|
|
|
10893
11072
|
if (!this._client) {
|
|
10894
11073
|
return Promise.reject("endpoint not initialized");
|
|
10895
11074
|
}
|
|
10896
|
-
|
|
11075
|
+
this._logger.warn("AAA", this.vlmApiUrl);
|
|
11076
|
+
const accountUuidQuery = this._accountId ? `?account_uuid=${this._accountId}` : "";
|
|
11077
|
+
const config_url = `${this.eyepopUrl()}/configs${accountUuidQuery}`;
|
|
10897
11078
|
let headers = {
|
|
10898
11079
|
Authorization: await this.authorizationHeader()
|
|
10899
11080
|
};
|
|
@@ -10913,11 +11094,13 @@ var DataEndpoint = class extends Endpoint {
|
|
|
10913
11094
|
if (response.status != 200) {
|
|
10914
11095
|
this.updateState("Error" /* Error */);
|
|
10915
11096
|
const message = await response.text();
|
|
10916
|
-
return Promise.reject(`Unexpected status ${response.status}: ${message}`);
|
|
11097
|
+
return Promise.reject(`Unexpected status ${response.status} for ${config_url}: ${message}`);
|
|
10917
11098
|
}
|
|
10918
11099
|
let config = await response.json();
|
|
10919
|
-
const
|
|
10920
|
-
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();
|
|
10921
11104
|
if (this.options().disableWs) {
|
|
10922
11105
|
this._logger.info("disabled ws connection");
|
|
10923
11106
|
} else {
|
|
@@ -10925,7 +11108,7 @@ var DataEndpoint = class extends Endpoint {
|
|
|
10925
11108
|
}
|
|
10926
11109
|
if (this.options().useCookie) {
|
|
10927
11110
|
const client = this._client;
|
|
10928
|
-
const url = urlJoin(this.
|
|
11111
|
+
const url = urlJoin(this.datasetApiUrl, "security", "check?set_cookie=true");
|
|
10929
11112
|
const headers2 = {
|
|
10930
11113
|
Authorization: await this.authorizationHeader()
|
|
10931
11114
|
};
|
|
@@ -10946,7 +11129,7 @@ var DataEndpoint = class extends Endpoint {
|
|
|
10946
11129
|
this._ws.close();
|
|
10947
11130
|
this._ws = null;
|
|
10948
11131
|
}
|
|
10949
|
-
const baseUrl = this.
|
|
11132
|
+
const baseUrl = this.datasetApiUrl?.replace("https://", "wss://").replace("http://", "ws://");
|
|
10950
11133
|
if (!baseUrl) {
|
|
10951
11134
|
return;
|
|
10952
11135
|
}
|
|
@@ -11004,16 +11187,15 @@ var DataEndpoint = class extends Endpoint {
|
|
|
11004
11187
|
options() {
|
|
11005
11188
|
return this._options;
|
|
11006
11189
|
}
|
|
11007
|
-
async request(path2, options = {}, disableAuth = false) {
|
|
11190
|
+
async request(path2, options = {}, disableAuth = false, dataApiType = "dataset" /* dataset */) {
|
|
11008
11191
|
const client = this._client;
|
|
11009
|
-
|
|
11010
|
-
if (!baseUrl || !client) {
|
|
11192
|
+
if (!client) {
|
|
11011
11193
|
return Promise.reject("endpoint not connected");
|
|
11012
11194
|
}
|
|
11013
11195
|
let response = await this.fetchWithRetry(async () => {
|
|
11014
11196
|
const session = await this.session();
|
|
11197
|
+
const baseUrl = getBaseUrl(session, dataApiType);
|
|
11015
11198
|
const headers = {
|
|
11016
|
-
"Content-Type": "application/json",
|
|
11017
11199
|
...disableAuth ? {} : { Authorization: `Bearer ${session.accessToken}` },
|
|
11018
11200
|
...options.headers || {}
|
|
11019
11201
|
};
|
|
@@ -11025,8 +11207,8 @@ var DataEndpoint = class extends Endpoint {
|
|
|
11025
11207
|
method: options.method || "GET",
|
|
11026
11208
|
body: options.body
|
|
11027
11209
|
};
|
|
11028
|
-
this._requestLogger.debug("Request - " + ri.method + path2 + " BODY: " + (ri.body ? ri.body : ""));
|
|
11029
|
-
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);
|
|
11030
11212
|
});
|
|
11031
11213
|
if (response.status === 204) {
|
|
11032
11214
|
return null;
|
|
@@ -11054,7 +11236,8 @@ var DataEndpoint = class extends Endpoint {
|
|
|
11054
11236
|
async createDataset(data) {
|
|
11055
11237
|
return this.request(`/datasets?account_uuid=${this._accountId}`, {
|
|
11056
11238
|
method: "POST",
|
|
11057
|
-
body: JSON.stringify(data)
|
|
11239
|
+
body: JSON.stringify(data),
|
|
11240
|
+
headers: { "Content-Type": "application/json" }
|
|
11058
11241
|
});
|
|
11059
11242
|
}
|
|
11060
11243
|
async getDataset(dataset_uuid, include_stats = true, dataset_version, modifiable_version_only) {
|
|
@@ -11067,13 +11250,15 @@ var DataEndpoint = class extends Endpoint {
|
|
|
11067
11250
|
async updateDataset(dataset_uuid, data, start_auto_annotate = true) {
|
|
11068
11251
|
return this.request(`/datasets/${dataset_uuid}?start_auto_annotate=${start_auto_annotate}`, {
|
|
11069
11252
|
method: "PATCH",
|
|
11070
|
-
body: JSON.stringify(data)
|
|
11253
|
+
body: JSON.stringify(data),
|
|
11254
|
+
headers: { "Content-Type": "application/json" }
|
|
11071
11255
|
});
|
|
11072
11256
|
}
|
|
11073
11257
|
async updateDatasetHeroAsset(dataset_uuid, update) {
|
|
11074
11258
|
return this.request(`/datasets/${dataset_uuid}/hero_asset`, {
|
|
11075
11259
|
method: "PATCH",
|
|
11076
|
-
body: JSON.stringify(update)
|
|
11260
|
+
body: JSON.stringify(update),
|
|
11261
|
+
headers: { "Content-Type": "application/json" }
|
|
11077
11262
|
});
|
|
11078
11263
|
}
|
|
11079
11264
|
async deleteDataset(dataset_uuid) {
|
|
@@ -11114,6 +11299,30 @@ var DataEndpoint = class extends Endpoint {
|
|
|
11114
11299
|
method: "DELETE"
|
|
11115
11300
|
});
|
|
11116
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
|
+
}
|
|
11117
11326
|
// Asset methods
|
|
11118
11327
|
async uploadAsset(dataset_uuid, dataset_version, blob, external_id = void 0) {
|
|
11119
11328
|
const versionQuery = dataset_version ? `&dataset_version=${dataset_version}` : "";
|
|
@@ -11182,7 +11391,8 @@ var DataEndpoint = class extends Endpoint {
|
|
|
11182
11391
|
const datasetQuery = dataset_uuid ? `&dataset_uuid=${dataset_uuid}` : "";
|
|
11183
11392
|
return this.request(`/assets/${asset_uuid}/ground_truth?${datasetQuery}${versionQuery}`, {
|
|
11184
11393
|
method: "PATCH",
|
|
11185
|
-
body: JSON.stringify(predictions)
|
|
11394
|
+
body: JSON.stringify(predictions),
|
|
11395
|
+
headers: { "Content-Type": "application/json" }
|
|
11186
11396
|
});
|
|
11187
11397
|
}
|
|
11188
11398
|
async deleteAssetGroundTruth(asset_uuid, dataset_uuid, dataset_version) {
|
|
@@ -11202,23 +11412,45 @@ var DataEndpoint = class extends Endpoint {
|
|
|
11202
11412
|
method: "PATCH"
|
|
11203
11413
|
});
|
|
11204
11414
|
}
|
|
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
|
+
}
|
|
11205
11439
|
async downloadAsset(asset_uuid, dataset_uuid, dataset_version, transcode_mode = "original" /* original */, start_timestamp, end_timestamp, url_type) {
|
|
11206
11440
|
const versionQuery = dataset_version ? `&dataset_version=${dataset_version}` : "";
|
|
11207
11441
|
const datasetQuery = dataset_uuid ? `&dataset_uuid=${dataset_uuid}` : "";
|
|
11208
11442
|
const startTimestampQuery = start_timestamp ? `&start_timestamp=${start_timestamp}` : "";
|
|
11209
11443
|
const endTimestampQuery = end_timestamp ? `&end_timestamp=${end_timestamp}` : "";
|
|
11210
11444
|
const urlTypeQuery = url_type ? `&url_type=${url_type}` : "";
|
|
11211
|
-
return this.request(
|
|
11212
|
-
|
|
11213
|
-
|
|
11214
|
-
method: "GET"
|
|
11215
|
-
}
|
|
11216
|
-
);
|
|
11445
|
+
return this.request(`/assets/${asset_uuid}/download?transcode_mode=${transcode_mode}${datasetQuery}${versionQuery}${startTimestampQuery}${endTimestampQuery}${urlTypeQuery}`, {
|
|
11446
|
+
method: "GET"
|
|
11447
|
+
});
|
|
11217
11448
|
}
|
|
11218
11449
|
async previewAutoAnnotateAsset(asset_uuid, auto_annotate, auto_annotate_params) {
|
|
11219
11450
|
return this.request(`/assets/${asset_uuid}/preview_auto_annotate?auto_annotate=${auto_annotate}`, {
|
|
11220
11451
|
method: "POST",
|
|
11221
|
-
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" } : {}
|
|
11222
11454
|
});
|
|
11223
11455
|
}
|
|
11224
11456
|
// Model methods
|
|
@@ -11235,7 +11467,8 @@ var DataEndpoint = class extends Endpoint {
|
|
|
11235
11467
|
async createModel(dataset_uuid, dataset_version, data, start_training = true) {
|
|
11236
11468
|
return this.request(`/models?dataset_uuid=${dataset_uuid}&dataset_version=${dataset_version}&start_training=${start_training}`, {
|
|
11237
11469
|
method: "POST",
|
|
11238
|
-
body: JSON.stringify(data)
|
|
11470
|
+
body: JSON.stringify(data),
|
|
11471
|
+
headers: { "Content-Type": "application/json" }
|
|
11239
11472
|
});
|
|
11240
11473
|
}
|
|
11241
11474
|
async getModel(model_uuid) {
|
|
@@ -11251,7 +11484,8 @@ var DataEndpoint = class extends Endpoint {
|
|
|
11251
11484
|
async updateModel(model_uuid, data) {
|
|
11252
11485
|
return this.request(`/models/${model_uuid}`, {
|
|
11253
11486
|
method: "PATCH",
|
|
11254
|
-
body: JSON.stringify(data)
|
|
11487
|
+
body: JSON.stringify(data),
|
|
11488
|
+
headers: { "Content-Type": "application/json" }
|
|
11255
11489
|
});
|
|
11256
11490
|
}
|
|
11257
11491
|
async deleteModel(model_uuid) {
|
|
@@ -11275,7 +11509,8 @@ var DataEndpoint = class extends Endpoint {
|
|
|
11275
11509
|
}
|
|
11276
11510
|
await this.request(`/models/${model_uuid}/exports/qc_ai_hub`, {
|
|
11277
11511
|
method: "POST",
|
|
11278
|
-
body: JSON.stringify(params)
|
|
11512
|
+
body: JSON.stringify(params),
|
|
11513
|
+
headers: { "Content-Type": "application/json" }
|
|
11279
11514
|
});
|
|
11280
11515
|
}
|
|
11281
11516
|
async downloadModelArtifacts(model_uuid, model_formats, device_name, artifact_type) {
|
|
@@ -11347,7 +11582,8 @@ var DataEndpoint = class extends Endpoint {
|
|
|
11347
11582
|
async startWorkflow(account_uuid, template_name, workflow) {
|
|
11348
11583
|
return this.request(`/workflows?account_uuid=${account_uuid}&template_name=${template_name}`, {
|
|
11349
11584
|
method: "POST",
|
|
11350
|
-
body: JSON.stringify(workflow)
|
|
11585
|
+
body: JSON.stringify(workflow),
|
|
11586
|
+
headers: { "Content-Type": "application/json" }
|
|
11351
11587
|
});
|
|
11352
11588
|
}
|
|
11353
11589
|
async getWorkflow(workflow_id, account_uuid) {
|
|
@@ -11364,6 +11600,61 @@ var DataEndpoint = class extends Endpoint {
|
|
|
11364
11600
|
method: "GET"
|
|
11365
11601
|
});
|
|
11366
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
|
+
}
|
|
11367
11658
|
async dispatchChangeEvent(change_event) {
|
|
11368
11659
|
switch (change_event.change_type) {
|
|
11369
11660
|
// account event types
|
|
@@ -11607,13 +11898,16 @@ var index_default = EyePop;
|
|
|
11607
11898
|
ArtifactType,
|
|
11608
11899
|
AssetStatus,
|
|
11609
11900
|
AssetUrlType,
|
|
11901
|
+
AutoAnnotateStatus,
|
|
11610
11902
|
AutoAnnotateTask,
|
|
11611
11903
|
ChangeType,
|
|
11612
11904
|
ContourType,
|
|
11613
11905
|
DEFAULT_PREDICTION_VERSION,
|
|
11906
|
+
DataApiType,
|
|
11614
11907
|
DataEndpoint,
|
|
11615
11908
|
Endpoint,
|
|
11616
11909
|
EndpointState,
|
|
11910
|
+
EvaluationStatus,
|
|
11617
11911
|
ExportedBy,
|
|
11618
11912
|
EyePop,
|
|
11619
11913
|
EyepopLineDecoder,
|
|
@@ -11645,6 +11939,7 @@ var index_default = EyePop;
|
|
|
11645
11939
|
WebrtcWhip,
|
|
11646
11940
|
WorkerEndpoint,
|
|
11647
11941
|
WorkflowPhase,
|
|
11942
|
+
getBaseUrl,
|
|
11648
11943
|
readableStreamFromString
|
|
11649
11944
|
});
|
|
11650
11945
|
/*! Bundled license information:
|