@gradio/client 2.6.0 → 2.7.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/CHANGELOG.md +16 -0
- package/dist/browser.js +374 -340
- package/dist/client.d.ts +1 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/helpers/data.d.ts +9 -0
- package/dist/helpers/data.d.ts.map +1 -1
- package/dist/helpers/init_helpers.d.ts.map +1 -1
- package/dist/index.cjs +70 -14
- package/dist/index.js +70 -14
- package/dist/index.min.js +414 -380
- package/dist/utils/submit.d.ts.map +1 -1
- package/dist/utils/view_api.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/client.ts +19 -15
- package/src/helpers/data.ts +77 -0
- package/src/helpers/init_helpers.ts +8 -10
- package/src/test/data.test.ts +95 -0
- package/src/test/init.test.ts +47 -1
- package/src/test/server.ts +3 -0
- package/src/test/submit.test.ts +77 -1
- package/src/utils/submit.ts +26 -10
- package/src/utils/view_api.ts +4 -1
package/dist/browser.js
CHANGED
|
@@ -8,10 +8,10 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
|
|
|
8
8
|
}, c = (n, r, a) => (a = n == null ? {} : e(i(n)), s(r || !n || !n.__esModule ? t(a, "default", {
|
|
9
9
|
value: n,
|
|
10
10
|
enumerable: !0
|
|
11
|
-
}) : a, n)), l = "host", u = "queue/data", d = "queue/join", f = "upload", p = "login", m = "config",
|
|
11
|
+
}) : a, n)), l = "host", u = "queue/data", d = "queue/join", f = "upload", p = "login", m = "config", ee = "info", te = "runtime", ne = "sleeptime", h = "heartbeat", re = "component_server", ie = "reset", ae = "cancel", g = "app_id", oe = "This application is currently busy. Please try again. ", _ = "Connection errored out. ", v = "Could not resolve app config. ", y = "Could not get space status. ", se = "Could not get API info. ", b = "Space metadata could not be loaded. ", ce = "Invalid URL. A full URL path is required.", x = "Not authorized to access this space. ", S = "Invalid credentials. Could not login. ", C = "Login credentials are required to access this space.", le = "Could not access this app (received a 401 response). If it is a private Hugging Face Space, pass a valid Hugging Face token to the `token` option of `Client.connect`. You can generate a token at https://huggingface.co/settings/tokens.", w = (e, t) => `Space "${e}" could not be accessed (received a ${t} response from the Hugging Face API). Check that the Space name is spelled correctly and that the Space exists. If the Space is private, pass a valid Hugging Face token to the \`token\` option of \`Client.connect\`. You can generate a token at https://huggingface.co/settings/tokens.`, ue = "No API information is available for this app. This can happen when the app's `/info` endpoint cannot be reached, or when the app is running a legacy version of Gradio that is not supported by this client. ", de = "This app appears to be running a legacy version of Gradio (3.x or earlier) that communicates over WebSockets, which is not supported by this version of @gradio/client. Please upgrade the app to a newer version of Gradio, or connect to it with @gradio/client version 0.x.", fe = "File system access is only available in Node.js environments", pe = "Root URL not found in client config", me = "Error uploading file";
|
|
12
12
|
//#endregion
|
|
13
13
|
//#region src/helpers/init_helpers.ts
|
|
14
|
-
async function
|
|
14
|
+
async function he(e, t, n) {
|
|
15
15
|
try {
|
|
16
16
|
return (await (await fetch(`https://huggingface.co/api/spaces/${e}/jwt`, { headers: {
|
|
17
17
|
Authorization: `Bearer ${t}`,
|
|
@@ -21,10 +21,10 @@ async function T(e, t, n) {
|
|
|
21
21
|
return !1;
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
|
-
function
|
|
24
|
+
function T(e) {
|
|
25
25
|
e.hf_token && !e.token && (e.token = e.hf_token, console.warn("The `hf_token` option has been renamed to `token`. Support for `hf_token` will be removed in a future version of @gradio/client."));
|
|
26
26
|
}
|
|
27
|
-
function
|
|
27
|
+
function E(e) {
|
|
28
28
|
let t = {};
|
|
29
29
|
return e.forEach(({ api_name: e, id: n }) => {
|
|
30
30
|
e && (t[e] = n);
|
|
@@ -34,11 +34,13 @@ function ge(e, t, n = !1) {
|
|
|
34
34
|
let r = new URL(t), i = new URL(e, r), a = i.hostname.endsWith(".colab-user-runtimes.internal") || i.hostname.endsWith(".codatalab-user-runtimes.internal");
|
|
35
35
|
return n || a ? new URL(new URL(e, r).pathname, r).toString().replace(/\/$/, "") : i.hostname === r.hostname ? (i.protocol = r.protocol, i.host = r.host, i.toString().replace(/\/$/, "")) : e;
|
|
36
36
|
}
|
|
37
|
-
async function
|
|
37
|
+
async function D(e, t = !0) {
|
|
38
38
|
let n = this.options.token ? { Authorization: `Bearer ${this.options.token}` } : {};
|
|
39
39
|
if (typeof window < "u" && window.gradio_config && location.origin !== "http://localhost:9876") {
|
|
40
40
|
if (t && window.gradio_config.current_page && (e = e.substring(0, e.lastIndexOf("/"))), window.gradio_config.dev_mode || typeof window < "u" && window?.BUILD_MODE === "dev") {
|
|
41
|
-
let t =
|
|
41
|
+
let t = new URL(F(e, m));
|
|
42
|
+
this.deep_link && t.searchParams.set("deep_link", this.deep_link), this.page !== null && t.searchParams.set("page", this.page);
|
|
43
|
+
let r = await _e(await this.fetch(t, {
|
|
42
44
|
headers: n,
|
|
43
45
|
credentials: this.options.credentials ?? "same-origin"
|
|
44
46
|
}), !!this.options.auth);
|
|
@@ -50,7 +52,9 @@ async function _e(e, t = !0) {
|
|
|
50
52
|
let r = { ...window.gradio_config };
|
|
51
53
|
return r.root = ge(r.root, location.href, r.is_colab), r;
|
|
52
54
|
} else if (e) {
|
|
53
|
-
let t =
|
|
55
|
+
let t = new URL(F(e, m));
|
|
56
|
+
this.deep_link && t.searchParams.set("deep_link", this.deep_link), this.page !== null && t.searchParams.set("page", this.page);
|
|
57
|
+
let r = await _e(await this.fetch(t, {
|
|
54
58
|
headers: n,
|
|
55
59
|
credentials: this.options.credentials ?? "same-origin"
|
|
56
60
|
}), !!this.options.auth);
|
|
@@ -58,13 +62,13 @@ async function _e(e, t = !0) {
|
|
|
58
62
|
}
|
|
59
63
|
throw Error(v);
|
|
60
64
|
}
|
|
61
|
-
async function
|
|
65
|
+
async function _e(e, t) {
|
|
62
66
|
if (e?.status === 401 && !t) {
|
|
63
67
|
let t = null;
|
|
64
68
|
try {
|
|
65
69
|
t = await e.json();
|
|
66
70
|
} catch {
|
|
67
|
-
throw Error(
|
|
71
|
+
throw Error(le);
|
|
68
72
|
}
|
|
69
73
|
let n = t?.detail?.auth_message;
|
|
70
74
|
throw Error(n || "Login credentials are required to access this space.");
|
|
@@ -74,11 +78,11 @@ async function D(e, t) {
|
|
|
74
78
|
return t.dependencies?.forEach((e, t) => {
|
|
75
79
|
e.id === void 0 && (e.id = t);
|
|
76
80
|
}), t;
|
|
77
|
-
} else if (e?.status === 401) throw Error(
|
|
81
|
+
} else if (e?.status === 401) throw Error(x);
|
|
78
82
|
throw Error(`${v}(received status ${e?.status} when fetching the app config)`);
|
|
79
83
|
}
|
|
80
84
|
async function O() {
|
|
81
|
-
let { http_protocol: e, host: t } = await
|
|
85
|
+
let { http_protocol: e, host: t } = await P(this.app_reference, this.options.token);
|
|
82
86
|
try {
|
|
83
87
|
if (this.options.auth) {
|
|
84
88
|
let n = await k(e, t, this.options.auth, this.fetch, this.options.token, this.options.credentials);
|
|
@@ -123,8 +127,8 @@ var j = (e) => {
|
|
|
123
127
|
let [n, r] = e.split(";")[0].split("=");
|
|
124
128
|
n && r && t.push(`${n.trim()}=${r.trim()}`);
|
|
125
129
|
}), t;
|
|
126
|
-
}, M = /^[a-zA-Z0-9_\-\.]+\/[a-zA-Z0-9_\-\.]+$/,
|
|
127
|
-
async function
|
|
130
|
+
}, M = /^[a-zA-Z0-9_\-\.]+\/[a-zA-Z0-9_\-\.]+$/, N = /.*hf\.space\/{0,1}.*$/;
|
|
131
|
+
async function P(e, t) {
|
|
128
132
|
let n = {};
|
|
129
133
|
t && (n.Authorization = `Bearer ${t}`);
|
|
130
134
|
let r = e.trim().replace(/\/$/, "");
|
|
@@ -135,7 +139,7 @@ async function N(e, t) {
|
|
|
135
139
|
} catch {
|
|
136
140
|
throw Error(b);
|
|
137
141
|
}
|
|
138
|
-
if (e.status === 401 || e.status === 404) throw Error(
|
|
142
|
+
if (e.status === 401 || e.status === 404) throw Error(w(r, e.status));
|
|
139
143
|
let t;
|
|
140
144
|
try {
|
|
141
145
|
t = (await e.json()).host;
|
|
@@ -148,7 +152,7 @@ async function N(e, t) {
|
|
|
148
152
|
...A(t)
|
|
149
153
|
};
|
|
150
154
|
}
|
|
151
|
-
if (
|
|
155
|
+
if (N.test(r)) {
|
|
152
156
|
let { ws_protocol: e, http_protocol: t, host: n } = A(r);
|
|
153
157
|
return {
|
|
154
158
|
space_id: n.split("/")[0].replace(".hf.space", ""),
|
|
@@ -162,14 +166,14 @@ async function N(e, t) {
|
|
|
162
166
|
...A(r)
|
|
163
167
|
};
|
|
164
168
|
}
|
|
165
|
-
var
|
|
169
|
+
var F = (...e) => {
|
|
166
170
|
try {
|
|
167
171
|
return e.reduce((e, t) => (e = e.replace(/\/+$/, ""), t = t.replace(/^\/+/, ""), new URL(t, e + "/").toString()));
|
|
168
172
|
} catch {
|
|
169
|
-
throw Error(
|
|
173
|
+
throw Error(ce);
|
|
170
174
|
}
|
|
171
175
|
};
|
|
172
|
-
function
|
|
176
|
+
function ve(e, t, n) {
|
|
173
177
|
let r = {
|
|
174
178
|
named_endpoints: {},
|
|
175
179
|
unnamed_endpoints: {}
|
|
@@ -199,8 +203,8 @@ function F(e, t, n) {
|
|
|
199
203
|
}
|
|
200
204
|
let d = (e, t, n, r) => ({
|
|
201
205
|
...e,
|
|
202
|
-
description:
|
|
203
|
-
type:
|
|
206
|
+
description: ye(e?.type, n),
|
|
207
|
+
type: I(e?.type, t, n, r) || ""
|
|
204
208
|
});
|
|
205
209
|
r[i][e] = {
|
|
206
210
|
parameters: o.map((e) => d(e, e?.component, e?.serializer, "parameter")),
|
|
@@ -211,7 +215,7 @@ function F(e, t, n) {
|
|
|
211
215
|
}));
|
|
212
216
|
}), r;
|
|
213
217
|
}
|
|
214
|
-
function
|
|
218
|
+
function I(e, t, n, r) {
|
|
215
219
|
if (t === "Api") return e.type;
|
|
216
220
|
switch (e?.type) {
|
|
217
221
|
case "string": return "string";
|
|
@@ -224,10 +228,10 @@ function ye(e, t, n, r) {
|
|
|
224
228
|
if (n === "FileSerializable") return e?.type === "array" ? r === "parameter" ? "(Blob | File | Buffer)[]" : "{ name: string; data: string; size?: number; is_file?: boolean; orig_name?: string}[]" : r === "parameter" ? "Blob | File | Buffer" : "{ name: string; data: string; size?: number; is_file?: boolean; orig_name?: string}";
|
|
225
229
|
if (n === "GallerySerializable") return r === "parameter" ? "[(Blob | File | Buffer), (string | null)][]" : "[{ name: string; data: string; size?: number; is_file?: boolean; orig_name?: string}, (string | null))][]";
|
|
226
230
|
}
|
|
227
|
-
function
|
|
231
|
+
function ye(e, t) {
|
|
228
232
|
return t === "GallerySerializable" ? "array of [file, label] tuples" : t === "ListStringSerializable" ? "array of strings" : t === "FileSerializable" ? "array of files or single file" : e?.description;
|
|
229
233
|
}
|
|
230
|
-
function
|
|
234
|
+
function be(e, t) {
|
|
231
235
|
switch (e.msg) {
|
|
232
236
|
case "send_data": return { type: "data" };
|
|
233
237
|
case "send_hash": return { type: "hash" };
|
|
@@ -363,7 +367,7 @@ function xe(e, t) {
|
|
|
363
367
|
}
|
|
364
368
|
};
|
|
365
369
|
}
|
|
366
|
-
var
|
|
370
|
+
var xe = (e = [], t) => {
|
|
367
371
|
let n = t ? t.parameters : [];
|
|
368
372
|
if (Array.isArray(e)) return t && n.length > 0 && e.length > n.length && console.warn("Too many arguments provided for the endpoint."), e;
|
|
369
373
|
let r = [], i = Object.keys(e);
|
|
@@ -379,28 +383,28 @@ var Se = (e = [], t) => {
|
|
|
379
383
|
};
|
|
380
384
|
//#endregion
|
|
381
385
|
//#region src/utils/view_api.ts
|
|
382
|
-
async function
|
|
386
|
+
async function Se() {
|
|
383
387
|
if (this.api_info) return this.api_info;
|
|
384
388
|
let { token: e } = this.options, { config: t } = this, n = {};
|
|
385
389
|
if (e && (n.Authorization = `Bearer ${e}`), t) try {
|
|
386
390
|
let e, r;
|
|
387
391
|
if (typeof window < "u" && window.gradio_api_info) r = window.gradio_api_info;
|
|
388
392
|
else {
|
|
389
|
-
let i =
|
|
390
|
-
if (e = await this.fetch(i, {
|
|
393
|
+
let i = new URL(F(t.root, this.api_prefix, ee));
|
|
394
|
+
if (this.page !== null && i.searchParams.set("page", this.page), e = await this.fetch(i, {
|
|
391
395
|
headers: n,
|
|
392
396
|
credentials: this.options.credentials ?? "same-origin"
|
|
393
397
|
}), !e.ok) throw Error(_);
|
|
394
398
|
r = await e.json();
|
|
395
399
|
}
|
|
396
|
-
return "api" in r && (r = r.api), r.named_endpoints["/predict"] && !r.unnamed_endpoints[0] && (r.unnamed_endpoints[0] = r.named_endpoints["/predict"]),
|
|
400
|
+
return "api" in r && (r = r.api), r.named_endpoints["/predict"] && !r.unnamed_endpoints[0] && (r.unnamed_endpoints[0] = r.named_endpoints["/predict"]), ve(r, t, this.api_map);
|
|
397
401
|
} catch (e) {
|
|
398
402
|
throw Error("Could not get API info. " + e.message);
|
|
399
403
|
}
|
|
400
404
|
}
|
|
401
405
|
//#endregion
|
|
402
406
|
//#region src/utils/upload_files.ts
|
|
403
|
-
async function
|
|
407
|
+
async function L(e, t, n) {
|
|
404
408
|
let r = {};
|
|
405
409
|
this?.options?.token && (r.Authorization = `Bearer ${this.options.token}`);
|
|
406
410
|
let i = 1e3, a = [], o;
|
|
@@ -429,7 +433,7 @@ async function I(e, t, n) {
|
|
|
429
433
|
}
|
|
430
434
|
return { files: a };
|
|
431
435
|
}
|
|
432
|
-
var
|
|
436
|
+
var R = {
|
|
433
437
|
si: {
|
|
434
438
|
radix: 1e3,
|
|
435
439
|
unit: [
|
|
@@ -473,9 +477,9 @@ var L = {
|
|
|
473
477
|
]
|
|
474
478
|
}
|
|
475
479
|
};
|
|
476
|
-
function
|
|
480
|
+
function Ce(e, t = 1, n = "jedec") {
|
|
477
481
|
e = Math.abs(e);
|
|
478
|
-
let { radix: r, unit: i } =
|
|
482
|
+
let { radix: r, unit: i } = R[n] || R.jedec, a = 0;
|
|
479
483
|
for (; e >= r;) e /= r, ++a;
|
|
480
484
|
return `${e.toFixed(t)} ${i[a]}`;
|
|
481
485
|
}
|
|
@@ -483,7 +487,7 @@ function R(e, t = 1, n = "jedec") {
|
|
|
483
487
|
//#region src/upload.ts
|
|
484
488
|
async function z(e, t, n, r) {
|
|
485
489
|
let i = (Array.isArray(e) ? e : [e]).map((e) => e.blob), a = i.filter((e) => e.size > (r ?? Infinity));
|
|
486
|
-
if (a.length) throw Error(`File(s) exceed the maximum allowed size of ${
|
|
490
|
+
if (a.length) throw Error(`File(s) exceed the maximum allowed size of ${Ce(r || Infinity)}: ${a.map((e) => `"${e.name}"`).join(", ")}`);
|
|
487
491
|
return await Promise.all(await this.upload_files(t, i, n).then(async (n) => {
|
|
488
492
|
if (n.error) throw Error(n.error);
|
|
489
493
|
return n.files ? n.files.map((n, r) => {
|
|
@@ -520,7 +524,7 @@ var V = class {
|
|
|
520
524
|
constructor({ path: e, url: t, orig_name: n, size: r, blob: i, is_stream: a, mime_type: o, alt_text: s, b64: c }) {
|
|
521
525
|
this.path = e, this.url = t, this.orig_name = n, this.size = r, this.blob = t ? void 0 : i, this.is_stream = a, this.mime_type = o, this.alt_text = s, this.b64 = c;
|
|
522
526
|
}
|
|
523
|
-
},
|
|
527
|
+
}, H = class {
|
|
524
528
|
type;
|
|
525
529
|
command;
|
|
526
530
|
meta;
|
|
@@ -528,8 +532,8 @@ var V = class {
|
|
|
528
532
|
constructor(e, t) {
|
|
529
533
|
this.type = "command", this.command = e, this.meta = t;
|
|
530
534
|
}
|
|
531
|
-
},
|
|
532
|
-
function
|
|
535
|
+
}, we = typeof process < "u" && process.versions && process.versions.node;
|
|
536
|
+
function Te(e, t, n) {
|
|
533
537
|
for (; n.length > 1;) {
|
|
534
538
|
let t = n.shift();
|
|
535
539
|
if (typeof t == "string" || typeof t == "number") e = e[t];
|
|
@@ -583,7 +587,7 @@ function Oe(e) {
|
|
|
583
587
|
orig_name: e.split("/").pop() ?? "unknown",
|
|
584
588
|
meta: { _type: "gradio.FileData" }
|
|
585
589
|
};
|
|
586
|
-
if (
|
|
590
|
+
if (we) return new H("upload_file", {
|
|
587
591
|
path: e,
|
|
588
592
|
name: e,
|
|
589
593
|
orig_path: e
|
|
@@ -616,11 +620,35 @@ function W(e, t, n, r, i = !1) {
|
|
|
616
620
|
}
|
|
617
621
|
return a;
|
|
618
622
|
}
|
|
623
|
+
var ke = [
|
|
624
|
+
"/file=",
|
|
625
|
+
"/file/",
|
|
626
|
+
"/stream/",
|
|
627
|
+
"/proxy="
|
|
628
|
+
];
|
|
629
|
+
function Ae(e, t, n, r) {
|
|
630
|
+
if (!r || typeof e != "object" || !e) return;
|
|
631
|
+
let i = r, a = new URL(t), o = a.pathname.replace(/\/+$/, ""), s = n ? `/${n.replace(/^\/+|\/+$/g, "")}` : "", c = new Set([`${o}${s}`, s]);
|
|
632
|
+
s || (c.add(`${o}/gradio_api`), c.add("/gradio_api"));
|
|
633
|
+
function l(e) {
|
|
634
|
+
if (typeof e != "object" || !e) return;
|
|
635
|
+
let t = e;
|
|
636
|
+
if (t.meta?._type === "gradio.FileData" && typeof t.url == "string") {
|
|
637
|
+
let e = new URL(t.url, `${a.toString().replace(/\/$/, "")}/`), n = [...c].some((t) => ke.some((n) => e.pathname.startsWith(`${t}${n}`)));
|
|
638
|
+
(e.protocol === "http:" || e.protocol === "https:") && e.origin === a.origin && n && (e.searchParams.set("__sign", i), t.url = e.toString());
|
|
639
|
+
}
|
|
640
|
+
for (let e of Object.values(t)) l(e);
|
|
641
|
+
}
|
|
642
|
+
l(e);
|
|
643
|
+
}
|
|
644
|
+
function je(e, t) {
|
|
645
|
+
for (let n of e.components || []) Ae(n.props?.value, e.root, e.api_prefix || "", t);
|
|
646
|
+
}
|
|
619
647
|
//#endregion
|
|
620
648
|
//#region src/utils/handle_blob.ts
|
|
621
|
-
async function
|
|
649
|
+
async function Me(e, t, n) {
|
|
622
650
|
let r = this;
|
|
623
|
-
await
|
|
651
|
+
await Ne(r, t);
|
|
624
652
|
let i = await U(t, void 0, [], !0, n);
|
|
625
653
|
return (await Promise.all(i.map(async ({ path: t, blob: n, type: i }) => {
|
|
626
654
|
if (!n) return {
|
|
@@ -635,28 +663,28 @@ async function ke(e, t, n) {
|
|
|
635
663
|
name: typeof File < "u" && n instanceof File ? n?.name : void 0
|
|
636
664
|
};
|
|
637
665
|
}))).forEach(({ path: e, file_url: n, type: r, name: i }) => {
|
|
638
|
-
r === "Gallery" ?
|
|
666
|
+
r === "Gallery" ? Te(t, n, e) : n && Te(t, new V({
|
|
639
667
|
path: n,
|
|
640
668
|
orig_name: i
|
|
641
669
|
}), e);
|
|
642
670
|
}), t;
|
|
643
671
|
}
|
|
644
|
-
async function
|
|
645
|
-
if (!(e.config?.root || e.config?.root_url)) throw Error(
|
|
646
|
-
await
|
|
672
|
+
async function Ne(e, t) {
|
|
673
|
+
if (!(e.config?.root || e.config?.root_url)) throw Error(pe);
|
|
674
|
+
await Pe(e, t);
|
|
647
675
|
}
|
|
648
|
-
async function
|
|
649
|
-
for (let r in t) t[r] instanceof
|
|
676
|
+
async function Pe(e, t, n = []) {
|
|
677
|
+
for (let r in t) t[r] instanceof H ? await Fe(e, t, r) : typeof t[r] == "object" && t[r] !== null && await Pe(e, t[r], [...n, r]);
|
|
650
678
|
}
|
|
651
|
-
async function
|
|
679
|
+
async function Fe(e, t, n) {
|
|
652
680
|
let r = t[n], i = e.config?.root || e.config?.root_url;
|
|
653
|
-
if (!i) throw Error(
|
|
681
|
+
if (!i) throw Error(pe);
|
|
654
682
|
try {
|
|
655
683
|
let a, o;
|
|
656
684
|
if (typeof process < "u" && process.versions && process.versions.node) {
|
|
657
685
|
let e = await import("./__vite-browser-external-Cgmn0awE.js").then((e) => /* @__PURE__ */ c(e.default, 1));
|
|
658
686
|
o = (await import("./__vite-browser-external-Cgmn0awE.js").then((e) => /* @__PURE__ */ c(e.default, 1))).resolve(process.cwd(), r.meta.path), a = await e.readFile(o);
|
|
659
|
-
} else throw Error(
|
|
687
|
+
} else throw Error(fe);
|
|
660
688
|
let s = new Blob([a], { type: "application/octet-stream" }), l = await e.upload_files(i, [s]), u = l.files && l.files[0];
|
|
661
689
|
u && (t[n] = new V({
|
|
662
690
|
path: u,
|
|
@@ -668,7 +696,7 @@ async function Me(e, t, n) {
|
|
|
668
696
|
}
|
|
669
697
|
//#endregion
|
|
670
698
|
//#region src/utils/post_data.ts
|
|
671
|
-
async function
|
|
699
|
+
async function Ie(e, t, n) {
|
|
672
700
|
let r = { "Content-Type": "application/json" };
|
|
673
701
|
this.options.token && (r.Authorization = `Bearer ${this.options.token}`);
|
|
674
702
|
try {
|
|
@@ -694,7 +722,7 @@ async function Ne(e, t, n) {
|
|
|
694
722
|
}
|
|
695
723
|
//#endregion
|
|
696
724
|
//#region src/utils/predict.ts
|
|
697
|
-
async function
|
|
725
|
+
async function Le(e, t = {}) {
|
|
698
726
|
let n = !1, r = !1;
|
|
699
727
|
if (!this.config) throw Error("Could not resolve app config");
|
|
700
728
|
if (typeof e == "number") this.config.dependencies.find((t) => t.id == e);
|
|
@@ -751,7 +779,7 @@ async function G(e, t, n) {
|
|
|
751
779
|
load_status: "error",
|
|
752
780
|
message: "This space has been paused by the author. If you would like to try this demo, consider duplicating the space.",
|
|
753
781
|
detail: o,
|
|
754
|
-
discussions_enabled: await
|
|
782
|
+
discussions_enabled: await Be(s)
|
|
755
783
|
});
|
|
756
784
|
break;
|
|
757
785
|
case "RUNNING":
|
|
@@ -789,34 +817,34 @@ async function G(e, t, n) {
|
|
|
789
817
|
load_status: "error",
|
|
790
818
|
message: "This space is experiencing an issue.",
|
|
791
819
|
detail: o,
|
|
792
|
-
discussions_enabled: await
|
|
820
|
+
discussions_enabled: await Be(s)
|
|
793
821
|
});
|
|
794
822
|
break;
|
|
795
823
|
}
|
|
796
824
|
}
|
|
797
|
-
var
|
|
825
|
+
var Re = async (e, t) => {
|
|
798
826
|
let n = 0;
|
|
799
827
|
return new Promise((r) => {
|
|
800
828
|
G(e, M.test(e) ? "space_name" : "subdomain", (i) => {
|
|
801
829
|
t(i), i.status === "running" || i.status === "error" || i.status === "paused" || i.status === "space_error" ? r() : (i.status === "sleeping" || i.status === "building") && (n < 12 ? (n++, setTimeout(() => {
|
|
802
|
-
|
|
830
|
+
Re(e, t).then(r);
|
|
803
831
|
}, 5e3)) : r());
|
|
804
832
|
});
|
|
805
833
|
});
|
|
806
|
-
},
|
|
807
|
-
async function
|
|
834
|
+
}, ze = /^(?=[^]*\b[dD]iscussions{0,1}\b)(?=[^]*\b[dD]isabled\b)[^]*$/;
|
|
835
|
+
async function Be(e) {
|
|
808
836
|
try {
|
|
809
837
|
let t = await fetch(`https://huggingface.co/api/spaces/${e}/discussions`, { method: "HEAD" }), n = t.headers.get("x-error-message");
|
|
810
|
-
return !(!t.ok || n &&
|
|
838
|
+
return !(!t.ok || n && ze.test(n));
|
|
811
839
|
} catch {
|
|
812
840
|
return !1;
|
|
813
841
|
}
|
|
814
842
|
}
|
|
815
|
-
async function
|
|
843
|
+
async function Ve(e, t) {
|
|
816
844
|
let n = {};
|
|
817
845
|
t && (n.Authorization = `Bearer ${t}`);
|
|
818
846
|
try {
|
|
819
|
-
let t = await fetch(`https://huggingface.co/api/spaces/${e}/${
|
|
847
|
+
let t = await fetch(`https://huggingface.co/api/spaces/${e}/${te}`, { headers: n });
|
|
820
848
|
if (t.status !== 200) throw Error("Space hardware could not be obtained.");
|
|
821
849
|
let { hardware: r } = await t.json();
|
|
822
850
|
return r.current;
|
|
@@ -824,12 +852,12 @@ async function Re(e, t) {
|
|
|
824
852
|
throw Error(e.message);
|
|
825
853
|
}
|
|
826
854
|
}
|
|
827
|
-
async function
|
|
855
|
+
async function He(e, t, n) {
|
|
828
856
|
let r = {};
|
|
829
857
|
n && (r.Authorization = `Bearer ${n}`);
|
|
830
858
|
let i = { seconds: t };
|
|
831
859
|
try {
|
|
832
|
-
let t = await fetch(`https://huggingface.co/api/spaces/${e}/${
|
|
860
|
+
let t = await fetch(`https://huggingface.co/api/spaces/${e}/${ne}`, {
|
|
833
861
|
method: "POST",
|
|
834
862
|
headers: {
|
|
835
863
|
"Content-Type": "application/json",
|
|
@@ -843,7 +871,7 @@ async function ze(e, t, n) {
|
|
|
843
871
|
throw Error(e.message);
|
|
844
872
|
}
|
|
845
873
|
}
|
|
846
|
-
var
|
|
874
|
+
var Ue = [
|
|
847
875
|
"cpu-basic",
|
|
848
876
|
"cpu-upgrade",
|
|
849
877
|
"cpu-xl",
|
|
@@ -860,11 +888,11 @@ var Be = [
|
|
|
860
888
|
];
|
|
861
889
|
//#endregion
|
|
862
890
|
//#region src/utils/duplicate.ts
|
|
863
|
-
async function
|
|
864
|
-
|
|
891
|
+
async function We(e, t) {
|
|
892
|
+
T(t);
|
|
865
893
|
let { token: n, private: r, hardware: i, timeout: a, auth: o } = t;
|
|
866
|
-
if (i && !
|
|
867
|
-
let { http_protocol: s, host: c } = await
|
|
894
|
+
if (i && !Ue.includes(i)) throw Error(`Invalid hardware type provided. Valid types are: ${Ue.map((e) => `"${e}"`).join(",")}.`);
|
|
895
|
+
let { http_protocol: s, host: c } = await P(e, n), l = null;
|
|
868
896
|
if (o) {
|
|
869
897
|
let e = await k(s, c, o, fetch, void 0, t.credentials);
|
|
870
898
|
e && (l = j(e));
|
|
@@ -877,7 +905,7 @@ async function Ve(e, t) {
|
|
|
877
905
|
r && (p.private = !0);
|
|
878
906
|
let m;
|
|
879
907
|
try {
|
|
880
|
-
i || (m = await
|
|
908
|
+
i || (m = await Ve(e, n));
|
|
881
909
|
} catch (e) {
|
|
882
910
|
throw Error(b + e.message);
|
|
883
911
|
}
|
|
@@ -895,35 +923,35 @@ async function Ve(e, t) {
|
|
|
895
923
|
}
|
|
896
924
|
else if (r.status !== 200) throw Error(r.statusText);
|
|
897
925
|
let i = await r.json();
|
|
898
|
-
return await
|
|
926
|
+
return await He(`${d}/${f}`, a || 300, n), await Q.connect(Ge(i.url), t);
|
|
899
927
|
} catch (e) {
|
|
900
928
|
throw Error(e);
|
|
901
929
|
}
|
|
902
930
|
}
|
|
903
|
-
function
|
|
931
|
+
function Ge(e) {
|
|
904
932
|
let t = e.match(/https:\/\/huggingface.co\/spaces\/([^/]+\/[^/]+)/);
|
|
905
933
|
if (t) return t[1];
|
|
906
934
|
}
|
|
907
935
|
//#endregion
|
|
908
936
|
//#region src/helpers/zerogpu.ts
|
|
909
|
-
var
|
|
910
|
-
function
|
|
937
|
+
var Ke = "supports-zerogpu-headers", qe = !1;
|
|
938
|
+
function Je() {
|
|
911
939
|
return typeof window < "u" && typeof document < "u" && typeof window.addEventListener == "function";
|
|
912
940
|
}
|
|
913
|
-
function
|
|
941
|
+
function Ye(e) {
|
|
914
942
|
return e.includes(".dev.") ? `https://moon-${e.split(".")[1]}.dev.spaces.huggingface.tech` : e.endsWith(".hf.space") ? "https://huggingface.co" : null;
|
|
915
943
|
}
|
|
916
|
-
function
|
|
917
|
-
if (!
|
|
944
|
+
function Xe() {
|
|
945
|
+
if (!Je() || qe) return;
|
|
918
946
|
window.addEventListener("message", (e) => {
|
|
919
|
-
e.data ===
|
|
920
|
-
}),
|
|
921
|
-
let e =
|
|
922
|
-
e && window.parent !== window && window.parent.postMessage(
|
|
947
|
+
e.data === Ke && (window.supports_zerogpu_headers = !0);
|
|
948
|
+
}), qe = !0;
|
|
949
|
+
let e = Ye(window.location.hostname);
|
|
950
|
+
e && window.parent !== window && window.parent.postMessage(Ke, e);
|
|
923
951
|
}
|
|
924
952
|
//#endregion
|
|
925
953
|
//#region ../../node_modules/.pnpm/fetch-event-stream@0.1.6/node_modules/fetch-event-stream/esm/deps/jsr.io/@std/streams/0.221.0/text_line_stream.js
|
|
926
|
-
var
|
|
954
|
+
var Ze = class extends TransformStream {
|
|
927
955
|
#e = "";
|
|
928
956
|
constructor(e = { allowCR: !1 }) {
|
|
929
957
|
super({
|
|
@@ -950,22 +978,22 @@ var Je = class extends TransformStream {
|
|
|
950
978
|
};
|
|
951
979
|
//#endregion
|
|
952
980
|
//#region ../../node_modules/.pnpm/fetch-event-stream@0.1.6/node_modules/fetch-event-stream/esm/utils.js
|
|
953
|
-
function
|
|
954
|
-
let t = new TextDecoderStream(), n = new
|
|
981
|
+
function Qe(e) {
|
|
982
|
+
let t = new TextDecoderStream(), n = new Ze({ allowCR: !0 });
|
|
955
983
|
return e.pipeThrough(t).pipeThrough(n);
|
|
956
984
|
}
|
|
957
|
-
function
|
|
985
|
+
function $e(e) {
|
|
958
986
|
let t = /[:]\s*/.exec(e), n = t && t.index;
|
|
959
987
|
if (n) return [e.substring(0, n), e.substring(n + t[0].length)];
|
|
960
988
|
}
|
|
961
|
-
function
|
|
989
|
+
function et(e, t, n) {
|
|
962
990
|
e.get(t) || e.set(t, n);
|
|
963
991
|
}
|
|
964
992
|
//#endregion
|
|
965
993
|
//#region ../../node_modules/.pnpm/fetch-event-stream@0.1.6/node_modules/fetch-event-stream/esm/mod.js
|
|
966
|
-
async function*
|
|
994
|
+
async function* tt(e, t) {
|
|
967
995
|
if (!e.body) return;
|
|
968
|
-
let n =
|
|
996
|
+
let n = Qe(e.body), r, i = n.getReader(), a;
|
|
969
997
|
for (;;) {
|
|
970
998
|
if (t && t.aborted) return i.cancel();
|
|
971
999
|
if (r = await i.read(), r.done) return;
|
|
@@ -973,20 +1001,20 @@ async function* Qe(e, t) {
|
|
|
973
1001
|
a && (yield a), a = void 0;
|
|
974
1002
|
continue;
|
|
975
1003
|
}
|
|
976
|
-
let [e, n] =
|
|
1004
|
+
let [e, n] = $e(r.value) || [];
|
|
977
1005
|
e === "data" ? (a ||= {}, a[e] = a[e] ? a[e] + "\n" + n : n) : e === "event" ? (a ||= {}, a[e] = n) : e === "id" ? (a ||= {}, a[e] = String(+n) === n ? +n : n) : e === "retry" && (a ||= {}, a[e] = +n || void 0);
|
|
978
1006
|
}
|
|
979
1007
|
}
|
|
980
|
-
async function
|
|
1008
|
+
async function nt(e, t) {
|
|
981
1009
|
let n = new Request(e, t);
|
|
982
|
-
|
|
1010
|
+
et(n.headers, "Accept", "text/event-stream"), et(n.headers, "Content-Type", "application/json");
|
|
983
1011
|
let r = await fetch(n);
|
|
984
1012
|
if (!r.ok) throw r;
|
|
985
|
-
return
|
|
1013
|
+
return tt(r, n.signal);
|
|
986
1014
|
}
|
|
987
1015
|
//#endregion
|
|
988
1016
|
//#region src/utils/stream.ts
|
|
989
|
-
async function
|
|
1017
|
+
async function rt() {
|
|
990
1018
|
let { event_callbacks: e, unclosed_events: t, pending_stream_messages: n, stream_status: r, config: i, jwt: a } = this, o = this;
|
|
991
1019
|
if (!i) throw Error("Could not resolve app config");
|
|
992
1020
|
r.open = !0;
|
|
@@ -998,7 +1026,7 @@ async function et() {
|
|
|
998
1026
|
s.onmessage = async function(a) {
|
|
999
1027
|
let s = JSON.parse(a.data);
|
|
1000
1028
|
if (s.msg === "close_stream") {
|
|
1001
|
-
|
|
1029
|
+
it(r, o.abort_controller);
|
|
1002
1030
|
return;
|
|
1003
1031
|
}
|
|
1004
1032
|
let c = s.event_id;
|
|
@@ -1021,23 +1049,23 @@ async function et() {
|
|
|
1021
1049
|
})));
|
|
1022
1050
|
};
|
|
1023
1051
|
}
|
|
1024
|
-
function
|
|
1052
|
+
function it(e, t) {
|
|
1025
1053
|
e && (e.open = !1, t?.abort());
|
|
1026
1054
|
}
|
|
1027
|
-
function
|
|
1055
|
+
function at(e, t, n) {
|
|
1028
1056
|
e[t] ? n.data.forEach((r, i) => {
|
|
1029
|
-
let a =
|
|
1057
|
+
let a = ot(i < e[t].length ? e[t][i] : null, r);
|
|
1030
1058
|
e[t][i] = a, n.data[i] = a;
|
|
1031
1059
|
}) : (e[t] = [], n.data.forEach((n, r) => {
|
|
1032
1060
|
e[t][r] = n;
|
|
1033
1061
|
}));
|
|
1034
1062
|
}
|
|
1035
|
-
function
|
|
1063
|
+
function ot(e, t) {
|
|
1036
1064
|
return t.forEach(([t, n, r]) => {
|
|
1037
|
-
e =
|
|
1065
|
+
e = st(e, n, t, r);
|
|
1038
1066
|
}), e;
|
|
1039
1067
|
}
|
|
1040
|
-
function
|
|
1068
|
+
function st(e, t, n, r) {
|
|
1041
1069
|
if (t.length === 0) {
|
|
1042
1070
|
if (n === "replace") return r;
|
|
1043
1071
|
if (n === "append") return e + r;
|
|
@@ -1063,7 +1091,7 @@ function it(e, t, n, r) {
|
|
|
1063
1091
|
}
|
|
1064
1092
|
return e;
|
|
1065
1093
|
}
|
|
1066
|
-
function
|
|
1094
|
+
function ct(e, t = {}) {
|
|
1067
1095
|
let n = {
|
|
1068
1096
|
close: () => {
|
|
1069
1097
|
console.warn("Method not implemented.");
|
|
@@ -1087,7 +1115,7 @@ function at(e, t = {}) {
|
|
|
1087
1115
|
throw Error("Method not implemented.");
|
|
1088
1116
|
}
|
|
1089
1117
|
};
|
|
1090
|
-
return
|
|
1118
|
+
return nt(e, t).then(async (e) => {
|
|
1091
1119
|
n.readyState = n.OPEN;
|
|
1092
1120
|
try {
|
|
1093
1121
|
for await (let t of e) n.onmessage && n.onmessage(t);
|
|
@@ -1101,7 +1129,7 @@ function at(e, t = {}) {
|
|
|
1101
1129
|
}
|
|
1102
1130
|
//#endregion
|
|
1103
1131
|
//#region src/utils/run_history.ts
|
|
1104
|
-
var
|
|
1132
|
+
var lt = "gradio:run-history:", K = `${lt}v2:`, ut = `${lt}replay:v2:`, dt = `${lt}destination:v1:`, ft = 100, pt = 8;
|
|
1105
1133
|
function q(e, t) {
|
|
1106
1134
|
try {
|
|
1107
1135
|
return e();
|
|
@@ -1109,7 +1137,7 @@ function q(e, t) {
|
|
|
1109
1137
|
return console.warn("Could not update the run history.", e), t;
|
|
1110
1138
|
}
|
|
1111
1139
|
}
|
|
1112
|
-
function
|
|
1140
|
+
function mt(e, t = "/gradio_api") {
|
|
1113
1141
|
return `${e.replace(/\/+$/, "")}${t}/runs`;
|
|
1114
1142
|
}
|
|
1115
1143
|
function J(e) {
|
|
@@ -1122,16 +1150,16 @@ function J(e) {
|
|
|
1122
1150
|
return null;
|
|
1123
1151
|
}
|
|
1124
1152
|
}
|
|
1125
|
-
function
|
|
1153
|
+
function ht(e) {
|
|
1126
1154
|
let t = J(e);
|
|
1127
|
-
return t ? t.replace(K,
|
|
1155
|
+
return t ? t.replace(K, ut) : null;
|
|
1128
1156
|
}
|
|
1129
|
-
function
|
|
1157
|
+
function gt(e) {
|
|
1130
1158
|
let t = J(e);
|
|
1131
|
-
return t ? t.replace(K,
|
|
1159
|
+
return t ? t.replace(K, dt) : null;
|
|
1132
1160
|
}
|
|
1133
|
-
function
|
|
1134
|
-
let t =
|
|
1161
|
+
function _t(e) {
|
|
1162
|
+
let t = gt(e);
|
|
1135
1163
|
if (!t) return { type: "browser" };
|
|
1136
1164
|
try {
|
|
1137
1165
|
let e = JSON.parse(window.localStorage.getItem(t) || "null");
|
|
@@ -1146,11 +1174,11 @@ function mt(e) {
|
|
|
1146
1174
|
return { type: "browser" };
|
|
1147
1175
|
}
|
|
1148
1176
|
}
|
|
1149
|
-
function
|
|
1150
|
-
let n =
|
|
1151
|
-
n && (t.type === "browser" && !t.bucket_id ? window.localStorage.removeItem(n) : window.localStorage.setItem(n, JSON.stringify(t)),
|
|
1177
|
+
function vt(e, t) {
|
|
1178
|
+
let n = gt(e);
|
|
1179
|
+
n && (t.type === "browser" && !t.bucket_id ? window.localStorage.removeItem(n) : window.localStorage.setItem(n, JSON.stringify(t)), Et());
|
|
1152
1180
|
}
|
|
1153
|
-
function
|
|
1181
|
+
function yt(e) {
|
|
1154
1182
|
try {
|
|
1155
1183
|
let t = JSON.parse(window.localStorage.getItem(e) || "[]");
|
|
1156
1184
|
return Array.isArray(t) && t.length && Date.parse(t[0]?.started_at) || 0;
|
|
@@ -1158,13 +1186,13 @@ function gt(e) {
|
|
|
1158
1186
|
return 0;
|
|
1159
1187
|
}
|
|
1160
1188
|
}
|
|
1161
|
-
function
|
|
1162
|
-
let t = Object.keys(window.localStorage).filter((e) => e.startsWith(
|
|
1189
|
+
function bt(e) {
|
|
1190
|
+
let t = Object.keys(window.localStorage).filter((e) => e.startsWith(lt)), n = [...t.filter((e) => !e.startsWith(K) && !e.startsWith(ut) && !e.startsWith(dt)), ...t.filter((t) => t.startsWith(K) && t !== e).sort((e, t) => yt(t) - yt(e)).slice(pt - 1)];
|
|
1163
1191
|
for (let e of n) try {
|
|
1164
|
-
window.localStorage.removeItem(e), window.sessionStorage.removeItem(e.replace(K,
|
|
1192
|
+
window.localStorage.removeItem(e), window.sessionStorage.removeItem(e.replace(K, ut));
|
|
1165
1193
|
} catch {}
|
|
1166
1194
|
}
|
|
1167
|
-
function
|
|
1195
|
+
function xt() {
|
|
1168
1196
|
return typeof crypto < "u" && crypto.randomUUID ? crypto.randomUUID() : `${Date.now()}-${Math.random().toString(36).slice(2)}`;
|
|
1169
1197
|
}
|
|
1170
1198
|
function Y(e) {
|
|
@@ -1192,16 +1220,16 @@ function X(e) {
|
|
|
1192
1220
|
return [];
|
|
1193
1221
|
}
|
|
1194
1222
|
}
|
|
1195
|
-
function
|
|
1223
|
+
function St(e, t) {
|
|
1196
1224
|
let n = J(e);
|
|
1197
1225
|
if (!n) return;
|
|
1198
|
-
let r = t.slice(0,
|
|
1226
|
+
let r = t.slice(0, ft), i = !1;
|
|
1199
1227
|
for (; r.length > 0;) try {
|
|
1200
1228
|
window.localStorage.setItem(n, JSON.stringify(r));
|
|
1201
1229
|
return;
|
|
1202
1230
|
} catch {
|
|
1203
1231
|
if (!i) {
|
|
1204
|
-
i = !0,
|
|
1232
|
+
i = !0, bt(n);
|
|
1205
1233
|
continue;
|
|
1206
1234
|
}
|
|
1207
1235
|
r = r.slice(0, -1);
|
|
@@ -1210,37 +1238,37 @@ function yt(e, t) {
|
|
|
1210
1238
|
window.localStorage.removeItem(n);
|
|
1211
1239
|
} catch {}
|
|
1212
1240
|
}
|
|
1213
|
-
function
|
|
1241
|
+
function Ct(e) {
|
|
1214
1242
|
let t = J(e);
|
|
1215
1243
|
if (t) {
|
|
1216
1244
|
try {
|
|
1217
1245
|
window.localStorage.removeItem(t);
|
|
1218
1246
|
} catch {}
|
|
1219
|
-
|
|
1247
|
+
Et();
|
|
1220
1248
|
}
|
|
1221
1249
|
}
|
|
1222
|
-
function
|
|
1223
|
-
|
|
1250
|
+
function wt(e, t) {
|
|
1251
|
+
St(e, X(e).filter((e) => e.id !== t)), Et();
|
|
1224
1252
|
}
|
|
1225
|
-
var
|
|
1226
|
-
function
|
|
1253
|
+
var Tt = "gradio:run-history-change";
|
|
1254
|
+
function Et() {
|
|
1227
1255
|
if (!(typeof window > "u")) try {
|
|
1228
|
-
window.dispatchEvent(new Event(
|
|
1256
|
+
window.dispatchEvent(new Event(Tt));
|
|
1229
1257
|
} catch {}
|
|
1230
1258
|
}
|
|
1231
|
-
function
|
|
1232
|
-
return typeof window > "u" ? () => {} : (window.addEventListener(
|
|
1233
|
-
window.removeEventListener(
|
|
1259
|
+
function Dt(e) {
|
|
1260
|
+
return typeof window > "u" ? () => {} : (window.addEventListener(Tt, e), window.addEventListener("storage", e), () => {
|
|
1261
|
+
window.removeEventListener(Tt, e), window.removeEventListener("storage", e);
|
|
1234
1262
|
});
|
|
1235
1263
|
}
|
|
1236
|
-
function
|
|
1237
|
-
let n =
|
|
1264
|
+
function Ot(e, t) {
|
|
1265
|
+
let n = ht(e);
|
|
1238
1266
|
if (n) try {
|
|
1239
1267
|
window.sessionStorage.setItem(n, JSON.stringify(t));
|
|
1240
1268
|
} catch {}
|
|
1241
1269
|
}
|
|
1242
|
-
function
|
|
1243
|
-
let t =
|
|
1270
|
+
function kt(e) {
|
|
1271
|
+
let t = ht(e);
|
|
1244
1272
|
if (!t) return null;
|
|
1245
1273
|
try {
|
|
1246
1274
|
let e = window.sessionStorage.getItem(t);
|
|
@@ -1249,7 +1277,7 @@ function Et(e) {
|
|
|
1249
1277
|
return null;
|
|
1250
1278
|
}
|
|
1251
1279
|
}
|
|
1252
|
-
function
|
|
1280
|
+
function At(e, t) {
|
|
1253
1281
|
let n = e.dependencies.find((e) => e.id === t.fn_index || typeof e.api_name == "string" && `/${e.api_name.replace(/^\//, "")}` === t.api_name);
|
|
1254
1282
|
if (!n) return !1;
|
|
1255
1283
|
let r = Array.isArray(t.inputs) ? t.inputs : Object.values(t.inputs ?? {}), i = Array.isArray(t.outputs) ? t.outputs : t.outputs === null || t.outputs === void 0 ? [] : [t.outputs], a = (t, n) => {
|
|
@@ -1260,17 +1288,17 @@ function Dt(e, t) {
|
|
|
1260
1288
|
};
|
|
1261
1289
|
return a(n.inputs, r), a(n.outputs, i), !0;
|
|
1262
1290
|
}
|
|
1263
|
-
function
|
|
1264
|
-
let t =
|
|
1265
|
-
return t ?
|
|
1291
|
+
function jt(e) {
|
|
1292
|
+
let t = kt(e);
|
|
1293
|
+
return t ? At(e, t) : !1;
|
|
1266
1294
|
}
|
|
1267
|
-
function
|
|
1268
|
-
if (
|
|
1295
|
+
function Mt(e) {
|
|
1296
|
+
if (_t(e).type === "bucket") return null;
|
|
1269
1297
|
let t = J(e);
|
|
1270
1298
|
if (!t) return null;
|
|
1271
|
-
|
|
1299
|
+
bt(t);
|
|
1272
1300
|
let n = {
|
|
1273
|
-
id:
|
|
1301
|
+
id: xt(),
|
|
1274
1302
|
endpoint: e.endpoint,
|
|
1275
1303
|
api_name: e.api_name,
|
|
1276
1304
|
fn_index: e.fn_index,
|
|
@@ -1282,115 +1310,115 @@ function kt(e) {
|
|
|
1282
1310
|
status: "running",
|
|
1283
1311
|
started_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
1284
1312
|
};
|
|
1285
|
-
return
|
|
1313
|
+
return St(e, [n, ...X(e)]), Et(), n.id;
|
|
1286
1314
|
}
|
|
1287
|
-
function
|
|
1315
|
+
function Nt(e, t, n) {
|
|
1288
1316
|
if (!t) return;
|
|
1289
1317
|
let r = X(e), i = r.find((e) => e.id === t);
|
|
1290
|
-
i && (i.inputs = Y(n),
|
|
1318
|
+
i && (i.inputs = Y(n), St(e, r));
|
|
1291
1319
|
}
|
|
1292
|
-
function
|
|
1320
|
+
function Pt(e, t, n) {
|
|
1293
1321
|
if (!t) return;
|
|
1294
1322
|
let r = X(e), i = r.find((e) => e.id === t);
|
|
1295
1323
|
if (!i) return;
|
|
1296
1324
|
let a = !1;
|
|
1297
1325
|
if (n.type === "data") i.outputs = Y(n.data), Z.set(t, i.outputs);
|
|
1298
|
-
else if (n.type === "status" && n.original_msg === "process_starts")
|
|
1326
|
+
else if (n.type === "status" && n.original_msg === "process_starts") Lt(i, n.time);
|
|
1299
1327
|
else if (n.type === "status" && (n.stage === "generating" || n.stage === "streaming")) i.streamed = !0;
|
|
1300
|
-
else if (n.type === "status" && n.stage === "complete") i.status = "completed",
|
|
1301
|
-
else if (n.type === "status" && n.stage === "error") i.status = "failed", i.error = typeof n.message == "string" ? n.message : JSON.stringify(n.message || "Unknown error"),
|
|
1328
|
+
else if (n.type === "status" && n.stage === "complete") i.status = "completed", Rt(i, n), a = !0;
|
|
1329
|
+
else if (n.type === "status" && n.stage === "error") i.status = "failed", i.error = typeof n.message == "string" ? n.message : JSON.stringify(n.message || "Unknown error"), Rt(i, n), a = !0;
|
|
1302
1330
|
else return;
|
|
1303
|
-
if (a) Z.has(t) && (i.outputs = Z.get(t)), Z.delete(t),
|
|
1331
|
+
if (a) Z.has(t) && (i.outputs = Z.get(t)), Z.delete(t), It.delete(t);
|
|
1304
1332
|
else if (i.streamed) {
|
|
1305
|
-
if (Date.now() - (
|
|
1306
|
-
|
|
1333
|
+
if (Date.now() - (It.get(t) ?? 0) < Ft) return;
|
|
1334
|
+
It.set(t, Date.now()), Z.delete(t);
|
|
1307
1335
|
}
|
|
1308
|
-
|
|
1336
|
+
St(e, r);
|
|
1309
1337
|
}
|
|
1310
|
-
var
|
|
1311
|
-
function
|
|
1338
|
+
var Ft = 500, It = /* @__PURE__ */ new Map(), Z = /* @__PURE__ */ new Map();
|
|
1339
|
+
function Lt(e, t) {
|
|
1312
1340
|
if (e.process_started_at) return;
|
|
1313
1341
|
let n = t || /* @__PURE__ */ new Date();
|
|
1314
1342
|
e.process_started_at = n.toISOString(), e.queued_ms = Math.max(0, n.getTime() - Date.parse(e.started_at));
|
|
1315
1343
|
}
|
|
1316
|
-
function
|
|
1344
|
+
function Rt(e, t) {
|
|
1317
1345
|
let n = t.time || /* @__PURE__ */ new Date();
|
|
1318
1346
|
e.completed_at = n.toISOString(), e.duration_ms = (!e.streamed && typeof t.cache_duration == "number" && t.cache_duration >= 0 ? t.cache_duration * 1e3 : null) ?? Math.max(0, n.getTime() - Date.parse(e.process_started_at || e.started_at));
|
|
1319
1347
|
}
|
|
1320
|
-
function It(e) {
|
|
1321
|
-
return q(() => X(e), []);
|
|
1322
|
-
}
|
|
1323
|
-
function Lt(e) {
|
|
1324
|
-
return q(() => mt(e), { type: "browser" });
|
|
1325
|
-
}
|
|
1326
|
-
function Rt(e, t) {
|
|
1327
|
-
q(() => ht(e, t), void 0);
|
|
1328
|
-
}
|
|
1329
1348
|
function zt(e) {
|
|
1330
|
-
q(() =>
|
|
1349
|
+
return q(() => X(e), []);
|
|
1331
1350
|
}
|
|
1332
|
-
function Bt(e
|
|
1333
|
-
q(() =>
|
|
1351
|
+
function Bt(e) {
|
|
1352
|
+
return q(() => _t(e), { type: "browser" });
|
|
1334
1353
|
}
|
|
1335
1354
|
function Vt(e, t) {
|
|
1336
|
-
q(() =>
|
|
1355
|
+
q(() => vt(e, t), void 0);
|
|
1337
1356
|
}
|
|
1338
1357
|
function Ht(e) {
|
|
1339
|
-
|
|
1358
|
+
q(() => Ct(e), void 0);
|
|
1340
1359
|
}
|
|
1341
|
-
function Ut(e) {
|
|
1342
|
-
|
|
1360
|
+
function Ut(e, t) {
|
|
1361
|
+
q(() => wt(e, t), void 0);
|
|
1343
1362
|
}
|
|
1344
|
-
function Wt(e) {
|
|
1345
|
-
|
|
1363
|
+
function Wt(e, t) {
|
|
1364
|
+
q(() => Ot(e, t), void 0);
|
|
1346
1365
|
}
|
|
1347
|
-
function Gt(e
|
|
1348
|
-
q(() =>
|
|
1366
|
+
function Gt(e) {
|
|
1367
|
+
return q(() => kt(e), null);
|
|
1349
1368
|
}
|
|
1350
|
-
function Kt(e
|
|
1351
|
-
q(() => jt(e
|
|
1369
|
+
function Kt(e) {
|
|
1370
|
+
return q(() => jt(e), !1);
|
|
1352
1371
|
}
|
|
1353
1372
|
function qt(e) {
|
|
1354
|
-
return q(() =>
|
|
1373
|
+
return q(() => Mt(e), null);
|
|
1374
|
+
}
|
|
1375
|
+
function Jt(e, t, n) {
|
|
1376
|
+
q(() => Nt(e, t, n), void 0);
|
|
1377
|
+
}
|
|
1378
|
+
function Yt(e, t, n) {
|
|
1379
|
+
q(() => Pt(e, t, n), void 0);
|
|
1380
|
+
}
|
|
1381
|
+
function Xt(e) {
|
|
1382
|
+
return q(() => Dt(() => q(e, void 0)), () => {});
|
|
1355
1383
|
}
|
|
1356
1384
|
//#endregion
|
|
1357
1385
|
//#region src/utils/submit.ts
|
|
1358
|
-
function
|
|
1386
|
+
function Zt(e, t = {}, n, r, i, a) {
|
|
1359
1387
|
try {
|
|
1360
|
-
let { token: o } = this.options, { fetch: s, app_reference: c, config: l, session_hash: f, api_info: p, api_map: m, stream_status:
|
|
1361
|
-
if (!p) throw Error(
|
|
1388
|
+
let { token: o } = this.options, { fetch: s, app_reference: c, config: l, session_hash: f, api_info: p, api_map: m, stream_status: ee, pending_stream_messages: te, pending_diff_streams: ne, event_callbacks: h, unclosed_events: re, post_data: g, options: v, api_prefix: y } = this, se = a || { "x-gradio-user": "api" }, b = this;
|
|
1389
|
+
if (!p) throw Error(ue);
|
|
1362
1390
|
if (!l) throw Error("Could not resolve app config");
|
|
1363
|
-
let { fn_index: x, endpoint_info:
|
|
1364
|
-
if (
|
|
1365
|
-
let
|
|
1391
|
+
let ce = l.root, { fn_index: x, endpoint_info: S, dependency: C } = $t(p, e, m, l), le = xe(t, S), w = l.protocol ?? "ws";
|
|
1392
|
+
if (w === "ws") throw Error(de);
|
|
1393
|
+
let fe = typeof C.api_name == "string" ? `/${C.api_name}` : e, pe = typeof C.api_name == "string" ? `/${C.api_name}` : `Function ${x}`, me = (e) => {
|
|
1366
1394
|
let t = l.components.find((t) => t.id === e);
|
|
1367
1395
|
return t ? {
|
|
1368
1396
|
type: t.type,
|
|
1369
1397
|
component_class_id: t.component_class_id,
|
|
1370
1398
|
props: t.props
|
|
1371
1399
|
} : null;
|
|
1372
|
-
},
|
|
1400
|
+
}, he = C.api_visibility === "public", T = l.run_history !== !1 && this.options.record_history !== !1, E = {
|
|
1373
1401
|
app_id: l.app_id,
|
|
1374
1402
|
username: l.username
|
|
1375
|
-
},
|
|
1403
|
+
}, ge = Bt(E), D = {
|
|
1376
1404
|
...se,
|
|
1377
|
-
...T &&
|
|
1378
|
-
}, _e = !T || !
|
|
1405
|
+
...T && ge.type === "bucket" ? { "x-gradio-history-bucket": ge.bucket_id } : {}
|
|
1406
|
+
}, _e = !T || !he ? null : qt({
|
|
1379
1407
|
...E,
|
|
1380
|
-
endpoint:
|
|
1408
|
+
endpoint: fe,
|
|
1381
1409
|
api_name: pe,
|
|
1382
1410
|
fn_index: x,
|
|
1383
|
-
inputs: W(le,
|
|
1384
|
-
input_components:
|
|
1385
|
-
output_components:
|
|
1386
|
-
}),
|
|
1387
|
-
function
|
|
1388
|
-
|
|
1411
|
+
inputs: W(le, C, l.components, "input", !0),
|
|
1412
|
+
input_components: C.inputs.map(me),
|
|
1413
|
+
output_components: C.outputs.map(me)
|
|
1414
|
+
}), O, k = "", A = typeof e == "number" ? "/predict" : e, j, M = null, N = !1, P = {}, F = typeof window < "u" && typeof document < "u" ? new URLSearchParams(window.location.search).toString() : "", ve = v?.events?.reduce((e, t) => (e[t] = !0, e), {}) || {};
|
|
1415
|
+
function I(e) {
|
|
1416
|
+
Yt(E, _e, e), (e.type === "data" || e.type === "render") && Ae(e.data, ce, y, b.jwt), (i || ve[e.type]) && Te(e);
|
|
1389
1417
|
}
|
|
1390
1418
|
async function ye() {
|
|
1391
1419
|
let e = {}, t = {};
|
|
1392
|
-
e = { event_id:
|
|
1393
|
-
event_id:
|
|
1420
|
+
e = { event_id: M }, t = {
|
|
1421
|
+
event_id: M,
|
|
1394
1422
|
session_hash: f,
|
|
1395
1423
|
fn_index: x
|
|
1396
1424
|
};
|
|
@@ -1409,52 +1437,52 @@ function Jt(e, t = {}, n, r, i, a) {
|
|
|
1409
1437
|
console.warn("The `/reset` endpoint could not be called. Subsequent endpoint results may be unreliable.");
|
|
1410
1438
|
}
|
|
1411
1439
|
}
|
|
1412
|
-
let
|
|
1440
|
+
let Se = async (e) => {
|
|
1413
1441
|
await this._resolve_heartbeat(e);
|
|
1414
1442
|
};
|
|
1415
|
-
async function
|
|
1443
|
+
async function L(e) {
|
|
1416
1444
|
if (!l) return;
|
|
1417
1445
|
let t = e.render_id;
|
|
1418
1446
|
l.components = [...l.components.filter((e) => e.props.rendered_in !== t), ...e.components], l.dependencies = [...l.dependencies.filter((e) => e.rendered_in !== t), ...e.dependencies];
|
|
1419
1447
|
let n = l.components.some((e) => e.type === "state"), r = l.dependencies.some((e) => e.targets.some((e) => e[1] === "unload"));
|
|
1420
|
-
l.connect_heartbeat = n || r, await
|
|
1448
|
+
l.connect_heartbeat = n || r, await Se(l), I({
|
|
1421
1449
|
type: "render",
|
|
1422
1450
|
data: e,
|
|
1423
|
-
endpoint:
|
|
1451
|
+
endpoint: A,
|
|
1424
1452
|
fn_index: x
|
|
1425
1453
|
});
|
|
1426
1454
|
}
|
|
1427
|
-
let
|
|
1428
|
-
let t = W(e,
|
|
1429
|
-
if (
|
|
1455
|
+
let R = this.handle_blob(l.root, le, S).then(async (e) => {
|
|
1456
|
+
let t = W(e, C, l.components, "input", !0);
|
|
1457
|
+
if (Jt(E, _e, t || []), j = {
|
|
1430
1458
|
data: t || [],
|
|
1431
1459
|
event_data: n,
|
|
1432
1460
|
fn_index: x,
|
|
1433
1461
|
trigger_id: r,
|
|
1434
|
-
...v.oauth_token &&
|
|
1435
|
-
}, Ee(x, l))
|
|
1462
|
+
...v.oauth_token && S?.oauth_token ? { oauth_token: v.oauth_token } : {}
|
|
1463
|
+
}, Ee(x, l)) I({
|
|
1436
1464
|
type: "status",
|
|
1437
|
-
endpoint:
|
|
1465
|
+
endpoint: A,
|
|
1438
1466
|
stage: "pending",
|
|
1439
1467
|
queue: !1,
|
|
1440
1468
|
fn_index: x,
|
|
1441
1469
|
time: /* @__PURE__ */ new Date()
|
|
1442
|
-
}), g(`${l.root}${y}/run${
|
|
1443
|
-
...
|
|
1470
|
+
}), g(`${l.root}${y}/run${A.startsWith("/") ? A : `/${A}`}${F ? "?" + F : ""}`, {
|
|
1471
|
+
...j,
|
|
1444
1472
|
session_hash: f
|
|
1445
|
-
},
|
|
1473
|
+
}, D).then(async ([e, t]) => {
|
|
1446
1474
|
let i = e.data;
|
|
1447
|
-
if (t == 200)
|
|
1475
|
+
if (t == 200) I({
|
|
1448
1476
|
type: "data",
|
|
1449
|
-
endpoint:
|
|
1477
|
+
endpoint: A,
|
|
1450
1478
|
fn_index: x,
|
|
1451
|
-
data: W(i,
|
|
1479
|
+
data: W(i, C, l.components, "output", v.with_null_state),
|
|
1452
1480
|
time: /* @__PURE__ */ new Date(),
|
|
1453
1481
|
event_data: n,
|
|
1454
1482
|
trigger_id: r
|
|
1455
|
-
}), e.render_config && await
|
|
1483
|
+
}), e.render_config && await L(e.render_config), I({
|
|
1456
1484
|
type: "status",
|
|
1457
|
-
endpoint:
|
|
1485
|
+
endpoint: A,
|
|
1458
1486
|
fn_index: x,
|
|
1459
1487
|
stage: "complete",
|
|
1460
1488
|
eta: e.average_duration,
|
|
@@ -1463,10 +1491,10 @@ function Jt(e, t = {}, n, r, i, a) {
|
|
|
1463
1491
|
});
|
|
1464
1492
|
else {
|
|
1465
1493
|
let t = e?.error === _;
|
|
1466
|
-
|
|
1494
|
+
I({
|
|
1467
1495
|
type: "status",
|
|
1468
1496
|
stage: "error",
|
|
1469
|
-
endpoint:
|
|
1497
|
+
endpoint: A,
|
|
1470
1498
|
fn_index: x,
|
|
1471
1499
|
message: e.error,
|
|
1472
1500
|
broken: t,
|
|
@@ -1475,22 +1503,22 @@ function Jt(e, t = {}, n, r, i, a) {
|
|
|
1475
1503
|
});
|
|
1476
1504
|
}
|
|
1477
1505
|
}).catch((e) => {
|
|
1478
|
-
|
|
1506
|
+
I({
|
|
1479
1507
|
type: "status",
|
|
1480
1508
|
stage: "error",
|
|
1481
1509
|
message: e.message,
|
|
1482
|
-
endpoint:
|
|
1510
|
+
endpoint: A,
|
|
1483
1511
|
fn_index: x,
|
|
1484
1512
|
queue: !1,
|
|
1485
1513
|
time: /* @__PURE__ */ new Date()
|
|
1486
1514
|
});
|
|
1487
1515
|
});
|
|
1488
|
-
else if (
|
|
1489
|
-
|
|
1516
|
+
else if (w == "sse") {
|
|
1517
|
+
I({
|
|
1490
1518
|
type: "status",
|
|
1491
1519
|
stage: "pending",
|
|
1492
1520
|
queue: !0,
|
|
1493
|
-
endpoint:
|
|
1521
|
+
endpoint: A,
|
|
1494
1522
|
fn_index: x,
|
|
1495
1523
|
time: /* @__PURE__ */ new Date()
|
|
1496
1524
|
});
|
|
@@ -1498,280 +1526,284 @@ function Jt(e, t = {}, n, r, i, a) {
|
|
|
1498
1526
|
fn_index: x.toString(),
|
|
1499
1527
|
session_hash: f
|
|
1500
1528
|
}).toString();
|
|
1501
|
-
let e = new URL(`${l.root}${y}/${u}?${
|
|
1502
|
-
if (this.jwt && e.searchParams.set("__sign", this.jwt),
|
|
1503
|
-
|
|
1504
|
-
let { type: t, status: i, data: a } =
|
|
1505
|
-
if (t === "update" && i && !
|
|
1529
|
+
let e = new URL(`${l.root}${y}/${u}?${F ? F + "&" : ""}${i}`);
|
|
1530
|
+
if (this.jwt && e.searchParams.set("__sign", this.jwt), O = this.stream(e), !O) return Promise.reject(/* @__PURE__ */ Error("Cannot connect to SSE endpoint: " + e.toString()));
|
|
1531
|
+
O.onmessage = async function(e) {
|
|
1532
|
+
let { type: t, status: i, data: a } = be(JSON.parse(e.data), P[x]);
|
|
1533
|
+
if (t === "update" && i && !N) I({
|
|
1506
1534
|
type: "status",
|
|
1507
|
-
endpoint:
|
|
1535
|
+
endpoint: A,
|
|
1508
1536
|
fn_index: x,
|
|
1509
1537
|
time: /* @__PURE__ */ new Date(),
|
|
1510
1538
|
...i
|
|
1511
|
-
}), i.stage === "error" && (
|
|
1539
|
+
}), i.stage === "error" && (O?.close(), V());
|
|
1512
1540
|
else if (t === "data") {
|
|
1513
1541
|
let [e, t] = await g(`${l.root}${y}/queue/data`, {
|
|
1514
|
-
...
|
|
1542
|
+
...j,
|
|
1515
1543
|
session_hash: f,
|
|
1516
|
-
event_id:
|
|
1517
|
-
},
|
|
1518
|
-
t !== 200 && (
|
|
1544
|
+
event_id: M
|
|
1545
|
+
}, D);
|
|
1546
|
+
t !== 200 && (I({
|
|
1519
1547
|
type: "status",
|
|
1520
1548
|
stage: "error",
|
|
1521
1549
|
message: _,
|
|
1522
1550
|
queue: !0,
|
|
1523
|
-
endpoint:
|
|
1551
|
+
endpoint: A,
|
|
1524
1552
|
fn_index: x,
|
|
1525
1553
|
time: /* @__PURE__ */ new Date()
|
|
1526
|
-
}),
|
|
1527
|
-
} else t === "complete" ?
|
|
1554
|
+
}), O?.close(), V());
|
|
1555
|
+
} else t === "complete" ? N = i : t === "log" ? I({
|
|
1528
1556
|
type: "log",
|
|
1529
1557
|
title: a.title,
|
|
1530
1558
|
log: a.log,
|
|
1531
1559
|
level: a.level,
|
|
1532
|
-
endpoint:
|
|
1560
|
+
endpoint: A,
|
|
1533
1561
|
duration: a.duration,
|
|
1534
1562
|
visible: a.visible,
|
|
1535
1563
|
fn_index: x
|
|
1536
|
-
}) : (t === "generating" || t === "streaming") &&
|
|
1564
|
+
}) : (t === "generating" || t === "streaming") && I({
|
|
1537
1565
|
type: "status",
|
|
1538
1566
|
time: /* @__PURE__ */ new Date(),
|
|
1539
1567
|
...i,
|
|
1540
1568
|
stage: i?.stage,
|
|
1541
1569
|
queue: !0,
|
|
1542
|
-
endpoint:
|
|
1570
|
+
endpoint: A,
|
|
1543
1571
|
fn_index: x
|
|
1544
1572
|
});
|
|
1545
|
-
a && (
|
|
1573
|
+
a && (I({
|
|
1546
1574
|
type: "data",
|
|
1547
1575
|
time: /* @__PURE__ */ new Date(),
|
|
1548
|
-
data: W(a.data,
|
|
1549
|
-
endpoint:
|
|
1576
|
+
data: W(a.data, C, l.components, "output", v.with_null_state),
|
|
1577
|
+
endpoint: A,
|
|
1550
1578
|
fn_index: x,
|
|
1551
1579
|
event_data: n,
|
|
1552
1580
|
trigger_id: r
|
|
1553
|
-
}),
|
|
1581
|
+
}), N && (I({
|
|
1554
1582
|
type: "status",
|
|
1555
1583
|
time: /* @__PURE__ */ new Date(),
|
|
1556
|
-
...
|
|
1584
|
+
...N,
|
|
1557
1585
|
stage: i?.stage,
|
|
1558
1586
|
queue: !0,
|
|
1559
|
-
endpoint:
|
|
1587
|
+
endpoint: A,
|
|
1560
1588
|
fn_index: x
|
|
1561
|
-
}),
|
|
1589
|
+
}), O?.close(), V()));
|
|
1562
1590
|
};
|
|
1563
|
-
} else if (
|
|
1564
|
-
|
|
1591
|
+
} else if (w == "sse_v1" || w == "sse_v2" || w == "sse_v2.1" || w == "sse_v3") {
|
|
1592
|
+
I({
|
|
1565
1593
|
type: "status",
|
|
1566
1594
|
stage: "pending",
|
|
1567
1595
|
queue: !0,
|
|
1568
|
-
endpoint:
|
|
1596
|
+
endpoint: A,
|
|
1569
1597
|
fn_index: x,
|
|
1570
1598
|
time: /* @__PURE__ */ new Date()
|
|
1571
1599
|
});
|
|
1572
1600
|
let e = "";
|
|
1573
1601
|
typeof window < "u" && typeof document < "u" && (e = window?.location?.hostname);
|
|
1574
|
-
let t =
|
|
1602
|
+
let t = Ye(e);
|
|
1575
1603
|
return (typeof window < "u" && typeof document < "u" && window.parent != window && t && window.supports_zerogpu_headers ? De("zerogpu-headers", t) : Promise.resolve(null)).then((e) => {
|
|
1576
1604
|
let t = {
|
|
1577
|
-
...
|
|
1605
|
+
...D,
|
|
1578
1606
|
...e || {}
|
|
1579
1607
|
};
|
|
1580
|
-
return g(`${l.root}${y}/${d}?${
|
|
1581
|
-
...
|
|
1608
|
+
return g(`${l.root}${y}/${d}?${F}`, {
|
|
1609
|
+
...j,
|
|
1582
1610
|
session_hash: f
|
|
1583
1611
|
}, t);
|
|
1584
1612
|
}).then(async ([e, t]) => {
|
|
1585
|
-
if (e.event_id && (
|
|
1613
|
+
if (e.event_id && (k = e.event_id), t === 503) I({
|
|
1586
1614
|
type: "status",
|
|
1587
1615
|
stage: "error",
|
|
1588
1616
|
message: oe,
|
|
1589
1617
|
queue: !0,
|
|
1590
|
-
endpoint:
|
|
1618
|
+
endpoint: A,
|
|
1591
1619
|
fn_index: x,
|
|
1592
1620
|
time: /* @__PURE__ */ new Date(),
|
|
1593
1621
|
visible: !0
|
|
1594
|
-
}),
|
|
1595
|
-
else if (t === 422)
|
|
1622
|
+
}), V();
|
|
1623
|
+
else if (t === 422) I({
|
|
1596
1624
|
type: "status",
|
|
1597
1625
|
stage: "error",
|
|
1598
1626
|
message: e.detail,
|
|
1599
1627
|
queue: !0,
|
|
1600
|
-
endpoint:
|
|
1628
|
+
endpoint: A,
|
|
1601
1629
|
fn_index: x,
|
|
1602
1630
|
code: "validation_error",
|
|
1603
1631
|
time: /* @__PURE__ */ new Date(),
|
|
1604
1632
|
visible: !0
|
|
1605
|
-
}),
|
|
1633
|
+
}), V();
|
|
1606
1634
|
else if (t !== 200) {
|
|
1607
1635
|
let t = e?.error === _;
|
|
1608
|
-
|
|
1636
|
+
I({
|
|
1609
1637
|
type: "status",
|
|
1610
1638
|
stage: "error",
|
|
1611
1639
|
broken: t,
|
|
1612
1640
|
message: t ? _ : e.detail || e.error,
|
|
1613
1641
|
queue: !0,
|
|
1614
|
-
endpoint:
|
|
1642
|
+
endpoint: A,
|
|
1615
1643
|
fn_index: x,
|
|
1616
1644
|
time: /* @__PURE__ */ new Date(),
|
|
1617
1645
|
visible: !0
|
|
1618
|
-
}),
|
|
1646
|
+
}), V();
|
|
1619
1647
|
} else {
|
|
1620
|
-
|
|
1648
|
+
M = e.event_id, k = M;
|
|
1621
1649
|
let t = async function(e) {
|
|
1622
1650
|
try {
|
|
1623
|
-
let { type: t, status: n, data: r, original_msg: i } =
|
|
1651
|
+
let { type: t, status: n, data: r, original_msg: i } = be(e, P[x]);
|
|
1624
1652
|
if (t == "heartbeat") return;
|
|
1625
|
-
if (t === "update" && n && !
|
|
1653
|
+
if (t === "update" && n && !N) I({
|
|
1626
1654
|
type: "status",
|
|
1627
|
-
endpoint:
|
|
1655
|
+
endpoint: A,
|
|
1628
1656
|
fn_index: x,
|
|
1629
1657
|
time: /* @__PURE__ */ new Date(),
|
|
1630
1658
|
original_msg: i,
|
|
1631
1659
|
...n
|
|
1632
1660
|
});
|
|
1633
|
-
else if (t === "complete")
|
|
1661
|
+
else if (t === "complete") N = n;
|
|
1634
1662
|
else if (t == "unexpected_error" || t == "broken_connection") {
|
|
1635
1663
|
console.error("Unexpected error", n?.message);
|
|
1636
1664
|
let e = t === "broken_connection";
|
|
1637
|
-
|
|
1665
|
+
I({
|
|
1638
1666
|
type: "status",
|
|
1639
1667
|
stage: "error",
|
|
1640
1668
|
message: n?.message || "An Unexpected Error Occurred!",
|
|
1641
1669
|
queue: !0,
|
|
1642
|
-
endpoint:
|
|
1670
|
+
endpoint: A,
|
|
1643
1671
|
broken: e,
|
|
1644
1672
|
session_not_found: n?.session_not_found,
|
|
1645
1673
|
fn_index: x,
|
|
1646
1674
|
time: /* @__PURE__ */ new Date()
|
|
1647
1675
|
});
|
|
1648
1676
|
} else if (t === "log") {
|
|
1649
|
-
|
|
1677
|
+
I({
|
|
1650
1678
|
type: "log",
|
|
1651
1679
|
title: r.title,
|
|
1652
1680
|
log: r.log,
|
|
1653
1681
|
level: r.level,
|
|
1654
|
-
endpoint:
|
|
1682
|
+
endpoint: A,
|
|
1655
1683
|
duration: r.duration,
|
|
1656
1684
|
visible: r.visible,
|
|
1657
1685
|
fn_index: x
|
|
1658
1686
|
});
|
|
1659
1687
|
return;
|
|
1660
|
-
} else (t === "generating" || t === "streaming") && (
|
|
1688
|
+
} else (t === "generating" || t === "streaming") && (I({
|
|
1661
1689
|
type: "status",
|
|
1662
1690
|
time: /* @__PURE__ */ new Date(),
|
|
1663
1691
|
...n,
|
|
1664
1692
|
stage: n?.stage,
|
|
1665
1693
|
queue: !0,
|
|
1666
|
-
endpoint:
|
|
1694
|
+
endpoint: A,
|
|
1667
1695
|
fn_index: x
|
|
1668
|
-
}), r &&
|
|
1696
|
+
}), r && C.connection !== "stream" && [
|
|
1669
1697
|
"sse_v2",
|
|
1670
1698
|
"sse_v2.1",
|
|
1671
1699
|
"sse_v3"
|
|
1672
|
-
].includes(
|
|
1673
|
-
r && (
|
|
1700
|
+
].includes(w) && at(ne, M, r));
|
|
1701
|
+
r && (I({
|
|
1674
1702
|
type: "data",
|
|
1675
1703
|
time: /* @__PURE__ */ new Date(),
|
|
1676
|
-
data: W(r.data,
|
|
1677
|
-
endpoint:
|
|
1704
|
+
data: W(r.data, C, l.components, "output", v.with_null_state),
|
|
1705
|
+
endpoint: A,
|
|
1678
1706
|
fn_index: x
|
|
1679
|
-
}), r.render_config && await
|
|
1707
|
+
}), r.render_config && await L(r.render_config), N && (I({
|
|
1680
1708
|
type: "status",
|
|
1681
1709
|
time: /* @__PURE__ */ new Date(),
|
|
1682
|
-
...
|
|
1710
|
+
...N,
|
|
1683
1711
|
stage: n?.stage,
|
|
1684
1712
|
queue: !0,
|
|
1685
|
-
endpoint:
|
|
1713
|
+
endpoint: A,
|
|
1686
1714
|
fn_index: x
|
|
1687
|
-
}),
|
|
1715
|
+
}), V())), (n?.stage === "complete" || n?.stage === "error") && (h[M] && delete h[M], M in ne && delete ne[M], V());
|
|
1688
1716
|
} catch (e) {
|
|
1689
|
-
console.error("Unexpected client exception", e),
|
|
1717
|
+
console.error("Unexpected client exception", e), I({
|
|
1690
1718
|
type: "status",
|
|
1691
1719
|
stage: "error",
|
|
1692
1720
|
message: "An Unexpected Error Occurred!",
|
|
1693
1721
|
queue: !0,
|
|
1694
|
-
endpoint:
|
|
1722
|
+
endpoint: A,
|
|
1695
1723
|
fn_index: x,
|
|
1696
1724
|
time: /* @__PURE__ */ new Date()
|
|
1697
1725
|
}), [
|
|
1698
1726
|
"sse_v2",
|
|
1699
1727
|
"sse_v2.1",
|
|
1700
1728
|
"sse_v3"
|
|
1701
|
-
].includes(
|
|
1729
|
+
].includes(w) && (it(ee, b.abort_controller), ee.open = !1, V());
|
|
1702
1730
|
}
|
|
1703
1731
|
};
|
|
1704
|
-
|
|
1732
|
+
M in te && (te[M].forEach((e) => t(e)), delete te[M]), h[M] = t, re.add(M), ee.open || await this.open_stream();
|
|
1705
1733
|
}
|
|
1706
1734
|
});
|
|
1707
1735
|
}
|
|
1708
1736
|
});
|
|
1709
|
-
|
|
1710
|
-
|
|
1737
|
+
R.catch((e) => {
|
|
1738
|
+
I({
|
|
1711
1739
|
type: "status",
|
|
1712
1740
|
stage: "error",
|
|
1713
1741
|
message: e instanceof Error ? e.message : String(e),
|
|
1714
1742
|
queue: !Ee(x, l),
|
|
1715
|
-
endpoint:
|
|
1743
|
+
endpoint: A,
|
|
1716
1744
|
fn_index: x,
|
|
1717
1745
|
time: /* @__PURE__ */ new Date()
|
|
1718
|
-
}),
|
|
1746
|
+
}), V();
|
|
1719
1747
|
});
|
|
1720
|
-
let
|
|
1721
|
-
function
|
|
1722
|
-
for (
|
|
1748
|
+
let Ce = !1, z = [], B = [];
|
|
1749
|
+
function V() {
|
|
1750
|
+
for (Ce = !0; B.length > 0;) B.shift()({
|
|
1723
1751
|
value: void 0,
|
|
1724
1752
|
done: !0
|
|
1725
1753
|
});
|
|
1726
1754
|
}
|
|
1727
|
-
function
|
|
1728
|
-
|
|
1755
|
+
function H(e) {
|
|
1756
|
+
B.length > 0 ? B.shift()(e) : z.push(e);
|
|
1729
1757
|
}
|
|
1730
1758
|
function we(e) {
|
|
1731
|
-
|
|
1759
|
+
H(Qt(e)), V();
|
|
1732
1760
|
}
|
|
1733
1761
|
function Te(e) {
|
|
1734
|
-
|
|
1762
|
+
H({
|
|
1735
1763
|
value: e,
|
|
1736
1764
|
done: !1
|
|
1737
1765
|
});
|
|
1738
1766
|
}
|
|
1739
|
-
function
|
|
1740
|
-
return
|
|
1767
|
+
function U() {
|
|
1768
|
+
return z.length > 0 ? Promise.resolve(z.shift()) : Ce ? Promise.resolve({
|
|
1741
1769
|
value: void 0,
|
|
1742
1770
|
done: !0
|
|
1743
|
-
}) : new Promise((e) =>
|
|
1771
|
+
}) : new Promise((e) => B.push(e));
|
|
1744
1772
|
}
|
|
1745
|
-
let
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1773
|
+
let Oe = (e, t) => {
|
|
1774
|
+
R.then(() => {
|
|
1775
|
+
k && this.post_data(`${l.root}${y}/stream/${k}${e}`, t);
|
|
1776
|
+
}, () => {});
|
|
1777
|
+
}, ke = {
|
|
1778
|
+
[Symbol.asyncIterator]: () => ke,
|
|
1779
|
+
next: U,
|
|
1780
|
+
throw: async (e) => (we(e), U()),
|
|
1781
|
+
return: async () => (V(), {
|
|
1750
1782
|
value: void 0,
|
|
1751
1783
|
done: !0
|
|
1752
1784
|
}),
|
|
1753
1785
|
cancel: ye,
|
|
1754
1786
|
send_chunk: (e) => {
|
|
1755
|
-
|
|
1787
|
+
Oe("", {
|
|
1756
1788
|
...e,
|
|
1757
1789
|
session_hash: this.session_hash
|
|
1758
1790
|
});
|
|
1759
1791
|
},
|
|
1760
1792
|
close_stream: () => {
|
|
1761
|
-
|
|
1793
|
+
V(), Oe("/close", {});
|
|
1762
1794
|
},
|
|
1763
|
-
event_id: () =>
|
|
1764
|
-
wait_for_id: async () => (await
|
|
1795
|
+
event_id: () => k,
|
|
1796
|
+
wait_for_id: async () => (await R, M)
|
|
1765
1797
|
};
|
|
1766
|
-
return
|
|
1798
|
+
return ke;
|
|
1767
1799
|
} catch (e) {
|
|
1768
1800
|
throw console.error("Submit function encountered an error:", e), e;
|
|
1769
1801
|
}
|
|
1770
1802
|
}
|
|
1771
|
-
function
|
|
1803
|
+
function Qt(e) {
|
|
1772
1804
|
return { then: (t, n) => n(e) };
|
|
1773
1805
|
}
|
|
1774
|
-
function
|
|
1806
|
+
function $t(e, t, n, r) {
|
|
1775
1807
|
let i, a, o;
|
|
1776
1808
|
if (typeof t == "number") i = t, a = e.unnamed_endpoints[i], o = r.dependencies.find((e) => e.id == t);
|
|
1777
1809
|
else {
|
|
@@ -1794,6 +1826,7 @@ var Q = class {
|
|
|
1794
1826
|
app_reference;
|
|
1795
1827
|
options;
|
|
1796
1828
|
deep_link = null;
|
|
1829
|
+
page = null;
|
|
1797
1830
|
config;
|
|
1798
1831
|
api_prefix = "";
|
|
1799
1832
|
api_info;
|
|
@@ -1842,7 +1875,7 @@ var Q = class {
|
|
|
1842
1875
|
let t = new Headers();
|
|
1843
1876
|
return this && this.cookies && t.append("Cookie", this.cookies), this && this.options.headers && new Headers(this.options.headers).forEach((e, n) => {
|
|
1844
1877
|
t.append(n, e);
|
|
1845
|
-
}), this && this.options.token && t.append("Authorization", `Bearer ${this.options.token}`), this.abort_controller = new AbortController(), this.stream_instance =
|
|
1878
|
+
}), this && this.options.token && t.append("Authorization", `Bearer ${this.options.token}`), this.abort_controller = new AbortController(), this.stream_instance = ct(e.toString(), {
|
|
1846
1879
|
credentials: this.options.credentials ?? "same-origin",
|
|
1847
1880
|
headers: t,
|
|
1848
1881
|
signal: this.abort_controller.signal
|
|
@@ -1859,20 +1892,20 @@ var Q = class {
|
|
|
1859
1892
|
resolve_config;
|
|
1860
1893
|
resolve_cookies;
|
|
1861
1894
|
constructor(e, t = { events: ["data"] }) {
|
|
1862
|
-
this.app_reference = e, this.deep_link = t.query_params?.deep_link || null, t.events ||= ["data"],
|
|
1895
|
+
this.app_reference = e, this.deep_link = t.query_params?.deep_link || null, this.page = t.query_params?.page ?? null, t.events ||= ["data"], T(t), this.options = t, this.current_payload = {}, t.cookies && (this.cookies = t.cookies), this.view_api = Se.bind(this), this.upload_files = L.bind(this), this.handle_blob = Me.bind(this), this.post_data = Ie.bind(this), this.submit = Zt.bind(this), this.predict = Le.bind(this), this.open_stream = rt.bind(this), this.resolve_config = D.bind(this), this.resolve_cookies = O.bind(this), this.upload = z.bind(this), this.fetch = this.fetch.bind(this), this.handle_space_success = this.handle_space_success.bind(this), this.stream = this.stream.bind(this);
|
|
1863
1896
|
}
|
|
1864
1897
|
async init() {
|
|
1865
|
-
|
|
1898
|
+
Xe(), this.options.auth && await this.resolve_cookies(), await this._resolve_config().then((e) => e?.config && this._resolve_heartbeat(e.config));
|
|
1866
1899
|
try {
|
|
1867
1900
|
this.api_info = await this.view_api();
|
|
1868
1901
|
} catch (e) {
|
|
1869
1902
|
console.error(e.message);
|
|
1870
1903
|
}
|
|
1871
|
-
this.api_map =
|
|
1904
|
+
this.api_map = E(this.config?.dependencies || []);
|
|
1872
1905
|
}
|
|
1873
1906
|
async _resolve_heartbeat(e) {
|
|
1874
|
-
if (
|
|
1875
|
-
let e = new URL(`${this.config.root}${this.api_prefix}/${
|
|
1907
|
+
if (this.config = e, this.api_prefix = e.api_prefix || "", e.space_id && this.options.token && (this.jwt = await he(e.space_id, this.options.token, this.cookies)), je(this.config, this.jwt), this.config && this.config.connect_heartbeat) {
|
|
1908
|
+
let e = new URL(`${this.config.root}${this.api_prefix}/${h}/${this.session_hash}`);
|
|
1876
1909
|
this.jwt && e.searchParams.set("__sign", this.jwt), this.heartbeat_event ||= this.stream(e);
|
|
1877
1910
|
}
|
|
1878
1911
|
}
|
|
@@ -1892,13 +1925,13 @@ var Q = class {
|
|
|
1892
1925
|
return t === this.config.app_id ? "connected" : "changed";
|
|
1893
1926
|
}
|
|
1894
1927
|
close() {
|
|
1895
|
-
this.closed = !0,
|
|
1928
|
+
this.closed = !0, it(this.stream_status, this.abort_controller);
|
|
1896
1929
|
}
|
|
1897
1930
|
async refresh() {
|
|
1898
1931
|
if (!this.config) throw Error(v);
|
|
1899
1932
|
let e = await this.resolve_config(this.config.root, !1);
|
|
1900
1933
|
if (!e) throw Error(v);
|
|
1901
|
-
this.config = e, this.api_prefix = e.api_prefix || "", this.api_map =
|
|
1934
|
+
this.config = e, this.api_prefix = e.api_prefix || "", this.api_map = E(e.dependencies || []), je(this.config, this.jwt);
|
|
1902
1935
|
try {
|
|
1903
1936
|
this.api_info = await this.view_api();
|
|
1904
1937
|
} catch (e) {
|
|
@@ -1910,11 +1943,11 @@ var Q = class {
|
|
|
1910
1943
|
this.current_payload = e;
|
|
1911
1944
|
}
|
|
1912
1945
|
static async duplicate(e, t = { events: ["data"] }) {
|
|
1913
|
-
return
|
|
1946
|
+
return We(e, t);
|
|
1914
1947
|
}
|
|
1915
1948
|
async _resolve_config() {
|
|
1916
|
-
let { http_protocol: e, host: t, space_id: n } = await
|
|
1917
|
-
n && r && await
|
|
1949
|
+
let { http_protocol: e, host: t, space_id: n } = await P(this.app_reference, this.options.token), { status_callback: r } = this.options;
|
|
1950
|
+
n && r && await Re(n, r);
|
|
1918
1951
|
let i;
|
|
1919
1952
|
try {
|
|
1920
1953
|
let n = `${e}//${t}`;
|
|
@@ -1931,7 +1964,7 @@ var Q = class {
|
|
|
1931
1964
|
}
|
|
1932
1965
|
}
|
|
1933
1966
|
async config_success(e) {
|
|
1934
|
-
if (this.config = e, this.api_prefix = e.api_prefix || "", e.run_history === !1 &&
|
|
1967
|
+
if (this.config = e, this.api_prefix = e.api_prefix || "", e.run_history === !1 && Ht({
|
|
1935
1968
|
app_id: e.app_id,
|
|
1936
1969
|
username: e.username
|
|
1937
1970
|
}), this.config.auth_required) return this.prepare_return_obj();
|
|
@@ -1984,7 +2017,8 @@ var Q = class {
|
|
|
1984
2017
|
credentials: this.options.credentials ?? "same-origin"
|
|
1985
2018
|
});
|
|
1986
2019
|
if (!e.ok) throw Error("Could not connect to component server: " + e.statusText);
|
|
1987
|
-
|
|
2020
|
+
let t = await e.json();
|
|
2021
|
+
return Ae(t, this.config.root, this.config.api_prefix || "", this.jwt), t;
|
|
1988
2022
|
} catch (e) {
|
|
1989
2023
|
console.warn(e);
|
|
1990
2024
|
}
|
|
@@ -2002,23 +2036,23 @@ var Q = class {
|
|
|
2002
2036
|
};
|
|
2003
2037
|
}
|
|
2004
2038
|
};
|
|
2005
|
-
async function
|
|
2039
|
+
async function en(e, t = { events: ["data"] }) {
|
|
2006
2040
|
return await Q.connect(e, t);
|
|
2007
2041
|
}
|
|
2008
|
-
async function
|
|
2042
|
+
async function tn(e, t) {
|
|
2009
2043
|
return await Q.duplicate(e, t);
|
|
2010
2044
|
}
|
|
2011
2045
|
//#endregion
|
|
2012
2046
|
//#region src/utils/bucket_sync.ts
|
|
2013
|
-
var
|
|
2014
|
-
function
|
|
2015
|
-
return
|
|
2047
|
+
var nn = /^[a-zA-Z0-9_.-]+\/[a-zA-Z0-9_.-][a-zA-Z0-9_./-]*$/;
|
|
2048
|
+
function rn(e) {
|
|
2049
|
+
return nn.test(e) ? !e.split("/").some((e) => e === "" || e === "." || e === "..") : !1;
|
|
2016
2050
|
}
|
|
2017
2051
|
function $(e, t, n) {
|
|
2018
2052
|
let r = n ? `?${new URLSearchParams(n)}` : "", i = e.replace(/\/+$/, "");
|
|
2019
2053
|
return i ? `${i}/gradio_api/run-history/${t}${r}` : typeof document < "u" && document.baseURI ? new URL(`gradio_api/run-history/${t}${r}`, document.baseURI).toString() : `gradio_api/run-history/${t}${r}`;
|
|
2020
2054
|
}
|
|
2021
|
-
async function
|
|
2055
|
+
async function an(e) {
|
|
2022
2056
|
try {
|
|
2023
2057
|
let t = await e.json();
|
|
2024
2058
|
return typeof t?.detail == "string" ? t.detail : `${e.status}`;
|
|
@@ -2026,7 +2060,7 @@ async function tn(e) {
|
|
|
2026
2060
|
return `${e.status}`;
|
|
2027
2061
|
}
|
|
2028
2062
|
}
|
|
2029
|
-
async function
|
|
2063
|
+
async function on(e, t, n, r) {
|
|
2030
2064
|
try {
|
|
2031
2065
|
let i = await fetch(e, {
|
|
2032
2066
|
credentials: "include",
|
|
@@ -2040,7 +2074,7 @@ async function nn(e, t, n, r) {
|
|
|
2040
2074
|
ok: !1,
|
|
2041
2075
|
status: i.status,
|
|
2042
2076
|
data: n,
|
|
2043
|
-
detail: await
|
|
2077
|
+
detail: await an(i)
|
|
2044
2078
|
};
|
|
2045
2079
|
} catch (e) {
|
|
2046
2080
|
return {
|
|
@@ -2051,8 +2085,8 @@ async function nn(e, t, n, r) {
|
|
|
2051
2085
|
};
|
|
2052
2086
|
}
|
|
2053
2087
|
}
|
|
2054
|
-
async function
|
|
2055
|
-
return
|
|
2088
|
+
async function sn(e, t) {
|
|
2089
|
+
return rn(t) ? on($(e, "connect"), {
|
|
2056
2090
|
method: "POST",
|
|
2057
2091
|
headers: { "Content-Type": "application/json" },
|
|
2058
2092
|
body: JSON.stringify({ bucket_id: t })
|
|
@@ -2063,14 +2097,14 @@ async function rn(e, t) {
|
|
|
2063
2097
|
detail: "invalid bucket id"
|
|
2064
2098
|
};
|
|
2065
2099
|
}
|
|
2066
|
-
async function
|
|
2067
|
-
return
|
|
2100
|
+
async function cn(e) {
|
|
2101
|
+
return on($(e, "buckets"), {}, [], (e) => Array.isArray(e?.buckets) ? e.buckets : []);
|
|
2068
2102
|
}
|
|
2069
|
-
async function
|
|
2070
|
-
return
|
|
2103
|
+
async function ln(e, t) {
|
|
2104
|
+
return on($(e, "records", { bucket: t }), {}, [], (e) => Array.isArray(e?.records) ? e.records : []);
|
|
2071
2105
|
}
|
|
2072
|
-
function
|
|
2106
|
+
function un(e, t, n, r, i) {
|
|
2073
2107
|
return $(e, `records/${encodeURIComponent(n)}/${encodeURIComponent(r)}/assets/${encodeURIComponent(i)}`, { bucket: t });
|
|
2074
2108
|
}
|
|
2075
2109
|
//#endregion
|
|
2076
|
-
export { Q as Client, V as FileData,
|
|
2110
|
+
export { Q as Client, V as FileData, C as MISSING_CREDENTIALS_MSG, Kt as apply_run_history_replay, un as asset_url, Ht as clear_run_history, en as client, sn as connect_bucket, Gt as consume_run_history_replay, Ut as delete_run_history, tn as duplicate, Oe as handle_file, rn as is_valid_bucket_id, ln as list_bucket_records, cn as list_user_buckets, Xt as on_run_history_change, Le as predict, B as prepare_files, zt as read_run_history, Bt as read_run_history_storage, mt as run_history_url, Vt as set_run_history_storage, Wt as stage_run_history_replay, Zt as submit, o as t, z as upload, L as upload_files };
|