LennardZuendorf commited on
Commit
d2116db
1 Parent(s): 4345b53

feat: implementing new explanation ui

Browse files
.idea/thesis-webapp.iml CHANGED
@@ -3,7 +3,6 @@
3
  <component name="NewModuleRootManager">
4
  <content url="file://$MODULE_DIR$">
5
  <sourceFolder url="file://$MODULE_DIR$/components/bertviz/backend" isTestSource="false" />
6
- <sourceFolder url="file://$MODULE_DIR$/components/iframe/backend" isTestSource="false" />
7
  <sourceFolder url="file://$MODULE_DIR$/components/shap-plots/backend" isTestSource="false" />
8
  <sourceFolder url="file://$MODULE_DIR$/components/shap/backend" isTestSource="false" />
9
  <sourceFolder url="file://$MODULE_DIR$/components/visualizer/backend" isTestSource="false" />
 
3
  <component name="NewModuleRootManager">
4
  <content url="file://$MODULE_DIR$">
5
  <sourceFolder url="file://$MODULE_DIR$/components/bertviz/backend" isTestSource="false" />
 
6
  <sourceFolder url="file://$MODULE_DIR$/components/shap-plots/backend" isTestSource="false" />
7
  <sourceFolder url="file://$MODULE_DIR$/components/shap/backend" isTestSource="false" />
8
  <sourceFolder url="file://$MODULE_DIR$/components/visualizer/backend" isTestSource="false" />
backend/controller.py CHANGED
@@ -40,13 +40,15 @@ def interference(
40
  raise RuntimeError("There was an error in the selected XAI approach.")
41
 
42
  # call the explained chat function
43
- prompt_output, history_output, xai_graphic, xai_plot = explained_chat(
44
- model=godel,
45
- xai=xai,
46
- message=prompt,
47
- history=history,
48
- system_prompt=system_prompt,
49
- knowledge=knowledge,
 
 
50
  )
51
  # if no (or invalid) XAI approach is selected call the vanilla chat function
52
  else:
@@ -59,16 +61,17 @@ def interference(
59
  knowledge=knowledge,
60
  )
61
  # set XAI outputs to disclaimer html/none
62
- xai_graphic, xai_plot = (
63
  """
64
  <div style="text-align: center"><h4>Without Selected XAI Approach,
65
  no graphic will be displayed</h4></div>
66
  """,
67
  None,
 
68
  )
69
 
70
  # return the outputs
71
- return prompt_output, history_output, xai_graphic, xai_plot
72
 
73
 
74
  # simple chat function that calls the model
@@ -95,9 +98,10 @@ def explained_chat(
95
  prompt = model.format_prompt(message, history, system_prompt, knowledge)
96
 
97
  # generating an answer using the xai methods explain and respond function
98
- answer, xai_graphic, xai_plot = xai.chat_explained(model, prompt)
 
99
  # updating the chat history with the new answer
100
  history.append((message, answer))
101
 
102
  # returning the updated history, xai graphic and xai plot elements
103
- return "", history, xai_graphic, xai_plot
 
40
  raise RuntimeError("There was an error in the selected XAI approach.")
41
 
42
  # call the explained chat function
43
+ prompt_output, history_output, xai_graphic, xai_plot, xai_markup = (
44
+ explained_chat(
45
+ model=godel,
46
+ xai=xai,
47
+ message=prompt,
48
+ history=history,
49
+ system_prompt=system_prompt,
50
+ knowledge=knowledge,
51
+ )
52
  )
53
  # if no (or invalid) XAI approach is selected call the vanilla chat function
54
  else:
 
61
  knowledge=knowledge,
62
  )
63
  # set XAI outputs to disclaimer html/none
64
+ xai_graphic, xai_plot, xai_markup = (
65
  """
66
  <div style="text-align: center"><h4>Without Selected XAI Approach,
67
  no graphic will be displayed</h4></div>
68
  """,
69
  None,
70
+ [("", "")],
71
  )
72
 
73
  # return the outputs
74
+ return prompt_output, history_output, xai_graphic, xai_plot, xai_markup
75
 
76
 
77
  # simple chat function that calls the model
 
98
  prompt = model.format_prompt(message, history, system_prompt, knowledge)
99
 
100
  # generating an answer using the xai methods explain and respond function
101
+ answer, xai_graphic, xai_plot, xai_markup = xai.chat_explained(model, prompt)
102
+
103
  # updating the chat history with the new answer
104
  history.append((message, answer))
105
 
106
  # returning the updated history, xai graphic and xai plot elements
107
+ return "", history, xai_graphic, xai_plot, xai_markup
components/iframe/backend/gradio_iframe/__init__.py CHANGED
@@ -1,3 +1,4 @@
 
1
  from .iframe import iframe
2
 
3
- __all__ = ["iframe"]
 
1
+
2
  from .iframe import iframe
3
 
4
+ __all__ = ['iframe']
components/iframe/backend/gradio_iframe/iframe.py CHANGED
@@ -17,7 +17,7 @@ class iframe(Component):
17
  """
18
  Used to display arbitrary iframe output.
19
  Preprocessing: this component does *not* accept input.
20
- Postprocessing: expects a valid iframe {str}.
21
 
22
  Demos: text_analysis
23
  Guides: key-features
 
17
  """
18
  Used to display arbitrary iframe output.
19
  Preprocessing: this component does *not* accept input.
20
+ Postprocessing: expects valid html {str}, which will be turned into an iframe.
21
 
22
  Demos: text_analysis
23
  Guides: key-features
components/iframe/backend/gradio_iframe/templates/component/index.js CHANGED
@@ -1,56 +1,65 @@
1
  const {
2
- SvelteComponent: lt,
3
- attr: he,
4
- detach: nt,
5
- element: it,
6
- init: st,
7
- insert: ft,
8
- noop: we,
9
- safe_not_equal: ot,
10
- toggle_class: W
11
- } = window.__gradio__svelte__internal, { createEventDispatcher: at } = window.__gradio__svelte__internal;
12
- function rt(n) {
13
- let t, e;
 
14
  return {
15
  c() {
16
- t = it("div"), he(t, "class", e = "prose " + /*elem_classes*/
17
- n[0].join(" ") + " svelte-2qygph"), W(
 
 
 
 
 
18
  t,
19
  "min",
20
  /*min_height*/
21
  n[3]
22
- ), W(t, "hide", !/*visible*/
23
  n[2]);
24
  },
25
- m(l, i) {
26
- ft(l, t, i), t.innerHTML = /*value*/
27
- n[1];
28
  },
29
- p(l, [i]) {
30
- i & /*value*/
31
- 2 && (t.innerHTML = /*value*/
32
- l[1]), i & /*elem_classes*/
33
- 1 && e !== (e = "prose " + /*elem_classes*/
34
- l[0].join(" ") + " svelte-2qygph") && he(t, "class", e), i & /*elem_classes, min_height*/
35
- 9 && W(
 
 
 
 
36
  t,
37
  "min",
38
  /*min_height*/
39
- l[3]
40
- ), i & /*elem_classes, visible*/
41
- 5 && W(t, "hide", !/*visible*/
42
- l[2]);
43
  },
44
- i: we,
45
- o: we,
46
- d(l) {
47
- l && nt(t);
48
  }
49
  };
50
  }
51
- function _t(n, t, e) {
52
  let { elem_classes: l = [] } = t, { value: i } = t, { visible: f = !0 } = t, { min_height: o = !1 } = t;
53
- const a = at();
54
  return n.$$set = (r) => {
55
  "elem_classes" in r && e(0, l = r.elem_classes), "value" in r && e(1, i = r.value), "visible" in r && e(2, f = r.visible), "min_height" in r && e(3, o = r.min_height);
56
  }, n.$$.update = () => {
@@ -58,9 +67,9 @@ function _t(n, t, e) {
58
  2 && a("change");
59
  }, [l, i, f, o];
60
  }
61
- class ut extends lt {
62
  constructor(t) {
63
- super(), st(this, t, _t, rt, ot, {
64
  elem_classes: 0,
65
  value: 1,
66
  visible: 2,
@@ -68,59 +77,59 @@ class ut extends lt {
68
  });
69
  }
70
  }
71
- function X(n) {
72
  let t = ["", "k", "M", "G", "T", "P", "E", "Z"], e = 0;
73
  for (; n > 1e3 && e < t.length - 1; )
74
  n /= 1e3, e++;
75
  let l = t[e];
76
  return (Number.isInteger(n) ? n : n.toFixed(1)) + l;
77
  }
78
- function ee() {
79
  }
80
- function ct(n, t) {
81
  return n != n ? t == t : n !== t || n && typeof n == "object" || typeof n == "function";
82
  }
83
- const Oe = typeof window < "u";
84
- let ve = Oe ? () => window.performance.now() : () => Date.now(), Re = Oe ? (n) => requestAnimationFrame(n) : ee;
85
- const Y = /* @__PURE__ */ new Set();
86
- function Ue(n) {
87
- Y.forEach((t) => {
88
- t.c(n) || (Y.delete(t), t.f());
89
- }), Y.size !== 0 && Re(Ue);
90
  }
91
- function dt(n) {
92
  let t;
93
- return Y.size === 0 && Re(Ue), {
94
  promise: new Promise((e) => {
95
- Y.add(t = { c: n, f: e });
96
  }),
97
  abort() {
98
- Y.delete(t);
99
  }
100
  };
101
  }
102
- const H = [];
103
- function mt(n, t = ee) {
104
  let e;
105
  const l = /* @__PURE__ */ new Set();
106
  function i(a) {
107
- if (ct(n, a) && (n = a, e)) {
108
- const r = !H.length;
109
  for (const s of l)
110
- s[1](), H.push(s, n);
111
  if (r) {
112
- for (let s = 0; s < H.length; s += 2)
113
- H[s][0](H[s + 1]);
114
- H.length = 0;
115
  }
116
  }
117
  }
118
  function f(a) {
119
  i(a(n));
120
  }
121
- function o(a, r = ee) {
122
  const s = [a, r];
123
- return l.add(s), l.size === 1 && (e = t(i, f) || ee), a(n), () => {
124
  l.delete(s), l.size === 0 && e && (e(), e = null);
125
  };
126
  }
@@ -129,41 +138,41 @@ function mt(n, t = ee) {
129
  function ye(n) {
130
  return Object.prototype.toString.call(n) === "[object Date]";
131
  }
132
- function se(n, t, e, l) {
133
  if (typeof e == "number" || ye(e)) {
134
  const i = l - e, f = (e - t) / (n.dt || 1 / 60), o = n.opts.stiffness * i, a = n.opts.damping * f, r = (o - a) * n.inv_mass, s = (f + r) * n.dt;
135
  return Math.abs(s) < n.opts.precision && Math.abs(i) < n.opts.precision ? l : (n.settled = !1, ye(e) ? new Date(e.getTime() + s) : e + s);
136
  } else {
137
  if (Array.isArray(e))
138
  return e.map(
139
- (i, f) => se(n, t[f], e[f], l[f])
140
  );
141
  if (typeof e == "object") {
142
  const i = {};
143
  for (const f in e)
144
- i[f] = se(n, t[f], e[f], l[f]);
145
  return i;
146
  } else
147
  throw new Error(`Cannot spring ${typeof e} values`);
148
  }
149
  }
150
  function ke(n, t = {}) {
151
- const e = mt(n), { stiffness: l = 0.15, damping: i = 0.8, precision: f = 0.01 } = t;
152
  let o, a, r, s = n, _ = n, c = 1, w = 0, h = !1;
153
- function y(p, L = {}) {
154
- _ = p;
155
  const F = r = {};
156
- return n == null || L.hard || C.stiffness >= 1 && C.damping >= 1 ? (h = !0, o = ve(), s = p, e.set(n = _), Promise.resolve()) : (L.soft && (w = 1 / ((L.soft === !0 ? 0.5 : +L.soft) * 60), c = 0), a || (o = ve(), h = !1, a = dt((u) => {
157
  if (h)
158
  return h = !1, a = null, !1;
159
  c = Math.min(c + w, 1);
160
- const k = {
161
  inv_mass: c,
162
  opts: C,
163
  settled: !0,
164
  dt: (u - o) * 60 / 1e3
165
- }, m = se(k, s, n, _);
166
- return o = u, s = n, e.set(n = m), k.settled && (a = null), !k.settled;
167
  })), new Promise((u) => {
168
  a.promise.then(() => {
169
  F === r && u();
@@ -171,8 +180,8 @@ function ke(n, t = {}) {
171
  }));
172
  }
173
  const C = {
174
- set: y,
175
- update: (p, L) => y(p(_, n), L),
176
  subscribe: e.subscribe,
177
  stiffness: l,
178
  damping: i,
@@ -181,66 +190,66 @@ function ke(n, t = {}) {
181
  return C;
182
  }
183
  const {
184
- SvelteComponent: bt,
185
  append: N,
186
  attr: v,
187
- component_subscribe: pe,
188
- detach: gt,
189
- element: ht,
190
- init: wt,
191
- insert: vt,
192
- noop: qe,
193
  safe_not_equal: yt,
194
- set_style: x,
195
- svg_element: T,
196
- toggle_class: Fe
197
  } = window.__gradio__svelte__internal, { onMount: kt } = window.__gradio__svelte__internal;
198
- function pt(n) {
199
  let t, e, l, i, f, o, a, r, s, _, c, w;
200
  return {
201
  c() {
202
- t = ht("div"), e = T("svg"), l = T("g"), i = T("path"), f = T("path"), o = T("path"), a = T("path"), r = T("g"), s = T("path"), _ = T("path"), c = T("path"), w = T("path"), v(i, "d", "M255.926 0.754768L509.702 139.936V221.027L255.926 81.8465V0.754768Z"), v(i, "fill", "#FF7C00"), v(i, "fill-opacity", "0.4"), v(i, "class", "svelte-43sxxs"), v(f, "d", "M509.69 139.936L254.981 279.641V361.255L509.69 221.55V139.936Z"), v(f, "fill", "#FF7C00"), v(f, "class", "svelte-43sxxs"), v(o, "d", "M0.250138 139.937L254.981 279.641V361.255L0.250138 221.55V139.937Z"), v(o, "fill", "#FF7C00"), v(o, "fill-opacity", "0.4"), v(o, "class", "svelte-43sxxs"), v(a, "d", "M255.923 0.232622L0.236328 139.936V221.55L255.923 81.8469V0.232622Z"), v(a, "fill", "#FF7C00"), v(a, "class", "svelte-43sxxs"), x(l, "transform", "translate(" + /*$top*/
203
  n[1][0] + "px, " + /*$top*/
204
- n[1][1] + "px)"), v(s, "d", "M255.926 141.5L509.702 280.681V361.773L255.926 222.592V141.5Z"), v(s, "fill", "#FF7C00"), v(s, "fill-opacity", "0.4"), v(s, "class", "svelte-43sxxs"), v(_, "d", "M509.69 280.679L254.981 420.384V501.998L509.69 362.293V280.679Z"), v(_, "fill", "#FF7C00"), v(_, "class", "svelte-43sxxs"), v(c, "d", "M0.250138 280.681L254.981 420.386V502L0.250138 362.295V280.681Z"), v(c, "fill", "#FF7C00"), v(c, "fill-opacity", "0.4"), v(c, "class", "svelte-43sxxs"), v(w, "d", "M255.923 140.977L0.236328 280.68V362.294L255.923 222.591V140.977Z"), v(w, "fill", "#FF7C00"), v(w, "class", "svelte-43sxxs"), x(r, "transform", "translate(" + /*$bottom*/
205
  n[2][0] + "px, " + /*$bottom*/
206
- n[2][1] + "px)"), v(e, "viewBox", "-1200 -1200 3000 3000"), v(e, "fill", "none"), v(e, "xmlns", "http://www.w3.org/2000/svg"), v(e, "class", "svelte-43sxxs"), v(t, "class", "svelte-43sxxs"), Fe(
207
  t,
208
  "margin",
209
  /*margin*/
210
  n[0]
211
  );
212
  },
213
- m(h, y) {
214
- vt(h, t, y), N(t, e), N(e, l), N(l, i), N(l, f), N(l, o), N(l, a), N(e, r), N(r, s), N(r, _), N(r, c), N(r, w);
215
  },
216
- p(h, [y]) {
217
- y & /*$top*/
218
- 2 && x(l, "transform", "translate(" + /*$top*/
219
  h[1][0] + "px, " + /*$top*/
220
- h[1][1] + "px)"), y & /*$bottom*/
221
- 4 && x(r, "transform", "translate(" + /*$bottom*/
222
  h[2][0] + "px, " + /*$bottom*/
223
- h[2][1] + "px)"), y & /*margin*/
224
- 1 && Fe(
225
  t,
226
  "margin",
227
  /*margin*/
228
  h[0]
229
  );
230
  },
231
- i: qe,
232
- o: qe,
233
  d(h) {
234
- h && gt(t);
235
  }
236
  };
237
  }
238
- function qt(n, t, e) {
239
  let l, i, { margin: f = !0 } = t;
240
  const o = ke([0, 0]);
241
- pe(n, o, (w) => e(1, l = w));
242
  const a = ke([0, 0]);
243
- pe(n, a, (w) => e(2, i = w));
244
  let r;
245
  async function s() {
246
  await Promise.all([o.set([125, 140]), a.set([-125, -140])]), await Promise.all([o.set([-125, 140]), a.set([125, -140])]), await Promise.all([o.set([-125, 0]), a.set([125, -0])]), await Promise.all([o.set([125, 0]), a.set([-125, 0])]);
@@ -255,51 +264,51 @@ function qt(n, t, e) {
255
  "margin" in w && e(0, f = w.margin);
256
  }, [f, l, i, o, a];
257
  }
258
- class Ft extends bt {
259
  constructor(t) {
260
- super(), wt(this, t, qt, pt, yt, { margin: 0 });
261
  }
262
  }
263
  const {
264
- SvelteComponent: Lt,
265
- append: I,
266
- attr: z,
267
- binding_callbacks: Le,
268
- check_outros: Je,
269
- create_component: Ct,
270
- create_slot: Mt,
271
- destroy_component: Vt,
272
- destroy_each: Ke,
273
  detach: b,
274
  element: P,
275
- empty: R,
276
- ensure_array_like: te,
277
- get_all_dirty_from_scope: St,
278
- get_slot_changes: Nt,
279
- group_outros: Qe,
280
  init: Tt,
281
  insert: g,
282
- mount_component: zt,
283
- noop: fe,
284
- safe_not_equal: jt,
285
  set_data: S,
286
- set_style: A,
287
  space: j,
288
  text: q,
289
  toggle_class: V,
290
- transition_in: G,
291
- transition_out: O,
292
- update_slot_base: Pt
293
- } = window.__gradio__svelte__internal, { tick: Zt } = window.__gradio__svelte__internal, { onDestroy: Bt } = window.__gradio__svelte__internal, At = (n) => ({}), Ce = (n) => ({});
294
- function Me(n, t, e) {
295
  const l = n.slice();
296
  return l[38] = t[e], l[40] = e, l;
297
  }
298
- function Ve(n, t, e) {
299
  const l = n.slice();
300
  return l[38] = t[e], l;
301
  }
302
- function Dt(n) {
303
  let t, e = (
304
  /*i18n*/
305
  n[1]("common.error") + ""
@@ -307,86 +316,86 @@ function Dt(n) {
307
  const o = (
308
  /*#slots*/
309
  n[29].error
310
- ), a = Mt(
311
  o,
312
  n,
313
  /*$$scope*/
314
  n[28],
315
- Ce
316
  );
317
  return {
318
  c() {
319
- t = P("span"), l = q(e), i = j(), a && a.c(), z(t, "class", "error svelte-1txqlrd");
320
  },
321
  m(r, s) {
322
- g(r, t, s), I(t, l), g(r, i, s), a && a.m(r, s), f = !0;
323
  },
324
  p(r, s) {
325
  (!f || s[0] & /*i18n*/
326
  2) && e !== (e = /*i18n*/
327
  r[1]("common.error") + "") && S(l, e), a && a.p && (!f || s[0] & /*$$scope*/
328
- 268435456) && Pt(
329
  a,
330
  o,
331
  r,
332
  /*$$scope*/
333
  r[28],
334
- f ? Nt(
335
  o,
336
  /*$$scope*/
337
  r[28],
338
  s,
339
- At
340
- ) : St(
341
  /*$$scope*/
342
  r[28]
343
  ),
344
- Ce
345
  );
346
  },
347
  i(r) {
348
- f || (G(a, r), f = !0);
349
  },
350
  o(r) {
351
- O(a, r), f = !1;
352
  },
353
  d(r) {
354
  r && (b(t), b(i)), a && a.d(r);
355
  }
356
  };
357
  }
358
- function Et(n) {
359
  let t, e, l, i, f, o, a, r, s, _ = (
360
  /*variant*/
361
  n[8] === "default" && /*show_eta_bar*/
362
  n[18] && /*show_progress*/
363
- n[6] === "full" && Se(n)
364
  );
365
- function c(u, k) {
366
  if (
367
  /*progress*/
368
  u[7]
369
  )
370
- return Xt;
371
  if (
372
  /*queue_position*/
373
  u[2] !== null && /*queue_size*/
374
  u[3] !== void 0 && /*queue_position*/
375
  u[2] >= 0
376
  )
377
- return Ht;
378
  if (
379
  /*queue_position*/
380
  u[2] === 0
381
  )
382
- return It;
383
  }
384
- let w = c(n), h = w && w(n), y = (
385
  /*timer*/
386
- n[5] && ze(n)
387
  );
388
- const C = [Rt, Ot], p = [];
389
- function L(u, k) {
390
  return (
391
  /*last_progress_level*/
392
  u[15] != null ? 0 : (
@@ -395,12 +404,12 @@ function Et(n) {
395
  )
396
  );
397
  }
398
- ~(f = L(n)) && (o = p[f] = C[f](n));
399
  let F = !/*timer*/
400
- n[5] && Ee(n);
401
  return {
402
  c() {
403
- _ && _.c(), t = j(), e = P("div"), h && h.c(), l = j(), y && y.c(), i = j(), o && o.c(), a = j(), F && F.c(), r = R(), z(e, "class", "progress-text svelte-1txqlrd"), V(
404
  e,
405
  "meta-text-center",
406
  /*variant*/
@@ -412,21 +421,21 @@ function Et(n) {
412
  n[8] === "default"
413
  );
414
  },
415
- m(u, k) {
416
- _ && _.m(u, k), g(u, t, k), g(u, e, k), h && h.m(e, null), I(e, l), y && y.m(e, null), g(u, i, k), ~f && p[f].m(u, k), g(u, a, k), F && F.m(u, k), g(u, r, k), s = !0;
417
  },
418
- p(u, k) {
419
  /*variant*/
420
  u[8] === "default" && /*show_eta_bar*/
421
  u[18] && /*show_progress*/
422
- u[6] === "full" ? _ ? _.p(u, k) : (_ = Se(u), _.c(), _.m(t.parentNode, t)) : _ && (_.d(1), _ = null), w === (w = c(u)) && h ? h.p(u, k) : (h && h.d(1), h = w && w(u), h && (h.c(), h.m(e, l))), /*timer*/
423
- u[5] ? y ? y.p(u, k) : (y = ze(u), y.c(), y.m(e, null)) : y && (y.d(1), y = null), (!s || k[0] & /*variant*/
424
  256) && V(
425
  e,
426
  "meta-text-center",
427
  /*variant*/
428
  u[8] === "center"
429
- ), (!s || k[0] & /*variant*/
430
  256) && V(
431
  e,
432
  "meta-text",
@@ -434,28 +443,28 @@ function Et(n) {
434
  u[8] === "default"
435
  );
436
  let m = f;
437
- f = L(u), f === m ? ~f && p[f].p(u, k) : (o && (Qe(), O(p[m], 1, 1, () => {
438
- p[m] = null;
439
- }), Je()), ~f ? (o = p[f], o ? o.p(u, k) : (o = p[f] = C[f](u), o.c()), G(o, 1), o.m(a.parentNode, a)) : o = null), /*timer*/
440
- u[5] ? F && (F.d(1), F = null) : F ? F.p(u, k) : (F = Ee(u), F.c(), F.m(r.parentNode, r));
441
  },
442
  i(u) {
443
- s || (G(o), s = !0);
444
  },
445
  o(u) {
446
- O(o), s = !1;
447
  },
448
  d(u) {
449
- u && (b(t), b(e), b(i), b(a), b(r)), _ && _.d(u), h && h.d(), y && y.d(), ~f && p[f].d(u), F && F.d(u);
450
  }
451
  };
452
  }
453
- function Se(n) {
454
  let t, e = `translateX(${/*eta_level*/
455
  (n[17] || 0) * 100 - 100}%)`;
456
  return {
457
  c() {
458
- t = P("div"), z(t, "class", "eta-bar svelte-1txqlrd"), A(t, "transform", e);
459
  },
460
  m(l, i) {
461
  g(l, t, i);
@@ -463,14 +472,14 @@ function Se(n) {
463
  p(l, i) {
464
  i[0] & /*eta_level*/
465
  131072 && e !== (e = `translateX(${/*eta_level*/
466
- (l[17] || 0) * 100 - 100}%)`) && A(t, "transform", e);
467
  },
468
  d(l) {
469
  l && b(t);
470
  }
471
  };
472
  }
473
- function It(n) {
474
  let t;
475
  return {
476
  c() {
@@ -479,13 +488,13 @@ function It(n) {
479
  m(e, l) {
480
  g(e, t, l);
481
  },
482
- p: fe,
483
  d(e) {
484
  e && b(t);
485
  }
486
  };
487
  }
488
- function Ht(n) {
489
  let t, e = (
490
  /*queue_position*/
491
  n[2] + 1 + ""
@@ -515,18 +524,18 @@ function Ht(n) {
515
  }
516
  };
517
  }
518
- function Xt(n) {
519
- let t, e = te(
520
  /*progress*/
521
  n[7]
522
  ), l = [];
523
  for (let i = 0; i < e.length; i += 1)
524
- l[i] = Te(Ve(n, e, i));
525
  return {
526
  c() {
527
  for (let i = 0; i < l.length; i += 1)
528
  l[i].c();
529
- t = R();
530
  },
531
  m(i, f) {
532
  for (let o = 0; o < l.length; o += 1)
@@ -536,13 +545,13 @@ function Xt(n) {
536
  p(i, f) {
537
  if (f[0] & /*progress*/
538
  128) {
539
- e = te(
540
  /*progress*/
541
  i[7]
542
  );
543
  let o;
544
  for (o = 0; o < e.length; o += 1) {
545
- const a = Ve(i, e, o);
546
  l[o] ? l[o].p(a, f) : (l[o] = Te(a), l[o].c(), l[o].m(t.parentNode, t));
547
  }
548
  for (; o < l.length; o += 1)
@@ -551,11 +560,11 @@ function Xt(n) {
551
  }
552
  },
553
  d(i) {
554
- i && b(t), Ke(l, i);
555
  }
556
  };
557
  }
558
- function Ne(n) {
559
  let t, e = (
560
  /*p*/
561
  n[38].unit + ""
@@ -563,7 +572,7 @@ function Ne(n) {
563
  function a(_, c) {
564
  return (
565
  /*p*/
566
- _[38].length != null ? Gt : Yt
567
  );
568
  }
569
  let r = a(n), s = r(n);
@@ -584,8 +593,8 @@ function Ne(n) {
584
  }
585
  };
586
  }
587
- function Yt(n) {
588
- let t = X(
589
  /*p*/
590
  n[38].index || 0
591
  ) + "", e;
@@ -598,7 +607,7 @@ function Yt(n) {
598
  },
599
  p(l, i) {
600
  i[0] & /*progress*/
601
- 128 && t !== (t = X(
602
  /*p*/
603
  l[38].index || 0
604
  ) + "") && S(e, t);
@@ -608,11 +617,11 @@ function Yt(n) {
608
  }
609
  };
610
  }
611
- function Gt(n) {
612
- let t = X(
613
  /*p*/
614
  n[38].index || 0
615
- ) + "", e, l, i = X(
616
  /*p*/
617
  n[38].length
618
  ) + "", f;
@@ -625,11 +634,11 @@ function Gt(n) {
625
  },
626
  p(o, a) {
627
  a[0] & /*progress*/
628
- 128 && t !== (t = X(
629
  /*p*/
630
  o[38].index || 0
631
  ) + "") && S(e, t), a[0] & /*progress*/
632
- 128 && i !== (i = X(
633
  /*p*/
634
  o[38].length
635
  ) + "") && S(f, i);
@@ -642,25 +651,25 @@ function Gt(n) {
642
  function Te(n) {
643
  let t, e = (
644
  /*p*/
645
- n[38].index != null && Ne(n)
646
  );
647
  return {
648
  c() {
649
- e && e.c(), t = R();
650
  },
651
  m(l, i) {
652
  e && e.m(l, i), g(l, t, i);
653
  },
654
  p(l, i) {
655
  /*p*/
656
- l[38].index != null ? e ? e.p(l, i) : (e = Ne(l), e.c(), e.m(t.parentNode, t)) : e && (e.d(1), e = null);
657
  },
658
  d(l) {
659
  l && b(t), e && e.d(l);
660
  }
661
  };
662
  }
663
- function ze(n) {
664
  let t, e = (
665
  /*eta*/
666
  n[0] ? `/${/*formatted_eta*/
@@ -692,19 +701,19 @@ function ze(n) {
692
  }
693
  };
694
  }
695
- function Ot(n) {
696
  let t, e;
697
- return t = new Ft({
698
  props: { margin: (
699
  /*variant*/
700
  n[8] === "default"
701
  ) }
702
  }), {
703
  c() {
704
- Ct(t.$$.fragment);
705
  },
706
  m(l, i) {
707
- zt(t, l, i), e = !0;
708
  },
709
  p(l, i) {
710
  const f = {};
@@ -713,54 +722,54 @@ function Ot(n) {
713
  l[8] === "default"), t.$set(f);
714
  },
715
  i(l) {
716
- e || (G(t.$$.fragment, l), e = !0);
717
  },
718
  o(l) {
719
- O(t.$$.fragment, l), e = !1;
720
  },
721
  d(l) {
722
- Vt(t, l);
723
  }
724
  };
725
  }
726
- function Rt(n) {
727
  let t, e, l, i, f, o = `${/*last_progress_level*/
728
  n[15] * 100}%`, a = (
729
  /*progress*/
730
- n[7] != null && je(n)
731
  );
732
  return {
733
  c() {
734
- t = P("div"), e = P("div"), a && a.c(), l = j(), i = P("div"), f = P("div"), z(e, "class", "progress-level-inner svelte-1txqlrd"), z(f, "class", "progress-bar svelte-1txqlrd"), A(f, "width", o), z(i, "class", "progress-bar-wrap svelte-1txqlrd"), z(t, "class", "progress-level svelte-1txqlrd");
735
  },
736
  m(r, s) {
737
- g(r, t, s), I(t, e), a && a.m(e, null), I(t, l), I(t, i), I(i, f), n[30](f);
738
  },
739
  p(r, s) {
740
  /*progress*/
741
- r[7] != null ? a ? a.p(r, s) : (a = je(r), a.c(), a.m(e, null)) : a && (a.d(1), a = null), s[0] & /*last_progress_level*/
742
  32768 && o !== (o = `${/*last_progress_level*/
743
- r[15] * 100}%`) && A(f, "width", o);
744
  },
745
- i: fe,
746
- o: fe,
747
  d(r) {
748
  r && b(t), a && a.d(), n[30](null);
749
  }
750
  };
751
  }
752
- function je(n) {
753
- let t, e = te(
754
  /*progress*/
755
  n[7]
756
  ), l = [];
757
  for (let i = 0; i < e.length; i += 1)
758
- l[i] = De(Me(n, e, i));
759
  return {
760
  c() {
761
  for (let i = 0; i < l.length; i += 1)
762
  l[i].c();
763
- t = R();
764
  },
765
  m(i, f) {
766
  for (let o = 0; o < l.length; o += 1)
@@ -770,14 +779,14 @@ function je(n) {
770
  p(i, f) {
771
  if (f[0] & /*progress_level, progress*/
772
  16512) {
773
- e = te(
774
  /*progress*/
775
  i[7]
776
  );
777
  let o;
778
  for (o = 0; o < e.length; o += 1) {
779
- const a = Me(i, e, o);
780
- l[o] ? l[o].p(a, f) : (l[o] = De(a), l[o].c(), l[o].m(t.parentNode, t));
781
  }
782
  for (; o < l.length; o += 1)
783
  l[o].d(1);
@@ -785,17 +794,17 @@ function je(n) {
785
  }
786
  },
787
  d(i) {
788
- i && b(t), Ke(l, i);
789
  }
790
  };
791
  }
792
- function Pe(n) {
793
  let t, e, l, i, f = (
794
  /*i*/
795
- n[40] !== 0 && Ut()
796
  ), o = (
797
  /*p*/
798
- n[38].desc != null && Ze(n)
799
  ), a = (
800
  /*p*/
801
  n[38].desc != null && /*progress_level*/
@@ -803,35 +812,35 @@ function Pe(n) {
803
  n[14][
804
  /*i*/
805
  n[40]
806
- ] != null && Be()
807
  ), r = (
808
  /*progress_level*/
809
- n[14] != null && Ae(n)
810
  );
811
  return {
812
  c() {
813
- f && f.c(), t = j(), o && o.c(), e = j(), a && a.c(), l = j(), r && r.c(), i = R();
814
  },
815
  m(s, _) {
816
  f && f.m(s, _), g(s, t, _), o && o.m(s, _), g(s, e, _), a && a.m(s, _), g(s, l, _), r && r.m(s, _), g(s, i, _);
817
  },
818
  p(s, _) {
819
  /*p*/
820
- s[38].desc != null ? o ? o.p(s, _) : (o = Ze(s), o.c(), o.m(e.parentNode, e)) : o && (o.d(1), o = null), /*p*/
821
  s[38].desc != null && /*progress_level*/
822
  s[14] && /*progress_level*/
823
  s[14][
824
  /*i*/
825
  s[40]
826
- ] != null ? a || (a = Be(), a.c(), a.m(l.parentNode, l)) : a && (a.d(1), a = null), /*progress_level*/
827
- s[14] != null ? r ? r.p(s, _) : (r = Ae(s), r.c(), r.m(i.parentNode, i)) : r && (r.d(1), r = null);
828
  },
829
  d(s) {
830
  s && (b(t), b(e), b(l), b(i)), f && f.d(s), o && o.d(s), a && a.d(s), r && r.d(s);
831
  }
832
  };
833
  }
834
- function Ut(n) {
835
  let t;
836
  return {
837
  c() {
@@ -845,7 +854,7 @@ function Ut(n) {
845
  }
846
  };
847
  }
848
- function Ze(n) {
849
  let t = (
850
  /*p*/
851
  n[38].desc + ""
@@ -867,7 +876,7 @@ function Ze(n) {
867
  }
868
  };
869
  }
870
- function Be(n) {
871
  let t;
872
  return {
873
  c() {
@@ -881,7 +890,7 @@ function Be(n) {
881
  }
882
  };
883
  }
884
- function Ae(n) {
885
  let t = (100 * /*progress_level*/
886
  (n[14][
887
  /*i*/
@@ -907,7 +916,7 @@ function Ae(n) {
907
  }
908
  };
909
  }
910
- function De(n) {
911
  let t, e = (
912
  /*p*/
913
  (n[38].desc != null || /*progress_level*/
@@ -915,11 +924,11 @@ function De(n) {
915
  n[14][
916
  /*i*/
917
  n[40]
918
- ] != null) && Pe(n)
919
  );
920
  return {
921
  c() {
922
- e && e.c(), t = R();
923
  },
924
  m(l, i) {
925
  e && e.m(l, i), g(l, t, i);
@@ -931,24 +940,24 @@ function De(n) {
931
  l[14][
932
  /*i*/
933
  l[40]
934
- ] != null ? e ? e.p(l, i) : (e = Pe(l), e.c(), e.m(t.parentNode, t)) : e && (e.d(1), e = null);
935
  },
936
  d(l) {
937
  l && b(t), e && e.d(l);
938
  }
939
  };
940
  }
941
- function Ee(n) {
942
  let t, e;
943
  return {
944
  c() {
945
  t = P("p"), e = q(
946
  /*loading_text*/
947
  n[9]
948
- ), z(t, "class", "loading svelte-1txqlrd");
949
  },
950
  m(l, i) {
951
- g(l, t, i), I(t, e);
952
  },
953
  p(l, i) {
954
  i[0] & /*loading_text*/
@@ -963,9 +972,9 @@ function Ee(n) {
963
  }
964
  };
965
  }
966
- function Jt(n) {
967
  let t, e, l, i, f;
968
- const o = [Et, Dt], a = [];
969
  function r(s, _) {
970
  return (
971
  /*status*/
@@ -977,7 +986,7 @@ function Jt(n) {
977
  }
978
  return ~(e = r(n)) && (l = a[e] = o[e](n)), {
979
  c() {
980
- t = P("div"), l && l.c(), z(t, "class", i = "wrap " + /*variant*/
981
  n[8] + " " + /*show_progress*/
982
  n[6] + " svelte-1txqlrd"), V(t, "hide", !/*status*/
983
  n[4] || /*status*/
@@ -1001,12 +1010,12 @@ function Jt(n) {
1001
  "border",
1002
  /*border*/
1003
  n[12]
1004
- ), A(
1005
  t,
1006
  "position",
1007
  /*absolute*/
1008
  n[10] ? "absolute" : "static"
1009
- ), A(
1010
  t,
1011
  "padding",
1012
  /*absolute*/
@@ -1018,12 +1027,12 @@ function Jt(n) {
1018
  },
1019
  p(s, _) {
1020
  let c = e;
1021
- e = r(s), e === c ? ~e && a[e].p(s, _) : (l && (Qe(), O(a[c], 1, 1, () => {
1022
  a[c] = null;
1023
- }), Je()), ~e ? (l = a[e], l ? l.p(s, _) : (l = a[e] = o[e](s), l.c()), G(l, 1), l.m(t, null)) : l = null), (!f || _[0] & /*variant, show_progress*/
1024
  320 && i !== (i = "wrap " + /*variant*/
1025
  s[8] + " " + /*show_progress*/
1026
- s[6] + " svelte-1txqlrd")) && z(t, "class", i), (!f || _[0] & /*variant, show_progress, status, show_progress*/
1027
  336) && V(t, "hide", !/*status*/
1028
  s[4] || /*status*/
1029
  s[4] === "complete" || /*show_progress*/
@@ -1050,13 +1059,13 @@ function Jt(n) {
1050
  /*border*/
1051
  s[12]
1052
  ), _[0] & /*absolute*/
1053
- 1024 && A(
1054
  t,
1055
  "position",
1056
  /*absolute*/
1057
  s[10] ? "absolute" : "static"
1058
  ), _[0] & /*absolute*/
1059
- 1024 && A(
1060
  t,
1061
  "padding",
1062
  /*absolute*/
@@ -1064,77 +1073,77 @@ function Jt(n) {
1064
  );
1065
  },
1066
  i(s) {
1067
- f || (G(l), f = !0);
1068
  },
1069
  o(s) {
1070
- O(l), f = !1;
1071
  },
1072
  d(s) {
1073
  s && b(t), ~e && a[e].d(), n[31](null);
1074
  }
1075
  };
1076
  }
1077
- let $ = [], ie = !1;
1078
- async function Kt(n, t = !0) {
1079
  if (!(window.__gradio_mode__ === "website" || window.__gradio_mode__ !== "app" && t !== !0)) {
1080
- if ($.push(n), !ie)
1081
- ie = !0;
1082
  else
1083
  return;
1084
- await Zt(), requestAnimationFrame(() => {
1085
  let e = [0, 0];
1086
- for (let l = 0; l < $.length; l++) {
1087
- const f = $[l].getBoundingClientRect();
1088
  (l === 0 || f.top + window.scrollY <= e[0]) && (e[0] = f.top + window.scrollY, e[1] = l);
1089
  }
1090
- window.scrollTo({ top: e[0] - 20, behavior: "smooth" }), ie = !1, $ = [];
1091
  });
1092
  }
1093
  }
1094
- function Qt(n, t, e) {
1095
- let l, { $$slots: i = {}, $$scope: f } = t, { i18n: o } = t, { eta: a = null } = t, { queue: r = !1 } = t, { queue_position: s } = t, { queue_size: _ } = t, { status: c } = t, { scroll_to_output: w = !1 } = t, { timer: h = !0 } = t, { show_progress: y = "full" } = t, { message: C = null } = t, { progress: p = null } = t, { variant: L = "default" } = t, { loading_text: F = "Loading..." } = t, { absolute: u = !0 } = t, { translucent: k = !1 } = t, { border: m = !1 } = t, { autoscroll: le } = t, U, J = !1, Q = 0, D = 0, ne = null, ce = 0, E = null, K, Z = null, de = !0;
1096
- const $e = () => {
1097
- e(25, Q = performance.now()), e(26, D = 0), J = !0, me();
1098
  };
1099
- function me() {
1100
  requestAnimationFrame(() => {
1101
- e(26, D = (performance.now() - Q) / 1e3), J && me();
1102
  });
1103
  }
1104
- function be() {
1105
- e(26, D = 0), J && (J = !1);
1106
  }
1107
- Bt(() => {
1108
- J && be();
1109
  });
1110
- let ge = null;
1111
- function et(d) {
1112
- Le[d ? "unshift" : "push"](() => {
1113
- Z = d, e(16, Z), e(7, p), e(14, E), e(15, K);
1114
  });
1115
  }
1116
- function tt(d) {
1117
- Le[d ? "unshift" : "push"](() => {
1118
- U = d, e(13, U);
1119
  });
1120
  }
1121
  return n.$$set = (d) => {
1122
- "i18n" in d && e(1, o = d.i18n), "eta" in d && e(0, a = d.eta), "queue" in d && e(21, r = d.queue), "queue_position" in d && e(2, s = d.queue_position), "queue_size" in d && e(3, _ = d.queue_size), "status" in d && e(4, c = d.status), "scroll_to_output" in d && e(22, w = d.scroll_to_output), "timer" in d && e(5, h = d.timer), "show_progress" in d && e(6, y = d.show_progress), "message" in d && e(23, C = d.message), "progress" in d && e(7, p = d.progress), "variant" in d && e(8, L = d.variant), "loading_text" in d && e(9, F = d.loading_text), "absolute" in d && e(10, u = d.absolute), "translucent" in d && e(11, k = d.translucent), "border" in d && e(12, m = d.border), "autoscroll" in d && e(24, le = d.autoscroll), "$$scope" in d && e(28, f = d.$$scope);
1123
  }, n.$$.update = () => {
1124
  n.$$.dirty[0] & /*eta, old_eta, queue, timer_start*/
1125
- 169869313 && (a === null ? e(0, a = ne) : r && e(0, a = (performance.now() - Q) / 1e3 + a), a != null && (e(19, ge = a.toFixed(1)), e(27, ne = a))), n.$$.dirty[0] & /*eta, timer_diff*/
1126
- 67108865 && e(17, ce = a === null || a <= 0 || !D ? null : Math.min(D / a, 1)), n.$$.dirty[0] & /*progress*/
1127
- 128 && p != null && e(18, de = !1), n.$$.dirty[0] & /*progress, progress_level, progress_bar, last_progress_level*/
1128
- 114816 && (p != null ? e(14, E = p.map((d) => {
1129
  if (d.index != null && d.length != null)
1130
  return d.index / d.length;
1131
  if (d.progress != null)
1132
  return d.progress;
1133
- })) : e(14, E = null), E ? (e(15, K = E[E.length - 1]), Z && (K === 0 ? e(16, Z.style.transition = "0", Z) : e(16, Z.style.transition = "150ms", Z))) : e(15, K = void 0)), n.$$.dirty[0] & /*status*/
1134
- 16 && (c === "pending" ? $e() : be()), n.$$.dirty[0] & /*el, scroll_to_output, status, autoscroll*/
1135
- 20979728 && U && w && (c === "pending" || c === "complete") && Kt(U, le), n.$$.dirty[0] & /*status, message*/
1136
  8388624, n.$$.dirty[0] & /*timer_diff*/
1137
- 67108864 && e(20, l = D.toFixed(1));
1138
  }, [
1139
  a,
1140
  o,
@@ -1142,42 +1151,42 @@ function Qt(n, t, e) {
1142
  _,
1143
  c,
1144
  h,
1145
- y,
1146
  p,
 
1147
  L,
1148
  F,
1149
  u,
1150
- k,
1151
  m,
1152
- U,
1153
- E,
1154
- K,
1155
  Z,
1156
- ce,
1157
  de,
1158
- ge,
 
1159
  l,
1160
  r,
1161
  w,
1162
  C,
1163
- le,
1164
- Q,
1165
- D,
1166
  ne,
 
 
 
1167
  f,
1168
  i,
1169
- et,
1170
- tt
1171
  ];
1172
  }
1173
- class Wt extends Lt {
1174
  constructor(t) {
1175
  super(), Tt(
1176
  this,
1177
  t,
1178
- Qt,
1179
- Jt,
1180
- jt,
1181
  {
1182
  i18n: 1,
1183
  eta: 0,
@@ -1203,30 +1212,30 @@ class Wt extends Lt {
1203
  }
1204
  }
1205
  const {
1206
- SvelteComponent: xt,
1207
- assign: $t,
1208
- create_slot: el,
1209
- detach: tl,
1210
- element: ll,
1211
- get_all_dirty_from_scope: nl,
1212
- get_slot_changes: il,
1213
- get_spread_update: sl,
1214
- init: fl,
1215
- insert: ol,
1216
- safe_not_equal: al,
1217
- set_dynamic_element_data: Ie,
1218
  set_style: M,
1219
- toggle_class: B,
1220
- transition_in: We,
1221
- transition_out: xe,
1222
- update_slot_base: rl
1223
  } = window.__gradio__svelte__internal;
1224
- function _l(n) {
1225
  let t, e, l;
1226
  const i = (
1227
  /*#slots*/
1228
  n[17].default
1229
- ), f = el(
1230
  i,
1231
  n,
1232
  /*$$scope*/
@@ -1248,31 +1257,31 @@ function _l(n) {
1248
  }
1249
  ], a = {};
1250
  for (let r = 0; r < o.length; r += 1)
1251
- a = $t(a, o[r]);
1252
  return {
1253
  c() {
1254
- t = ll(
1255
  /*tag*/
1256
  n[14]
1257
- ), f && f.c(), Ie(
1258
  /*tag*/
1259
  n[14]
1260
- )(t, a), B(
1261
  t,
1262
  "hidden",
1263
  /*visible*/
1264
  n[10] === !1
1265
- ), B(
1266
  t,
1267
  "padded",
1268
  /*padding*/
1269
  n[6]
1270
- ), B(
1271
  t,
1272
  "border_focus",
1273
  /*border_mode*/
1274
  n[5] === "focus"
1275
- ), B(t, "hide-container", !/*explicit_call*/
1276
  n[8] && !/*container*/
1277
  n[9]), M(t, "height", typeof /*height*/
1278
  n[0] == "number" ? (
@@ -1299,31 +1308,31 @@ function _l(n) {
1299
  n[13]}px, 100%))`), M(t, "border-width", "var(--block-border-width)");
1300
  },
1301
  m(r, s) {
1302
- ol(r, t, s), f && f.m(t, null), l = !0;
1303
  },
1304
  p(r, s) {
1305
  f && f.p && (!l || s & /*$$scope*/
1306
- 65536) && rl(
1307
  f,
1308
  i,
1309
  r,
1310
  /*$$scope*/
1311
  r[16],
1312
- l ? il(
1313
  i,
1314
  /*$$scope*/
1315
  r[16],
1316
  s,
1317
  null
1318
- ) : nl(
1319
  /*$$scope*/
1320
  r[16]
1321
  ),
1322
  null
1323
- ), Ie(
1324
  /*tag*/
1325
  r[14]
1326
- )(t, a = sl(o, [
1327
  (!l || s & /*test_id*/
1328
  128) && { "data-testid": (
1329
  /*test_id*/
@@ -1337,22 +1346,22 @@ function _l(n) {
1337
  (!l || s & /*elem_classes*/
1338
  8 && e !== (e = "block " + /*elem_classes*/
1339
  r[3].join(" ") + " svelte-1t38q2d")) && { class: e }
1340
- ])), B(
1341
  t,
1342
  "hidden",
1343
  /*visible*/
1344
  r[10] === !1
1345
- ), B(
1346
  t,
1347
  "padded",
1348
  /*padding*/
1349
  r[6]
1350
- ), B(
1351
  t,
1352
  "border_focus",
1353
  /*border_mode*/
1354
  r[5] === "focus"
1355
- ), B(t, "hide-container", !/*explicit_call*/
1356
  r[8] && !/*container*/
1357
  r[9]), s & /*height*/
1358
  1 && M(t, "height", typeof /*height*/
@@ -1385,20 +1394,20 @@ function _l(n) {
1385
  r[13]}px, 100%))`);
1386
  },
1387
  i(r) {
1388
- l || (We(f, r), l = !0);
1389
  },
1390
  o(r) {
1391
- xe(f, r), l = !1;
1392
  },
1393
  d(r) {
1394
- r && tl(t), f && f.d(r);
1395
  }
1396
  };
1397
  }
1398
- function ul(n) {
1399
  let t, e = (
1400
  /*tag*/
1401
- n[14] && _l(n)
1402
  );
1403
  return {
1404
  c() {
@@ -1412,20 +1421,20 @@ function ul(n) {
1412
  l[14] && e.p(l, i);
1413
  },
1414
  i(l) {
1415
- t || (We(e, l), t = !0);
1416
  },
1417
  o(l) {
1418
- xe(e, l), t = !1;
1419
  },
1420
  d(l) {
1421
  e && e.d(l);
1422
  }
1423
  };
1424
  }
1425
- function cl(n, t, e) {
1426
- let { $$slots: l = {}, $$scope: i } = t, { height: f = void 0 } = t, { width: o = void 0 } = t, { elem_id: a = "" } = t, { elem_classes: r = [] } = t, { variant: s = "solid" } = t, { border_mode: _ = "base" } = t, { padding: c = !0 } = t, { type: w = "normal" } = t, { test_id: h = void 0 } = t, { explicit_call: y = !1 } = t, { container: C = !0 } = t, { visible: p = !0 } = t, { allow_overflow: L = !0 } = t, { scale: F = null } = t, { min_width: u = 0 } = t, k = w === "fieldset" ? "fieldset" : "div";
1427
  return n.$$set = (m) => {
1428
- "height" in m && e(0, f = m.height), "width" in m && e(1, o = m.width), "elem_id" in m && e(2, a = m.elem_id), "elem_classes" in m && e(3, r = m.elem_classes), "variant" in m && e(4, s = m.variant), "border_mode" in m && e(5, _ = m.border_mode), "padding" in m && e(6, c = m.padding), "type" in m && e(15, w = m.type), "test_id" in m && e(7, h = m.test_id), "explicit_call" in m && e(8, y = m.explicit_call), "container" in m && e(9, C = m.container), "visible" in m && e(10, p = m.visible), "allow_overflow" in m && e(11, L = m.allow_overflow), "scale" in m && e(12, F = m.scale), "min_width" in m && e(13, u = m.min_width), "$$scope" in m && e(16, i = m.$$scope);
1429
  }, [
1430
  f,
1431
  o,
@@ -1435,21 +1444,21 @@ function cl(n, t, e) {
1435
  _,
1436
  c,
1437
  h,
1438
- y,
1439
- C,
1440
  p,
 
 
1441
  L,
1442
  F,
1443
  u,
1444
- k,
1445
  w,
1446
  i,
1447
  l
1448
  ];
1449
  }
1450
- class dl extends xt {
1451
  constructor(t) {
1452
- super(), fl(this, t, cl, ul, al, {
1453
  height: 0,
1454
  width: 1,
1455
  elem_id: 2,
@@ -1468,7 +1477,7 @@ class dl extends xt {
1468
  });
1469
  }
1470
  }
1471
- const ml = [
1472
  { color: "red", primary: 600, secondary: 100 },
1473
  { color: "green", primary: 600, secondary: 100 },
1474
  { color: "blue", primary: 600, secondary: 100 },
@@ -1479,7 +1488,7 @@ const ml = [
1479
  { color: "cyan", primary: 600, secondary: 100 },
1480
  { color: "lime", primary: 500, secondary: 100 },
1481
  { color: "pink", primary: 600, secondary: 100 }
1482
- ], He = {
1483
  inherit: "inherit",
1484
  current: "currentColor",
1485
  transparent: "transparent",
@@ -1772,36 +1781,36 @@ const ml = [
1772
  950: "#4c0519"
1773
  }
1774
  };
1775
- ml.reduce(
1776
  (n, { color: t, primary: e, secondary: l }) => ({
1777
  ...n,
1778
  [t]: {
1779
- primary: He[t][e],
1780
- secondary: He[t][l]
1781
  }
1782
  }),
1783
  {}
1784
  );
1785
  const {
1786
- SvelteComponent: bl,
1787
- assign: gl,
1788
- attr: hl,
1789
- create_component: oe,
1790
- destroy_component: ae,
1791
- detach: Xe,
1792
- element: wl,
1793
- get_spread_object: vl,
1794
  get_spread_update: yl,
1795
  init: kl,
1796
- insert: Ye,
1797
- mount_component: re,
1798
- safe_not_equal: pl,
1799
- space: ql,
1800
- toggle_class: Ge,
1801
- transition_in: _e,
1802
- transition_out: ue
1803
  } = window.__gradio__svelte__internal;
1804
- function Fl(n) {
1805
  var r;
1806
  let t, e, l, i, f;
1807
  const o = [
@@ -1819,8 +1828,8 @@ function Fl(n) {
1819
  ];
1820
  let a = {};
1821
  for (let s = 0; s < o.length; s += 1)
1822
- a = gl(a, o[s]);
1823
- return t = new Wt({ props: a }), i = new ut({
1824
  props: {
1825
  min_height: (
1826
  /*loading_status*/
@@ -1847,7 +1856,7 @@ function Fl(n) {
1847
  ), {
1848
  c() {
1849
  var s;
1850
- oe(t.$$.fragment), e = ql(), l = wl("div"), oe(i.$$.fragment), hl(l, "class", "svelte-gqsrr7"), Ge(
1851
  l,
1852
  "pending",
1853
  /*loading_status*/
@@ -1855,10 +1864,10 @@ function Fl(n) {
1855
  );
1856
  },
1857
  m(s, _) {
1858
- re(t, s, _), Ye(s, e, _), Ye(s, l, _), re(i, l, null), f = !0;
1859
  },
1860
  p(s, _) {
1861
- var h, y;
1862
  const c = _ & /*gradio, loading_status*/
1863
  48 ? yl(o, [
1864
  _ & /*gradio*/
@@ -1872,7 +1881,7 @@ function Fl(n) {
1872
  s[5].i18n
1873
  ) },
1874
  _ & /*loading_status*/
1875
- 16 && vl(
1876
  /*loading_status*/
1877
  s[4]
1878
  ),
@@ -1890,27 +1899,27 @@ function Fl(n) {
1890
  s[1]), _ & /*visible*/
1891
  4 && (w.visible = /*visible*/
1892
  s[2]), i.$set(w), (!f || _ & /*loading_status*/
1893
- 16) && Ge(
1894
  l,
1895
  "pending",
1896
  /*loading_status*/
1897
- ((y = s[4]) == null ? void 0 : y.status) === "pending"
1898
  );
1899
  },
1900
  i(s) {
1901
- f || (_e(t.$$.fragment, s), _e(i.$$.fragment, s), f = !0);
1902
  },
1903
  o(s) {
1904
- ue(t.$$.fragment, s), ue(i.$$.fragment, s), f = !1;
1905
  },
1906
  d(s) {
1907
- s && (Xe(e), Xe(l)), ae(t, s), ae(i);
1908
  }
1909
  };
1910
  }
1911
- function Ll(n) {
1912
  let t, e;
1913
- return t = new dl({
1914
  props: {
1915
  visible: (
1916
  /*visible*/
@@ -1925,15 +1934,15 @@ function Ll(n) {
1925
  n[1]
1926
  ),
1927
  container: !1,
1928
- $$slots: { default: [Fl] },
1929
  $$scope: { ctx: n }
1930
  }
1931
  }), {
1932
  c() {
1933
- oe(t.$$.fragment);
1934
  },
1935
  m(l, i) {
1936
- re(t, l, i), e = !0;
1937
  },
1938
  p(l, [i]) {
1939
  const f = {};
@@ -1947,17 +1956,17 @@ function Ll(n) {
1947
  318 && (f.$$scope = { dirty: i, ctx: l }), t.$set(f);
1948
  },
1949
  i(l) {
1950
- e || (_e(t.$$.fragment, l), e = !0);
1951
  },
1952
  o(l) {
1953
- ue(t.$$.fragment, l), e = !1;
1954
  },
1955
  d(l) {
1956
- ae(t, l);
1957
  }
1958
  };
1959
  }
1960
- function Cl(n, t, e) {
1961
  let { label: l } = t, { elem_id: i = "" } = t, { elem_classes: f = [] } = t, { visible: o = !0 } = t, { value: a = "" } = t, { loading_status: r } = t, { gradio: s } = t;
1962
  const _ = () => s.dispatch("change");
1963
  return n.$$set = (c) => {
@@ -1976,9 +1985,9 @@ function Cl(n, t, e) {
1976
  _
1977
  ];
1978
  }
1979
- class Ml extends bl {
1980
  constructor(t) {
1981
- super(), kl(this, t, Cl, Ll, pl, {
1982
  label: 6,
1983
  elem_id: 0,
1984
  elem_classes: 1,
@@ -1990,5 +1999,5 @@ class Ml extends bl {
1990
  }
1991
  }
1992
  export {
1993
- Ml as default
1994
  };
 
1
  const {
2
+ SvelteComponent: nt,
3
+ append: it,
4
+ attr: B,
5
+ detach: st,
6
+ element: we,
7
+ init: ft,
8
+ insert: ot,
9
+ noop: ve,
10
+ safe_not_equal: at,
11
+ toggle_class: x
12
+ } = window.__gradio__svelte__internal, { createEventDispatcher: rt } = window.__gradio__svelte__internal;
13
+ function _t(n) {
14
+ let t, e, l;
15
  return {
16
  c() {
17
+ t = we("div"), e = we("iframe"), B(e, "title", "iframe component"), B(e, "width", "100%"), B(e, "height", "100%"), B(
18
+ e,
19
+ "srcdoc",
20
+ /*value*/
21
+ n[1]
22
+ ), B(e, "allow", ""), B(t, "class", l = "prose " + /*elem_classes*/
23
+ n[0].join(" ") + " svelte-2qygph"), x(
24
  t,
25
  "min",
26
  /*min_height*/
27
  n[3]
28
+ ), x(t, "hide", !/*visible*/
29
  n[2]);
30
  },
31
+ m(i, f) {
32
+ ot(i, t, f), it(t, e);
 
33
  },
34
+ p(i, [f]) {
35
+ f & /*value*/
36
+ 2 && B(
37
+ e,
38
+ "srcdoc",
39
+ /*value*/
40
+ i[1]
41
+ ), f & /*elem_classes*/
42
+ 1 && l !== (l = "prose " + /*elem_classes*/
43
+ i[0].join(" ") + " svelte-2qygph") && B(t, "class", l), f & /*elem_classes, min_height*/
44
+ 9 && x(
45
  t,
46
  "min",
47
  /*min_height*/
48
+ i[3]
49
+ ), f & /*elem_classes, visible*/
50
+ 5 && x(t, "hide", !/*visible*/
51
+ i[2]);
52
  },
53
+ i: ve,
54
+ o: ve,
55
+ d(i) {
56
+ i && st(t);
57
  }
58
  };
59
  }
60
+ function ut(n, t, e) {
61
  let { elem_classes: l = [] } = t, { value: i } = t, { visible: f = !0 } = t, { min_height: o = !1 } = t;
62
+ const a = rt();
63
  return n.$$set = (r) => {
64
  "elem_classes" in r && e(0, l = r.elem_classes), "value" in r && e(1, i = r.value), "visible" in r && e(2, f = r.visible), "min_height" in r && e(3, o = r.min_height);
65
  }, n.$$.update = () => {
 
67
  2 && a("change");
68
  }, [l, i, f, o];
69
  }
70
+ class ct extends nt {
71
  constructor(t) {
72
+ super(), ft(this, t, ut, _t, at, {
73
  elem_classes: 0,
74
  value: 1,
75
  visible: 2,
 
77
  });
78
  }
79
  }
80
+ function Y(n) {
81
  let t = ["", "k", "M", "G", "T", "P", "E", "Z"], e = 0;
82
  for (; n > 1e3 && e < t.length - 1; )
83
  n /= 1e3, e++;
84
  let l = t[e];
85
  return (Number.isInteger(n) ? n : n.toFixed(1)) + l;
86
  }
87
+ function te() {
88
  }
89
+ function dt(n, t) {
90
  return n != n ? t == t : n !== t || n && typeof n == "object" || typeof n == "function";
91
  }
92
+ const Re = typeof window < "u";
93
+ let pe = Re ? () => window.performance.now() : () => Date.now(), Ue = Re ? (n) => requestAnimationFrame(n) : te;
94
+ const G = /* @__PURE__ */ new Set();
95
+ function Je(n) {
96
+ G.forEach((t) => {
97
+ t.c(n) || (G.delete(t), t.f());
98
+ }), G.size !== 0 && Ue(Je);
99
  }
100
+ function mt(n) {
101
  let t;
102
+ return G.size === 0 && Ue(Je), {
103
  promise: new Promise((e) => {
104
+ G.add(t = { c: n, f: e });
105
  }),
106
  abort() {
107
+ G.delete(t);
108
  }
109
  };
110
  }
111
+ const X = [];
112
+ function bt(n, t = te) {
113
  let e;
114
  const l = /* @__PURE__ */ new Set();
115
  function i(a) {
116
+ if (dt(n, a) && (n = a, e)) {
117
+ const r = !X.length;
118
  for (const s of l)
119
+ s[1](), X.push(s, n);
120
  if (r) {
121
+ for (let s = 0; s < X.length; s += 2)
122
+ X[s][0](X[s + 1]);
123
+ X.length = 0;
124
  }
125
  }
126
  }
127
  function f(a) {
128
  i(a(n));
129
  }
130
+ function o(a, r = te) {
131
  const s = [a, r];
132
+ return l.add(s), l.size === 1 && (e = t(i, f) || te), a(n), () => {
133
  l.delete(s), l.size === 0 && e && (e(), e = null);
134
  };
135
  }
 
138
  function ye(n) {
139
  return Object.prototype.toString.call(n) === "[object Date]";
140
  }
141
+ function fe(n, t, e, l) {
142
  if (typeof e == "number" || ye(e)) {
143
  const i = l - e, f = (e - t) / (n.dt || 1 / 60), o = n.opts.stiffness * i, a = n.opts.damping * f, r = (o - a) * n.inv_mass, s = (f + r) * n.dt;
144
  return Math.abs(s) < n.opts.precision && Math.abs(i) < n.opts.precision ? l : (n.settled = !1, ye(e) ? new Date(e.getTime() + s) : e + s);
145
  } else {
146
  if (Array.isArray(e))
147
  return e.map(
148
+ (i, f) => fe(n, t[f], e[f], l[f])
149
  );
150
  if (typeof e == "object") {
151
  const i = {};
152
  for (const f in e)
153
+ i[f] = fe(n, t[f], e[f], l[f]);
154
  return i;
155
  } else
156
  throw new Error(`Cannot spring ${typeof e} values`);
157
  }
158
  }
159
  function ke(n, t = {}) {
160
+ const e = bt(n), { stiffness: l = 0.15, damping: i = 0.8, precision: f = 0.01 } = t;
161
  let o, a, r, s = n, _ = n, c = 1, w = 0, h = !1;
162
+ function p(k, L = {}) {
163
+ _ = k;
164
  const F = r = {};
165
+ return n == null || L.hard || C.stiffness >= 1 && C.damping >= 1 ? (h = !0, o = pe(), s = k, e.set(n = _), Promise.resolve()) : (L.soft && (w = 1 / ((L.soft === !0 ? 0.5 : +L.soft) * 60), c = 0), a || (o = pe(), h = !1, a = mt((u) => {
166
  if (h)
167
  return h = !1, a = null, !1;
168
  c = Math.min(c + w, 1);
169
+ const y = {
170
  inv_mass: c,
171
  opts: C,
172
  settled: !0,
173
  dt: (u - o) * 60 / 1e3
174
+ }, m = fe(y, s, n, _);
175
+ return o = u, s = n, e.set(n = m), y.settled && (a = null), !y.settled;
176
  })), new Promise((u) => {
177
  a.promise.then(() => {
178
  F === r && u();
 
180
  }));
181
  }
182
  const C = {
183
+ set: p,
184
+ update: (k, L) => p(k(_, n), L),
185
  subscribe: e.subscribe,
186
  stiffness: l,
187
  damping: i,
 
190
  return C;
191
  }
192
  const {
193
+ SvelteComponent: gt,
194
  append: N,
195
  attr: v,
196
+ component_subscribe: qe,
197
+ detach: ht,
198
+ element: wt,
199
+ init: vt,
200
+ insert: pt,
201
+ noop: Fe,
202
  safe_not_equal: yt,
203
+ set_style: $,
204
+ svg_element: z,
205
+ toggle_class: Le
206
  } = window.__gradio__svelte__internal, { onMount: kt } = window.__gradio__svelte__internal;
207
+ function qt(n) {
208
  let t, e, l, i, f, o, a, r, s, _, c, w;
209
  return {
210
  c() {
211
+ t = wt("div"), e = z("svg"), l = z("g"), i = z("path"), f = z("path"), o = z("path"), a = z("path"), r = z("g"), s = z("path"), _ = z("path"), c = z("path"), w = z("path"), v(i, "d", "M255.926 0.754768L509.702 139.936V221.027L255.926 81.8465V0.754768Z"), v(i, "fill", "#FF7C00"), v(i, "fill-opacity", "0.4"), v(i, "class", "svelte-43sxxs"), v(f, "d", "M509.69 139.936L254.981 279.641V361.255L509.69 221.55V139.936Z"), v(f, "fill", "#FF7C00"), v(f, "class", "svelte-43sxxs"), v(o, "d", "M0.250138 139.937L254.981 279.641V361.255L0.250138 221.55V139.937Z"), v(o, "fill", "#FF7C00"), v(o, "fill-opacity", "0.4"), v(o, "class", "svelte-43sxxs"), v(a, "d", "M255.923 0.232622L0.236328 139.936V221.55L255.923 81.8469V0.232622Z"), v(a, "fill", "#FF7C00"), v(a, "class", "svelte-43sxxs"), $(l, "transform", "translate(" + /*$top*/
212
  n[1][0] + "px, " + /*$top*/
213
+ n[1][1] + "px)"), v(s, "d", "M255.926 141.5L509.702 280.681V361.773L255.926 222.592V141.5Z"), v(s, "fill", "#FF7C00"), v(s, "fill-opacity", "0.4"), v(s, "class", "svelte-43sxxs"), v(_, "d", "M509.69 280.679L254.981 420.384V501.998L509.69 362.293V280.679Z"), v(_, "fill", "#FF7C00"), v(_, "class", "svelte-43sxxs"), v(c, "d", "M0.250138 280.681L254.981 420.386V502L0.250138 362.295V280.681Z"), v(c, "fill", "#FF7C00"), v(c, "fill-opacity", "0.4"), v(c, "class", "svelte-43sxxs"), v(w, "d", "M255.923 140.977L0.236328 280.68V362.294L255.923 222.591V140.977Z"), v(w, "fill", "#FF7C00"), v(w, "class", "svelte-43sxxs"), $(r, "transform", "translate(" + /*$bottom*/
214
  n[2][0] + "px, " + /*$bottom*/
215
+ n[2][1] + "px)"), v(e, "viewBox", "-1200 -1200 3000 3000"), v(e, "fill", "none"), v(e, "xmlns", "http://www.w3.org/2000/svg"), v(e, "class", "svelte-43sxxs"), v(t, "class", "svelte-43sxxs"), Le(
216
  t,
217
  "margin",
218
  /*margin*/
219
  n[0]
220
  );
221
  },
222
+ m(h, p) {
223
+ pt(h, t, p), N(t, e), N(e, l), N(l, i), N(l, f), N(l, o), N(l, a), N(e, r), N(r, s), N(r, _), N(r, c), N(r, w);
224
  },
225
+ p(h, [p]) {
226
+ p & /*$top*/
227
+ 2 && $(l, "transform", "translate(" + /*$top*/
228
  h[1][0] + "px, " + /*$top*/
229
+ h[1][1] + "px)"), p & /*$bottom*/
230
+ 4 && $(r, "transform", "translate(" + /*$bottom*/
231
  h[2][0] + "px, " + /*$bottom*/
232
+ h[2][1] + "px)"), p & /*margin*/
233
+ 1 && Le(
234
  t,
235
  "margin",
236
  /*margin*/
237
  h[0]
238
  );
239
  },
240
+ i: Fe,
241
+ o: Fe,
242
  d(h) {
243
+ h && ht(t);
244
  }
245
  };
246
  }
247
+ function Ft(n, t, e) {
248
  let l, i, { margin: f = !0 } = t;
249
  const o = ke([0, 0]);
250
+ qe(n, o, (w) => e(1, l = w));
251
  const a = ke([0, 0]);
252
+ qe(n, a, (w) => e(2, i = w));
253
  let r;
254
  async function s() {
255
  await Promise.all([o.set([125, 140]), a.set([-125, -140])]), await Promise.all([o.set([-125, 140]), a.set([125, -140])]), await Promise.all([o.set([-125, 0]), a.set([125, -0])]), await Promise.all([o.set([125, 0]), a.set([-125, 0])]);
 
264
  "margin" in w && e(0, f = w.margin);
265
  }, [f, l, i, o, a];
266
  }
267
+ class Lt extends gt {
268
  constructor(t) {
269
+ super(), vt(this, t, Ft, qt, yt, { margin: 0 });
270
  }
271
  }
272
  const {
273
+ SvelteComponent: Ct,
274
+ append: H,
275
+ attr: T,
276
+ binding_callbacks: Ce,
277
+ check_outros: Ke,
278
+ create_component: Mt,
279
+ create_slot: Vt,
280
+ destroy_component: St,
281
+ destroy_each: Qe,
282
  detach: b,
283
  element: P,
284
+ empty: U,
285
+ ensure_array_like: le,
286
+ get_all_dirty_from_scope: Nt,
287
+ get_slot_changes: zt,
288
+ group_outros: We,
289
  init: Tt,
290
  insert: g,
291
+ mount_component: jt,
292
+ noop: oe,
293
+ safe_not_equal: Pt,
294
  set_data: S,
295
+ set_style: D,
296
  space: j,
297
  text: q,
298
  toggle_class: V,
299
+ transition_in: O,
300
+ transition_out: R,
301
+ update_slot_base: Zt
302
+ } = window.__gradio__svelte__internal, { tick: Bt } = window.__gradio__svelte__internal, { onDestroy: At } = window.__gradio__svelte__internal, Dt = (n) => ({}), Me = (n) => ({});
303
+ function Ve(n, t, e) {
304
  const l = n.slice();
305
  return l[38] = t[e], l[40] = e, l;
306
  }
307
+ function Se(n, t, e) {
308
  const l = n.slice();
309
  return l[38] = t[e], l;
310
  }
311
+ function Et(n) {
312
  let t, e = (
313
  /*i18n*/
314
  n[1]("common.error") + ""
 
316
  const o = (
317
  /*#slots*/
318
  n[29].error
319
+ ), a = Vt(
320
  o,
321
  n,
322
  /*$$scope*/
323
  n[28],
324
+ Me
325
  );
326
  return {
327
  c() {
328
+ t = P("span"), l = q(e), i = j(), a && a.c(), T(t, "class", "error svelte-1txqlrd");
329
  },
330
  m(r, s) {
331
+ g(r, t, s), H(t, l), g(r, i, s), a && a.m(r, s), f = !0;
332
  },
333
  p(r, s) {
334
  (!f || s[0] & /*i18n*/
335
  2) && e !== (e = /*i18n*/
336
  r[1]("common.error") + "") && S(l, e), a && a.p && (!f || s[0] & /*$$scope*/
337
+ 268435456) && Zt(
338
  a,
339
  o,
340
  r,
341
  /*$$scope*/
342
  r[28],
343
+ f ? zt(
344
  o,
345
  /*$$scope*/
346
  r[28],
347
  s,
348
+ Dt
349
+ ) : Nt(
350
  /*$$scope*/
351
  r[28]
352
  ),
353
+ Me
354
  );
355
  },
356
  i(r) {
357
+ f || (O(a, r), f = !0);
358
  },
359
  o(r) {
360
+ R(a, r), f = !1;
361
  },
362
  d(r) {
363
  r && (b(t), b(i)), a && a.d(r);
364
  }
365
  };
366
  }
367
+ function It(n) {
368
  let t, e, l, i, f, o, a, r, s, _ = (
369
  /*variant*/
370
  n[8] === "default" && /*show_eta_bar*/
371
  n[18] && /*show_progress*/
372
+ n[6] === "full" && Ne(n)
373
  );
374
+ function c(u, y) {
375
  if (
376
  /*progress*/
377
  u[7]
378
  )
379
+ return Yt;
380
  if (
381
  /*queue_position*/
382
  u[2] !== null && /*queue_size*/
383
  u[3] !== void 0 && /*queue_position*/
384
  u[2] >= 0
385
  )
386
+ return Xt;
387
  if (
388
  /*queue_position*/
389
  u[2] === 0
390
  )
391
+ return Ht;
392
  }
393
+ let w = c(n), h = w && w(n), p = (
394
  /*timer*/
395
+ n[5] && je(n)
396
  );
397
+ const C = [Ut, Rt], k = [];
398
+ function L(u, y) {
399
  return (
400
  /*last_progress_level*/
401
  u[15] != null ? 0 : (
 
404
  )
405
  );
406
  }
407
+ ~(f = L(n)) && (o = k[f] = C[f](n));
408
  let F = !/*timer*/
409
+ n[5] && Ie(n);
410
  return {
411
  c() {
412
+ _ && _.c(), t = j(), e = P("div"), h && h.c(), l = j(), p && p.c(), i = j(), o && o.c(), a = j(), F && F.c(), r = U(), T(e, "class", "progress-text svelte-1txqlrd"), V(
413
  e,
414
  "meta-text-center",
415
  /*variant*/
 
421
  n[8] === "default"
422
  );
423
  },
424
+ m(u, y) {
425
+ _ && _.m(u, y), g(u, t, y), g(u, e, y), h && h.m(e, null), H(e, l), p && p.m(e, null), g(u, i, y), ~f && k[f].m(u, y), g(u, a, y), F && F.m(u, y), g(u, r, y), s = !0;
426
  },
427
+ p(u, y) {
428
  /*variant*/
429
  u[8] === "default" && /*show_eta_bar*/
430
  u[18] && /*show_progress*/
431
+ u[6] === "full" ? _ ? _.p(u, y) : (_ = Ne(u), _.c(), _.m(t.parentNode, t)) : _ && (_.d(1), _ = null), w === (w = c(u)) && h ? h.p(u, y) : (h && h.d(1), h = w && w(u), h && (h.c(), h.m(e, l))), /*timer*/
432
+ u[5] ? p ? p.p(u, y) : (p = je(u), p.c(), p.m(e, null)) : p && (p.d(1), p = null), (!s || y[0] & /*variant*/
433
  256) && V(
434
  e,
435
  "meta-text-center",
436
  /*variant*/
437
  u[8] === "center"
438
+ ), (!s || y[0] & /*variant*/
439
  256) && V(
440
  e,
441
  "meta-text",
 
443
  u[8] === "default"
444
  );
445
  let m = f;
446
+ f = L(u), f === m ? ~f && k[f].p(u, y) : (o && (We(), R(k[m], 1, 1, () => {
447
+ k[m] = null;
448
+ }), Ke()), ~f ? (o = k[f], o ? o.p(u, y) : (o = k[f] = C[f](u), o.c()), O(o, 1), o.m(a.parentNode, a)) : o = null), /*timer*/
449
+ u[5] ? F && (F.d(1), F = null) : F ? F.p(u, y) : (F = Ie(u), F.c(), F.m(r.parentNode, r));
450
  },
451
  i(u) {
452
+ s || (O(o), s = !0);
453
  },
454
  o(u) {
455
+ R(o), s = !1;
456
  },
457
  d(u) {
458
+ u && (b(t), b(e), b(i), b(a), b(r)), _ && _.d(u), h && h.d(), p && p.d(), ~f && k[f].d(u), F && F.d(u);
459
  }
460
  };
461
  }
462
+ function Ne(n) {
463
  let t, e = `translateX(${/*eta_level*/
464
  (n[17] || 0) * 100 - 100}%)`;
465
  return {
466
  c() {
467
+ t = P("div"), T(t, "class", "eta-bar svelte-1txqlrd"), D(t, "transform", e);
468
  },
469
  m(l, i) {
470
  g(l, t, i);
 
472
  p(l, i) {
473
  i[0] & /*eta_level*/
474
  131072 && e !== (e = `translateX(${/*eta_level*/
475
+ (l[17] || 0) * 100 - 100}%)`) && D(t, "transform", e);
476
  },
477
  d(l) {
478
  l && b(t);
479
  }
480
  };
481
  }
482
+ function Ht(n) {
483
  let t;
484
  return {
485
  c() {
 
488
  m(e, l) {
489
  g(e, t, l);
490
  },
491
+ p: oe,
492
  d(e) {
493
  e && b(t);
494
  }
495
  };
496
  }
497
+ function Xt(n) {
498
  let t, e = (
499
  /*queue_position*/
500
  n[2] + 1 + ""
 
524
  }
525
  };
526
  }
527
+ function Yt(n) {
528
+ let t, e = le(
529
  /*progress*/
530
  n[7]
531
  ), l = [];
532
  for (let i = 0; i < e.length; i += 1)
533
+ l[i] = Te(Se(n, e, i));
534
  return {
535
  c() {
536
  for (let i = 0; i < l.length; i += 1)
537
  l[i].c();
538
+ t = U();
539
  },
540
  m(i, f) {
541
  for (let o = 0; o < l.length; o += 1)
 
545
  p(i, f) {
546
  if (f[0] & /*progress*/
547
  128) {
548
+ e = le(
549
  /*progress*/
550
  i[7]
551
  );
552
  let o;
553
  for (o = 0; o < e.length; o += 1) {
554
+ const a = Se(i, e, o);
555
  l[o] ? l[o].p(a, f) : (l[o] = Te(a), l[o].c(), l[o].m(t.parentNode, t));
556
  }
557
  for (; o < l.length; o += 1)
 
560
  }
561
  },
562
  d(i) {
563
+ i && b(t), Qe(l, i);
564
  }
565
  };
566
  }
567
+ function ze(n) {
568
  let t, e = (
569
  /*p*/
570
  n[38].unit + ""
 
572
  function a(_, c) {
573
  return (
574
  /*p*/
575
+ _[38].length != null ? Ot : Gt
576
  );
577
  }
578
  let r = a(n), s = r(n);
 
593
  }
594
  };
595
  }
596
+ function Gt(n) {
597
+ let t = Y(
598
  /*p*/
599
  n[38].index || 0
600
  ) + "", e;
 
607
  },
608
  p(l, i) {
609
  i[0] & /*progress*/
610
+ 128 && t !== (t = Y(
611
  /*p*/
612
  l[38].index || 0
613
  ) + "") && S(e, t);
 
617
  }
618
  };
619
  }
620
+ function Ot(n) {
621
+ let t = Y(
622
  /*p*/
623
  n[38].index || 0
624
+ ) + "", e, l, i = Y(
625
  /*p*/
626
  n[38].length
627
  ) + "", f;
 
634
  },
635
  p(o, a) {
636
  a[0] & /*progress*/
637
+ 128 && t !== (t = Y(
638
  /*p*/
639
  o[38].index || 0
640
  ) + "") && S(e, t), a[0] & /*progress*/
641
+ 128 && i !== (i = Y(
642
  /*p*/
643
  o[38].length
644
  ) + "") && S(f, i);
 
651
  function Te(n) {
652
  let t, e = (
653
  /*p*/
654
+ n[38].index != null && ze(n)
655
  );
656
  return {
657
  c() {
658
+ e && e.c(), t = U();
659
  },
660
  m(l, i) {
661
  e && e.m(l, i), g(l, t, i);
662
  },
663
  p(l, i) {
664
  /*p*/
665
+ l[38].index != null ? e ? e.p(l, i) : (e = ze(l), e.c(), e.m(t.parentNode, t)) : e && (e.d(1), e = null);
666
  },
667
  d(l) {
668
  l && b(t), e && e.d(l);
669
  }
670
  };
671
  }
672
+ function je(n) {
673
  let t, e = (
674
  /*eta*/
675
  n[0] ? `/${/*formatted_eta*/
 
701
  }
702
  };
703
  }
704
+ function Rt(n) {
705
  let t, e;
706
+ return t = new Lt({
707
  props: { margin: (
708
  /*variant*/
709
  n[8] === "default"
710
  ) }
711
  }), {
712
  c() {
713
+ Mt(t.$$.fragment);
714
  },
715
  m(l, i) {
716
+ jt(t, l, i), e = !0;
717
  },
718
  p(l, i) {
719
  const f = {};
 
722
  l[8] === "default"), t.$set(f);
723
  },
724
  i(l) {
725
+ e || (O(t.$$.fragment, l), e = !0);
726
  },
727
  o(l) {
728
+ R(t.$$.fragment, l), e = !1;
729
  },
730
  d(l) {
731
+ St(t, l);
732
  }
733
  };
734
  }
735
+ function Ut(n) {
736
  let t, e, l, i, f, o = `${/*last_progress_level*/
737
  n[15] * 100}%`, a = (
738
  /*progress*/
739
+ n[7] != null && Pe(n)
740
  );
741
  return {
742
  c() {
743
+ t = P("div"), e = P("div"), a && a.c(), l = j(), i = P("div"), f = P("div"), T(e, "class", "progress-level-inner svelte-1txqlrd"), T(f, "class", "progress-bar svelte-1txqlrd"), D(f, "width", o), T(i, "class", "progress-bar-wrap svelte-1txqlrd"), T(t, "class", "progress-level svelte-1txqlrd");
744
  },
745
  m(r, s) {
746
+ g(r, t, s), H(t, e), a && a.m(e, null), H(t, l), H(t, i), H(i, f), n[30](f);
747
  },
748
  p(r, s) {
749
  /*progress*/
750
+ r[7] != null ? a ? a.p(r, s) : (a = Pe(r), a.c(), a.m(e, null)) : a && (a.d(1), a = null), s[0] & /*last_progress_level*/
751
  32768 && o !== (o = `${/*last_progress_level*/
752
+ r[15] * 100}%`) && D(f, "width", o);
753
  },
754
+ i: oe,
755
+ o: oe,
756
  d(r) {
757
  r && b(t), a && a.d(), n[30](null);
758
  }
759
  };
760
  }
761
+ function Pe(n) {
762
+ let t, e = le(
763
  /*progress*/
764
  n[7]
765
  ), l = [];
766
  for (let i = 0; i < e.length; i += 1)
767
+ l[i] = Ee(Ve(n, e, i));
768
  return {
769
  c() {
770
  for (let i = 0; i < l.length; i += 1)
771
  l[i].c();
772
+ t = U();
773
  },
774
  m(i, f) {
775
  for (let o = 0; o < l.length; o += 1)
 
779
  p(i, f) {
780
  if (f[0] & /*progress_level, progress*/
781
  16512) {
782
+ e = le(
783
  /*progress*/
784
  i[7]
785
  );
786
  let o;
787
  for (o = 0; o < e.length; o += 1) {
788
+ const a = Ve(i, e, o);
789
+ l[o] ? l[o].p(a, f) : (l[o] = Ee(a), l[o].c(), l[o].m(t.parentNode, t));
790
  }
791
  for (; o < l.length; o += 1)
792
  l[o].d(1);
 
794
  }
795
  },
796
  d(i) {
797
+ i && b(t), Qe(l, i);
798
  }
799
  };
800
  }
801
+ function Ze(n) {
802
  let t, e, l, i, f = (
803
  /*i*/
804
+ n[40] !== 0 && Jt()
805
  ), o = (
806
  /*p*/
807
+ n[38].desc != null && Be(n)
808
  ), a = (
809
  /*p*/
810
  n[38].desc != null && /*progress_level*/
 
812
  n[14][
813
  /*i*/
814
  n[40]
815
+ ] != null && Ae()
816
  ), r = (
817
  /*progress_level*/
818
+ n[14] != null && De(n)
819
  );
820
  return {
821
  c() {
822
+ f && f.c(), t = j(), o && o.c(), e = j(), a && a.c(), l = j(), r && r.c(), i = U();
823
  },
824
  m(s, _) {
825
  f && f.m(s, _), g(s, t, _), o && o.m(s, _), g(s, e, _), a && a.m(s, _), g(s, l, _), r && r.m(s, _), g(s, i, _);
826
  },
827
  p(s, _) {
828
  /*p*/
829
+ s[38].desc != null ? o ? o.p(s, _) : (o = Be(s), o.c(), o.m(e.parentNode, e)) : o && (o.d(1), o = null), /*p*/
830
  s[38].desc != null && /*progress_level*/
831
  s[14] && /*progress_level*/
832
  s[14][
833
  /*i*/
834
  s[40]
835
+ ] != null ? a || (a = Ae(), a.c(), a.m(l.parentNode, l)) : a && (a.d(1), a = null), /*progress_level*/
836
+ s[14] != null ? r ? r.p(s, _) : (r = De(s), r.c(), r.m(i.parentNode, i)) : r && (r.d(1), r = null);
837
  },
838
  d(s) {
839
  s && (b(t), b(e), b(l), b(i)), f && f.d(s), o && o.d(s), a && a.d(s), r && r.d(s);
840
  }
841
  };
842
  }
843
+ function Jt(n) {
844
  let t;
845
  return {
846
  c() {
 
854
  }
855
  };
856
  }
857
+ function Be(n) {
858
  let t = (
859
  /*p*/
860
  n[38].desc + ""
 
876
  }
877
  };
878
  }
879
+ function Ae(n) {
880
  let t;
881
  return {
882
  c() {
 
890
  }
891
  };
892
  }
893
+ function De(n) {
894
  let t = (100 * /*progress_level*/
895
  (n[14][
896
  /*i*/
 
916
  }
917
  };
918
  }
919
+ function Ee(n) {
920
  let t, e = (
921
  /*p*/
922
  (n[38].desc != null || /*progress_level*/
 
924
  n[14][
925
  /*i*/
926
  n[40]
927
+ ] != null) && Ze(n)
928
  );
929
  return {
930
  c() {
931
+ e && e.c(), t = U();
932
  },
933
  m(l, i) {
934
  e && e.m(l, i), g(l, t, i);
 
940
  l[14][
941
  /*i*/
942
  l[40]
943
+ ] != null ? e ? e.p(l, i) : (e = Ze(l), e.c(), e.m(t.parentNode, t)) : e && (e.d(1), e = null);
944
  },
945
  d(l) {
946
  l && b(t), e && e.d(l);
947
  }
948
  };
949
  }
950
+ function Ie(n) {
951
  let t, e;
952
  return {
953
  c() {
954
  t = P("p"), e = q(
955
  /*loading_text*/
956
  n[9]
957
+ ), T(t, "class", "loading svelte-1txqlrd");
958
  },
959
  m(l, i) {
960
+ g(l, t, i), H(t, e);
961
  },
962
  p(l, i) {
963
  i[0] & /*loading_text*/
 
972
  }
973
  };
974
  }
975
+ function Kt(n) {
976
  let t, e, l, i, f;
977
+ const o = [It, Et], a = [];
978
  function r(s, _) {
979
  return (
980
  /*status*/
 
986
  }
987
  return ~(e = r(n)) && (l = a[e] = o[e](n)), {
988
  c() {
989
+ t = P("div"), l && l.c(), T(t, "class", i = "wrap " + /*variant*/
990
  n[8] + " " + /*show_progress*/
991
  n[6] + " svelte-1txqlrd"), V(t, "hide", !/*status*/
992
  n[4] || /*status*/
 
1010
  "border",
1011
  /*border*/
1012
  n[12]
1013
+ ), D(
1014
  t,
1015
  "position",
1016
  /*absolute*/
1017
  n[10] ? "absolute" : "static"
1018
+ ), D(
1019
  t,
1020
  "padding",
1021
  /*absolute*/
 
1027
  },
1028
  p(s, _) {
1029
  let c = e;
1030
+ e = r(s), e === c ? ~e && a[e].p(s, _) : (l && (We(), R(a[c], 1, 1, () => {
1031
  a[c] = null;
1032
+ }), Ke()), ~e ? (l = a[e], l ? l.p(s, _) : (l = a[e] = o[e](s), l.c()), O(l, 1), l.m(t, null)) : l = null), (!f || _[0] & /*variant, show_progress*/
1033
  320 && i !== (i = "wrap " + /*variant*/
1034
  s[8] + " " + /*show_progress*/
1035
+ s[6] + " svelte-1txqlrd")) && T(t, "class", i), (!f || _[0] & /*variant, show_progress, status, show_progress*/
1036
  336) && V(t, "hide", !/*status*/
1037
  s[4] || /*status*/
1038
  s[4] === "complete" || /*show_progress*/
 
1059
  /*border*/
1060
  s[12]
1061
  ), _[0] & /*absolute*/
1062
+ 1024 && D(
1063
  t,
1064
  "position",
1065
  /*absolute*/
1066
  s[10] ? "absolute" : "static"
1067
  ), _[0] & /*absolute*/
1068
+ 1024 && D(
1069
  t,
1070
  "padding",
1071
  /*absolute*/
 
1073
  );
1074
  },
1075
  i(s) {
1076
+ f || (O(l), f = !0);
1077
  },
1078
  o(s) {
1079
+ R(l), f = !1;
1080
  },
1081
  d(s) {
1082
  s && b(t), ~e && a[e].d(), n[31](null);
1083
  }
1084
  };
1085
  }
1086
+ let ee = [], se = !1;
1087
+ async function Qt(n, t = !0) {
1088
  if (!(window.__gradio_mode__ === "website" || window.__gradio_mode__ !== "app" && t !== !0)) {
1089
+ if (ee.push(n), !se)
1090
+ se = !0;
1091
  else
1092
  return;
1093
+ await Bt(), requestAnimationFrame(() => {
1094
  let e = [0, 0];
1095
+ for (let l = 0; l < ee.length; l++) {
1096
+ const f = ee[l].getBoundingClientRect();
1097
  (l === 0 || f.top + window.scrollY <= e[0]) && (e[0] = f.top + window.scrollY, e[1] = l);
1098
  }
1099
+ window.scrollTo({ top: e[0] - 20, behavior: "smooth" }), se = !1, ee = [];
1100
  });
1101
  }
1102
  }
1103
+ function Wt(n, t, e) {
1104
+ let l, { $$slots: i = {}, $$scope: f } = t, { i18n: o } = t, { eta: a = null } = t, { queue: r = !1 } = t, { queue_position: s } = t, { queue_size: _ } = t, { status: c } = t, { scroll_to_output: w = !1 } = t, { timer: h = !0 } = t, { show_progress: p = "full" } = t, { message: C = null } = t, { progress: k = null } = t, { variant: L = "default" } = t, { loading_text: F = "Loading..." } = t, { absolute: u = !0 } = t, { translucent: y = !1 } = t, { border: m = !1 } = t, { autoscroll: ne } = t, J, K = !1, W = 0, E = 0, ie = null, de = 0, I = null, Q, Z = null, me = !0;
1105
+ const et = () => {
1106
+ e(25, W = performance.now()), e(26, E = 0), K = !0, be();
1107
  };
1108
+ function be() {
1109
  requestAnimationFrame(() => {
1110
+ e(26, E = (performance.now() - W) / 1e3), K && be();
1111
  });
1112
  }
1113
+ function ge() {
1114
+ e(26, E = 0), K && (K = !1);
1115
  }
1116
+ At(() => {
1117
+ K && ge();
1118
  });
1119
+ let he = null;
1120
+ function tt(d) {
1121
+ Ce[d ? "unshift" : "push"](() => {
1122
+ Z = d, e(16, Z), e(7, k), e(14, I), e(15, Q);
1123
  });
1124
  }
1125
+ function lt(d) {
1126
+ Ce[d ? "unshift" : "push"](() => {
1127
+ J = d, e(13, J);
1128
  });
1129
  }
1130
  return n.$$set = (d) => {
1131
+ "i18n" in d && e(1, o = d.i18n), "eta" in d && e(0, a = d.eta), "queue" in d && e(21, r = d.queue), "queue_position" in d && e(2, s = d.queue_position), "queue_size" in d && e(3, _ = d.queue_size), "status" in d && e(4, c = d.status), "scroll_to_output" in d && e(22, w = d.scroll_to_output), "timer" in d && e(5, h = d.timer), "show_progress" in d && e(6, p = d.show_progress), "message" in d && e(23, C = d.message), "progress" in d && e(7, k = d.progress), "variant" in d && e(8, L = d.variant), "loading_text" in d && e(9, F = d.loading_text), "absolute" in d && e(10, u = d.absolute), "translucent" in d && e(11, y = d.translucent), "border" in d && e(12, m = d.border), "autoscroll" in d && e(24, ne = d.autoscroll), "$$scope" in d && e(28, f = d.$$scope);
1132
  }, n.$$.update = () => {
1133
  n.$$.dirty[0] & /*eta, old_eta, queue, timer_start*/
1134
+ 169869313 && (a === null ? e(0, a = ie) : r && e(0, a = (performance.now() - W) / 1e3 + a), a != null && (e(19, he = a.toFixed(1)), e(27, ie = a))), n.$$.dirty[0] & /*eta, timer_diff*/
1135
+ 67108865 && e(17, de = a === null || a <= 0 || !E ? null : Math.min(E / a, 1)), n.$$.dirty[0] & /*progress*/
1136
+ 128 && k != null && e(18, me = !1), n.$$.dirty[0] & /*progress, progress_level, progress_bar, last_progress_level*/
1137
+ 114816 && (k != null ? e(14, I = k.map((d) => {
1138
  if (d.index != null && d.length != null)
1139
  return d.index / d.length;
1140
  if (d.progress != null)
1141
  return d.progress;
1142
+ })) : e(14, I = null), I ? (e(15, Q = I[I.length - 1]), Z && (Q === 0 ? e(16, Z.style.transition = "0", Z) : e(16, Z.style.transition = "150ms", Z))) : e(15, Q = void 0)), n.$$.dirty[0] & /*status*/
1143
+ 16 && (c === "pending" ? et() : ge()), n.$$.dirty[0] & /*el, scroll_to_output, status, autoscroll*/
1144
+ 20979728 && J && w && (c === "pending" || c === "complete") && Qt(J, ne), n.$$.dirty[0] & /*status, message*/
1145
  8388624, n.$$.dirty[0] & /*timer_diff*/
1146
+ 67108864 && e(20, l = E.toFixed(1));
1147
  }, [
1148
  a,
1149
  o,
 
1151
  _,
1152
  c,
1153
  h,
 
1154
  p,
1155
+ k,
1156
  L,
1157
  F,
1158
  u,
1159
+ y,
1160
  m,
1161
+ J,
1162
+ I,
1163
+ Q,
1164
  Z,
 
1165
  de,
1166
+ me,
1167
+ he,
1168
  l,
1169
  r,
1170
  w,
1171
  C,
 
 
 
1172
  ne,
1173
+ W,
1174
+ E,
1175
+ ie,
1176
  f,
1177
  i,
1178
+ tt,
1179
+ lt
1180
  ];
1181
  }
1182
+ class xt extends Ct {
1183
  constructor(t) {
1184
  super(), Tt(
1185
  this,
1186
  t,
1187
+ Wt,
1188
+ Kt,
1189
+ Pt,
1190
  {
1191
  i18n: 1,
1192
  eta: 0,
 
1212
  }
1213
  }
1214
  const {
1215
+ SvelteComponent: $t,
1216
+ assign: el,
1217
+ create_slot: tl,
1218
+ detach: ll,
1219
+ element: nl,
1220
+ get_all_dirty_from_scope: il,
1221
+ get_slot_changes: sl,
1222
+ get_spread_update: fl,
1223
+ init: ol,
1224
+ insert: al,
1225
+ safe_not_equal: rl,
1226
+ set_dynamic_element_data: He,
1227
  set_style: M,
1228
+ toggle_class: A,
1229
+ transition_in: xe,
1230
+ transition_out: $e,
1231
+ update_slot_base: _l
1232
  } = window.__gradio__svelte__internal;
1233
+ function ul(n) {
1234
  let t, e, l;
1235
  const i = (
1236
  /*#slots*/
1237
  n[17].default
1238
+ ), f = tl(
1239
  i,
1240
  n,
1241
  /*$$scope*/
 
1257
  }
1258
  ], a = {};
1259
  for (let r = 0; r < o.length; r += 1)
1260
+ a = el(a, o[r]);
1261
  return {
1262
  c() {
1263
+ t = nl(
1264
  /*tag*/
1265
  n[14]
1266
+ ), f && f.c(), He(
1267
  /*tag*/
1268
  n[14]
1269
+ )(t, a), A(
1270
  t,
1271
  "hidden",
1272
  /*visible*/
1273
  n[10] === !1
1274
+ ), A(
1275
  t,
1276
  "padded",
1277
  /*padding*/
1278
  n[6]
1279
+ ), A(
1280
  t,
1281
  "border_focus",
1282
  /*border_mode*/
1283
  n[5] === "focus"
1284
+ ), A(t, "hide-container", !/*explicit_call*/
1285
  n[8] && !/*container*/
1286
  n[9]), M(t, "height", typeof /*height*/
1287
  n[0] == "number" ? (
 
1308
  n[13]}px, 100%))`), M(t, "border-width", "var(--block-border-width)");
1309
  },
1310
  m(r, s) {
1311
+ al(r, t, s), f && f.m(t, null), l = !0;
1312
  },
1313
  p(r, s) {
1314
  f && f.p && (!l || s & /*$$scope*/
1315
+ 65536) && _l(
1316
  f,
1317
  i,
1318
  r,
1319
  /*$$scope*/
1320
  r[16],
1321
+ l ? sl(
1322
  i,
1323
  /*$$scope*/
1324
  r[16],
1325
  s,
1326
  null
1327
+ ) : il(
1328
  /*$$scope*/
1329
  r[16]
1330
  ),
1331
  null
1332
+ ), He(
1333
  /*tag*/
1334
  r[14]
1335
+ )(t, a = fl(o, [
1336
  (!l || s & /*test_id*/
1337
  128) && { "data-testid": (
1338
  /*test_id*/
 
1346
  (!l || s & /*elem_classes*/
1347
  8 && e !== (e = "block " + /*elem_classes*/
1348
  r[3].join(" ") + " svelte-1t38q2d")) && { class: e }
1349
+ ])), A(
1350
  t,
1351
  "hidden",
1352
  /*visible*/
1353
  r[10] === !1
1354
+ ), A(
1355
  t,
1356
  "padded",
1357
  /*padding*/
1358
  r[6]
1359
+ ), A(
1360
  t,
1361
  "border_focus",
1362
  /*border_mode*/
1363
  r[5] === "focus"
1364
+ ), A(t, "hide-container", !/*explicit_call*/
1365
  r[8] && !/*container*/
1366
  r[9]), s & /*height*/
1367
  1 && M(t, "height", typeof /*height*/
 
1394
  r[13]}px, 100%))`);
1395
  },
1396
  i(r) {
1397
+ l || (xe(f, r), l = !0);
1398
  },
1399
  o(r) {
1400
+ $e(f, r), l = !1;
1401
  },
1402
  d(r) {
1403
+ r && ll(t), f && f.d(r);
1404
  }
1405
  };
1406
  }
1407
+ function cl(n) {
1408
  let t, e = (
1409
  /*tag*/
1410
+ n[14] && ul(n)
1411
  );
1412
  return {
1413
  c() {
 
1421
  l[14] && e.p(l, i);
1422
  },
1423
  i(l) {
1424
+ t || (xe(e, l), t = !0);
1425
  },
1426
  o(l) {
1427
+ $e(e, l), t = !1;
1428
  },
1429
  d(l) {
1430
  e && e.d(l);
1431
  }
1432
  };
1433
  }
1434
+ function dl(n, t, e) {
1435
+ let { $$slots: l = {}, $$scope: i } = t, { height: f = void 0 } = t, { width: o = void 0 } = t, { elem_id: a = "" } = t, { elem_classes: r = [] } = t, { variant: s = "solid" } = t, { border_mode: _ = "base" } = t, { padding: c = !0 } = t, { type: w = "normal" } = t, { test_id: h = void 0 } = t, { explicit_call: p = !1 } = t, { container: C = !0 } = t, { visible: k = !0 } = t, { allow_overflow: L = !0 } = t, { scale: F = null } = t, { min_width: u = 0 } = t, y = w === "fieldset" ? "fieldset" : "div";
1436
  return n.$$set = (m) => {
1437
+ "height" in m && e(0, f = m.height), "width" in m && e(1, o = m.width), "elem_id" in m && e(2, a = m.elem_id), "elem_classes" in m && e(3, r = m.elem_classes), "variant" in m && e(4, s = m.variant), "border_mode" in m && e(5, _ = m.border_mode), "padding" in m && e(6, c = m.padding), "type" in m && e(15, w = m.type), "test_id" in m && e(7, h = m.test_id), "explicit_call" in m && e(8, p = m.explicit_call), "container" in m && e(9, C = m.container), "visible" in m && e(10, k = m.visible), "allow_overflow" in m && e(11, L = m.allow_overflow), "scale" in m && e(12, F = m.scale), "min_width" in m && e(13, u = m.min_width), "$$scope" in m && e(16, i = m.$$scope);
1438
  }, [
1439
  f,
1440
  o,
 
1444
  _,
1445
  c,
1446
  h,
 
 
1447
  p,
1448
+ C,
1449
+ k,
1450
  L,
1451
  F,
1452
  u,
1453
+ y,
1454
  w,
1455
  i,
1456
  l
1457
  ];
1458
  }
1459
+ class ml extends $t {
1460
  constructor(t) {
1461
+ super(), ol(this, t, dl, cl, rl, {
1462
  height: 0,
1463
  width: 1,
1464
  elem_id: 2,
 
1477
  });
1478
  }
1479
  }
1480
+ const bl = [
1481
  { color: "red", primary: 600, secondary: 100 },
1482
  { color: "green", primary: 600, secondary: 100 },
1483
  { color: "blue", primary: 600, secondary: 100 },
 
1488
  { color: "cyan", primary: 600, secondary: 100 },
1489
  { color: "lime", primary: 500, secondary: 100 },
1490
  { color: "pink", primary: 600, secondary: 100 }
1491
+ ], Xe = {
1492
  inherit: "inherit",
1493
  current: "currentColor",
1494
  transparent: "transparent",
 
1781
  950: "#4c0519"
1782
  }
1783
  };
1784
+ bl.reduce(
1785
  (n, { color: t, primary: e, secondary: l }) => ({
1786
  ...n,
1787
  [t]: {
1788
+ primary: Xe[t][e],
1789
+ secondary: Xe[t][l]
1790
  }
1791
  }),
1792
  {}
1793
  );
1794
  const {
1795
+ SvelteComponent: gl,
1796
+ assign: hl,
1797
+ attr: wl,
1798
+ create_component: ae,
1799
+ destroy_component: re,
1800
+ detach: Ye,
1801
+ element: vl,
1802
+ get_spread_object: pl,
1803
  get_spread_update: yl,
1804
  init: kl,
1805
+ insert: Ge,
1806
+ mount_component: _e,
1807
+ safe_not_equal: ql,
1808
+ space: Fl,
1809
+ toggle_class: Oe,
1810
+ transition_in: ue,
1811
+ transition_out: ce
1812
  } = window.__gradio__svelte__internal;
1813
+ function Ll(n) {
1814
  var r;
1815
  let t, e, l, i, f;
1816
  const o = [
 
1828
  ];
1829
  let a = {};
1830
  for (let s = 0; s < o.length; s += 1)
1831
+ a = hl(a, o[s]);
1832
+ return t = new xt({ props: a }), i = new ct({
1833
  props: {
1834
  min_height: (
1835
  /*loading_status*/
 
1856
  ), {
1857
  c() {
1858
  var s;
1859
+ ae(t.$$.fragment), e = Fl(), l = vl("div"), ae(i.$$.fragment), wl(l, "class", "svelte-gqsrr7"), Oe(
1860
  l,
1861
  "pending",
1862
  /*loading_status*/
 
1864
  );
1865
  },
1866
  m(s, _) {
1867
+ _e(t, s, _), Ge(s, e, _), Ge(s, l, _), _e(i, l, null), f = !0;
1868
  },
1869
  p(s, _) {
1870
+ var h, p;
1871
  const c = _ & /*gradio, loading_status*/
1872
  48 ? yl(o, [
1873
  _ & /*gradio*/
 
1881
  s[5].i18n
1882
  ) },
1883
  _ & /*loading_status*/
1884
+ 16 && pl(
1885
  /*loading_status*/
1886
  s[4]
1887
  ),
 
1899
  s[1]), _ & /*visible*/
1900
  4 && (w.visible = /*visible*/
1901
  s[2]), i.$set(w), (!f || _ & /*loading_status*/
1902
+ 16) && Oe(
1903
  l,
1904
  "pending",
1905
  /*loading_status*/
1906
+ ((p = s[4]) == null ? void 0 : p.status) === "pending"
1907
  );
1908
  },
1909
  i(s) {
1910
+ f || (ue(t.$$.fragment, s), ue(i.$$.fragment, s), f = !0);
1911
  },
1912
  o(s) {
1913
+ ce(t.$$.fragment, s), ce(i.$$.fragment, s), f = !1;
1914
  },
1915
  d(s) {
1916
+ s && (Ye(e), Ye(l)), re(t, s), re(i);
1917
  }
1918
  };
1919
  }
1920
+ function Cl(n) {
1921
  let t, e;
1922
+ return t = new ml({
1923
  props: {
1924
  visible: (
1925
  /*visible*/
 
1934
  n[1]
1935
  ),
1936
  container: !1,
1937
+ $$slots: { default: [Ll] },
1938
  $$scope: { ctx: n }
1939
  }
1940
  }), {
1941
  c() {
1942
+ ae(t.$$.fragment);
1943
  },
1944
  m(l, i) {
1945
+ _e(t, l, i), e = !0;
1946
  },
1947
  p(l, [i]) {
1948
  const f = {};
 
1956
  318 && (f.$$scope = { dirty: i, ctx: l }), t.$set(f);
1957
  },
1958
  i(l) {
1959
+ e || (ue(t.$$.fragment, l), e = !0);
1960
  },
1961
  o(l) {
1962
+ ce(t.$$.fragment, l), e = !1;
1963
  },
1964
  d(l) {
1965
+ re(t, l);
1966
  }
1967
  };
1968
  }
1969
+ function Ml(n, t, e) {
1970
  let { label: l } = t, { elem_id: i = "" } = t, { elem_classes: f = [] } = t, { visible: o = !0 } = t, { value: a = "" } = t, { loading_status: r } = t, { gradio: s } = t;
1971
  const _ = () => s.dispatch("change");
1972
  return n.$$set = (c) => {
 
1985
  _
1986
  ];
1987
  }
1988
+ class Vl extends gl {
1989
  constructor(t) {
1990
+ super(), kl(this, t, Ml, Cl, ql, {
1991
  label: 6,
1992
  elem_id: 0,
1993
  elem_classes: 1,
 
1999
  }
2000
  }
2001
  export {
2002
+ Vl as default
2003
  };
components/iframe/demo/app.py CHANGED
@@ -1,3 +1,4 @@
 
1
  import gradio as gr
2
  from gradio_iframe import iframe
3
 
@@ -6,8 +7,8 @@ example = iframe().example_inputs()
6
 
7
  with gr.Blocks() as demo:
8
  with gr.Row():
9
- iframe(label="Blank") # blank component
10
- iframe(value=example, label="Populated") # populated component
11
 
12
 
13
  demo.launch()
 
1
+
2
  import gradio as gr
3
  from gradio_iframe import iframe
4
 
 
7
 
8
  with gr.Blocks() as demo:
9
  with gr.Row():
10
+ iframe(label="Blank"), # blank component
11
+ iframe(value=example, label="Populated"), # populated component
12
 
13
 
14
  demo.launch()
components/iframe/frontend/package-lock.json CHANGED
@@ -28,9 +28,9 @@
28
  }
29
  },
30
  "node_modules/@esbuild/aix-ppc64": {
31
- "version": "0.19.10",
32
- "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.19.10.tgz",
33
- "integrity": "sha512-Q+mk96KJ+FZ30h9fsJl+67IjNJm3x2eX+GBWGmocAKgzp27cowCOOqSdscX80s0SpdFXZnIv/+1xD1EctFx96Q==",
34
  "cpu": [
35
  "ppc64"
36
  ],
@@ -43,9 +43,9 @@
43
  }
44
  },
45
  "node_modules/@esbuild/android-arm": {
46
- "version": "0.19.10",
47
- "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.19.10.tgz",
48
- "integrity": "sha512-7W0bK7qfkw1fc2viBfrtAEkDKHatYfHzr/jKAHNr9BvkYDXPcC6bodtm8AyLJNNuqClLNaeTLuwURt4PRT9d7w==",
49
  "cpu": [
50
  "arm"
51
  ],
@@ -58,9 +58,9 @@
58
  }
59
  },
60
  "node_modules/@esbuild/android-arm64": {
61
- "version": "0.19.10",
62
- "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.19.10.tgz",
63
- "integrity": "sha512-1X4CClKhDgC3by7k8aOWZeBXQX8dHT5QAMCAQDArCLaYfkppoARvh0fit3X2Qs+MXDngKcHv6XXyQCpY0hkK1Q==",
64
  "cpu": [
65
  "arm64"
66
  ],
@@ -73,9 +73,9 @@
73
  }
74
  },
75
  "node_modules/@esbuild/android-x64": {
76
- "version": "0.19.10",
77
- "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.19.10.tgz",
78
- "integrity": "sha512-O/nO/g+/7NlitUxETkUv/IvADKuZXyH4BHf/g/7laqKC4i/7whLpB0gvpPc2zpF0q9Q6FXS3TS75QHac9MvVWw==",
79
  "cpu": [
80
  "x64"
81
  ],
@@ -88,9 +88,9 @@
88
  }
89
  },
90
  "node_modules/@esbuild/darwin-arm64": {
91
- "version": "0.19.10",
92
- "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.19.10.tgz",
93
- "integrity": "sha512-YSRRs2zOpwypck+6GL3wGXx2gNP7DXzetmo5pHXLrY/VIMsS59yKfjPizQ4lLt5vEI80M41gjm2BxrGZ5U+VMA==",
94
  "cpu": [
95
  "arm64"
96
  ],
@@ -103,9 +103,9 @@
103
  }
104
  },
105
  "node_modules/@esbuild/darwin-x64": {
106
- "version": "0.19.10",
107
- "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.19.10.tgz",
108
- "integrity": "sha512-alfGtT+IEICKtNE54hbvPg13xGBe4GkVxyGWtzr+yHO7HIiRJppPDhOKq3zstTcVf8msXb/t4eavW3jCDpMSmA==",
109
  "cpu": [
110
  "x64"
111
  ],
@@ -118,9 +118,9 @@
118
  }
119
  },
120
  "node_modules/@esbuild/freebsd-arm64": {
121
- "version": "0.19.10",
122
- "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.19.10.tgz",
123
- "integrity": "sha512-dMtk1wc7FSH8CCkE854GyGuNKCewlh+7heYP/sclpOG6Cectzk14qdUIY5CrKDbkA/OczXq9WesqnPl09mj5dg==",
124
  "cpu": [
125
  "arm64"
126
  ],
@@ -133,9 +133,9 @@
133
  }
134
  },
135
  "node_modules/@esbuild/freebsd-x64": {
136
- "version": "0.19.10",
137
- "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.19.10.tgz",
138
- "integrity": "sha512-G5UPPspryHu1T3uX8WiOEUa6q6OlQh6gNl4CO4Iw5PS+Kg5bVggVFehzXBJY6X6RSOMS8iXDv2330VzaObm4Ag==",
139
  "cpu": [
140
  "x64"
141
  ],
@@ -148,9 +148,9 @@
148
  }
149
  },
150
  "node_modules/@esbuild/linux-arm": {
151
- "version": "0.19.10",
152
- "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.19.10.tgz",
153
- "integrity": "sha512-j6gUW5aAaPgD416Hk9FHxn27On28H4eVI9rJ4az7oCGTFW48+LcgNDBN+9f8rKZz7EEowo889CPKyeaD0iw9Kg==",
154
  "cpu": [
155
  "arm"
156
  ],
@@ -163,9 +163,9 @@
163
  }
164
  },
165
  "node_modules/@esbuild/linux-arm64": {
166
- "version": "0.19.10",
167
- "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.19.10.tgz",
168
- "integrity": "sha512-QxaouHWZ+2KWEj7cGJmvTIHVALfhpGxo3WLmlYfJ+dA5fJB6lDEIg+oe/0//FuyVHuS3l79/wyBxbHr0NgtxJQ==",
169
  "cpu": [
170
  "arm64"
171
  ],
@@ -178,9 +178,9 @@
178
  }
179
  },
180
  "node_modules/@esbuild/linux-ia32": {
181
- "version": "0.19.10",
182
- "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.19.10.tgz",
183
- "integrity": "sha512-4ub1YwXxYjj9h1UIZs2hYbnTZBtenPw5NfXCRgEkGb0b6OJ2gpkMvDqRDYIDRjRdWSe/TBiZltm3Y3Q8SN1xNg==",
184
  "cpu": [
185
  "ia32"
186
  ],
@@ -193,9 +193,9 @@
193
  }
194
  },
195
  "node_modules/@esbuild/linux-loong64": {
196
- "version": "0.19.10",
197
- "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.19.10.tgz",
198
- "integrity": "sha512-lo3I9k+mbEKoxtoIbM0yC/MZ1i2wM0cIeOejlVdZ3D86LAcFXFRdeuZmh91QJvUTW51bOK5W2BznGNIl4+mDaA==",
199
  "cpu": [
200
  "loong64"
201
  ],
@@ -208,9 +208,9 @@
208
  }
209
  },
210
  "node_modules/@esbuild/linux-mips64el": {
211
- "version": "0.19.10",
212
- "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.19.10.tgz",
213
- "integrity": "sha512-J4gH3zhHNbdZN0Bcr1QUGVNkHTdpijgx5VMxeetSk6ntdt+vR1DqGmHxQYHRmNb77tP6GVvD+K0NyO4xjd7y4A==",
214
  "cpu": [
215
  "mips64el"
216
  ],
@@ -223,9 +223,9 @@
223
  }
224
  },
225
  "node_modules/@esbuild/linux-ppc64": {
226
- "version": "0.19.10",
227
- "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.19.10.tgz",
228
- "integrity": "sha512-tgT/7u+QhV6ge8wFMzaklOY7KqiyitgT1AUHMApau32ZlvTB/+efeCtMk4eXS+uEymYK249JsoiklZN64xt6oQ==",
229
  "cpu": [
230
  "ppc64"
231
  ],
@@ -238,9 +238,9 @@
238
  }
239
  },
240
  "node_modules/@esbuild/linux-riscv64": {
241
- "version": "0.19.10",
242
- "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.19.10.tgz",
243
- "integrity": "sha512-0f/spw0PfBMZBNqtKe5FLzBDGo0SKZKvMl5PHYQr3+eiSscfJ96XEknCe+JoOayybWUFQbcJTrk946i3j9uYZA==",
244
  "cpu": [
245
  "riscv64"
246
  ],
@@ -253,9 +253,9 @@
253
  }
254
  },
255
  "node_modules/@esbuild/linux-s390x": {
256
- "version": "0.19.10",
257
- "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.19.10.tgz",
258
- "integrity": "sha512-pZFe0OeskMHzHa9U38g+z8Yx5FNCLFtUnJtQMpwhS+r4S566aK2ci3t4NCP4tjt6d5j5uo4h7tExZMjeKoehAA==",
259
  "cpu": [
260
  "s390x"
261
  ],
@@ -268,9 +268,9 @@
268
  }
269
  },
270
  "node_modules/@esbuild/linux-x64": {
271
- "version": "0.19.10",
272
- "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.19.10.tgz",
273
- "integrity": "sha512-SpYNEqg/6pZYoc+1zLCjVOYvxfZVZj6w0KROZ3Fje/QrM3nfvT2llI+wmKSrWuX6wmZeTapbarvuNNK/qepSgA==",
274
  "cpu": [
275
  "x64"
276
  ],
@@ -283,9 +283,9 @@
283
  }
284
  },
285
  "node_modules/@esbuild/netbsd-x64": {
286
- "version": "0.19.10",
287
- "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.19.10.tgz",
288
- "integrity": "sha512-ACbZ0vXy9zksNArWlk2c38NdKg25+L9pr/mVaj9SUq6lHZu/35nx2xnQVRGLrC1KKQqJKRIB0q8GspiHI3J80Q==",
289
  "cpu": [
290
  "x64"
291
  ],
@@ -298,9 +298,9 @@
298
  }
299
  },
300
  "node_modules/@esbuild/openbsd-x64": {
301
- "version": "0.19.10",
302
- "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.19.10.tgz",
303
- "integrity": "sha512-PxcgvjdSjtgPMiPQrM3pwSaG4kGphP+bLSb+cihuP0LYdZv1epbAIecHVl5sD3npkfYBZ0ZnOjR878I7MdJDFg==",
304
  "cpu": [
305
  "x64"
306
  ],
@@ -313,9 +313,9 @@
313
  }
314
  },
315
  "node_modules/@esbuild/sunos-x64": {
316
- "version": "0.19.10",
317
- "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.19.10.tgz",
318
- "integrity": "sha512-ZkIOtrRL8SEJjr+VHjmW0znkPs+oJXhlJbNwfI37rvgeMtk3sxOQevXPXjmAPZPigVTncvFqLMd+uV0IBSEzqA==",
319
  "cpu": [
320
  "x64"
321
  ],
@@ -328,9 +328,9 @@
328
  }
329
  },
330
  "node_modules/@esbuild/win32-arm64": {
331
- "version": "0.19.10",
332
- "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.19.10.tgz",
333
- "integrity": "sha512-+Sa4oTDbpBfGpl3Hn3XiUe4f8TU2JF7aX8cOfqFYMMjXp6ma6NJDztl5FDG8Ezx0OjwGikIHw+iA54YLDNNVfw==",
334
  "cpu": [
335
  "arm64"
336
  ],
@@ -343,9 +343,9 @@
343
  }
344
  },
345
  "node_modules/@esbuild/win32-ia32": {
346
- "version": "0.19.10",
347
- "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.19.10.tgz",
348
- "integrity": "sha512-EOGVLK1oWMBXgfttJdPHDTiivYSjX6jDNaATeNOaCOFEVcfMjtbx7WVQwPSE1eIfCp/CaSF2nSrDtzc4I9f8TQ==",
349
  "cpu": [
350
  "ia32"
351
  ],
@@ -358,9 +358,9 @@
358
  }
359
  },
360
  "node_modules/@esbuild/win32-x64": {
361
- "version": "0.19.10",
362
- "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.19.10.tgz",
363
- "integrity": "sha512-whqLG6Sc70AbU73fFYvuYzaE4MNMBIlR1Y/IrUeOXFrWHxBEjjbZaQ3IXIQS8wJdAzue2GwYZCjOrgrU1oUHoA==",
364
  "cpu": [
365
  "x64"
366
  ],
@@ -499,9 +499,9 @@
499
  "peer": true
500
  },
501
  "node_modules/@jridgewell/trace-mapping": {
502
- "version": "0.3.20",
503
- "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.20.tgz",
504
- "integrity": "sha512-R8LcPeWZol2zR8mmH3JeKQ6QRCFb7XgUhV9ZlGhHLGyg4wpPiPZNQOOWhFZhxKw8u//yTbNGI42Bx/3paXEQ+Q==",
505
  "peer": true,
506
  "dependencies": {
507
  "@jridgewell/resolve-uri": "^3.1.0",
@@ -515,9 +515,9 @@
515
  "peer": true
516
  },
517
  "node_modules/acorn": {
518
- "version": "8.11.2",
519
- "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.2.tgz",
520
- "integrity": "sha512-nc0Axzp/0FILLEVsm4fNwLCwMttvhEI263QtVPQcbpfZZ3ts0hLsZGOpE6czNlid7CJ9MlyH8reXkpsf3YUY4w==",
521
  "peer": true,
522
  "bin": {
523
  "acorn": "bin/acorn"
@@ -536,9 +536,9 @@
536
  }
537
  },
538
  "node_modules/axobject-query": {
539
- "version": "3.2.1",
540
- "resolved": "https://registry.npmjs.org/axobject-query/-/axobject-query-3.2.1.tgz",
541
- "integrity": "sha512-jsyHu61e6N4Vbz/v18DHwWYKK0bSWLqn47eeDSKPB7m8tqMHF9YJ+mhIk2lVteyZrY8tnSj/jHOv4YiTCuCJgg==",
542
  "peer": true,
543
  "dependencies": {
544
  "dequal": "^2.0.3"
@@ -656,9 +656,9 @@
656
  }
657
  },
658
  "node_modules/esbuild": {
659
- "version": "0.19.10",
660
- "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.19.10.tgz",
661
- "integrity": "sha512-S1Y27QGt/snkNYrRcswgRFqZjaTG5a5xM3EQo97uNBnH505pdzSNe/HLBq1v0RO7iK/ngdbhJB6mDAp0OK+iUA==",
662
  "hasInstallScript": true,
663
  "bin": {
664
  "esbuild": "bin/esbuild"
@@ -667,29 +667,29 @@
667
  "node": ">=12"
668
  },
669
  "optionalDependencies": {
670
- "@esbuild/aix-ppc64": "0.19.10",
671
- "@esbuild/android-arm": "0.19.10",
672
- "@esbuild/android-arm64": "0.19.10",
673
- "@esbuild/android-x64": "0.19.10",
674
- "@esbuild/darwin-arm64": "0.19.10",
675
- "@esbuild/darwin-x64": "0.19.10",
676
- "@esbuild/freebsd-arm64": "0.19.10",
677
- "@esbuild/freebsd-x64": "0.19.10",
678
- "@esbuild/linux-arm": "0.19.10",
679
- "@esbuild/linux-arm64": "0.19.10",
680
- "@esbuild/linux-ia32": "0.19.10",
681
- "@esbuild/linux-loong64": "0.19.10",
682
- "@esbuild/linux-mips64el": "0.19.10",
683
- "@esbuild/linux-ppc64": "0.19.10",
684
- "@esbuild/linux-riscv64": "0.19.10",
685
- "@esbuild/linux-s390x": "0.19.10",
686
- "@esbuild/linux-x64": "0.19.10",
687
- "@esbuild/netbsd-x64": "0.19.10",
688
- "@esbuild/openbsd-x64": "0.19.10",
689
- "@esbuild/sunos-x64": "0.19.10",
690
- "@esbuild/win32-arm64": "0.19.10",
691
- "@esbuild/win32-ia32": "0.19.10",
692
- "@esbuild/win32-x64": "0.19.10"
693
  }
694
  },
695
  "node_modules/estree-walker": {
@@ -850,17 +850,18 @@
850
  }
851
  },
852
  "node_modules/svelte": {
853
- "version": "4.2.8",
854
- "resolved": "https://registry.npmjs.org/svelte/-/svelte-4.2.8.tgz",
855
- "integrity": "sha512-hU6dh1MPl8gh6klQZwK/n73GiAHiR95IkFsesLPbMeEZi36ydaXL/ZAb4g9sayT0MXzpxyZjR28yderJHxcmYA==",
856
  "peer": true,
857
  "dependencies": {
858
  "@ampproject/remapping": "^2.2.1",
859
  "@jridgewell/sourcemap-codec": "^1.4.15",
860
  "@jridgewell/trace-mapping": "^0.3.18",
 
861
  "acorn": "^8.9.0",
862
  "aria-query": "^5.3.0",
863
- "axobject-query": "^3.2.1",
864
  "code-red": "^1.0.3",
865
  "css-tree": "^2.3.1",
866
  "estree-walker": "^3.0.3",
 
28
  }
29
  },
30
  "node_modules/@esbuild/aix-ppc64": {
31
+ "version": "0.19.11",
32
+ "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.19.11.tgz",
33
+ "integrity": "sha512-FnzU0LyE3ySQk7UntJO4+qIiQgI7KoODnZg5xzXIrFJlKd2P2gwHsHY4927xj9y5PJmJSzULiUCWmv7iWnNa7g==",
34
  "cpu": [
35
  "ppc64"
36
  ],
 
43
  }
44
  },
45
  "node_modules/@esbuild/android-arm": {
46
+ "version": "0.19.11",
47
+ "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.19.11.tgz",
48
+ "integrity": "sha512-5OVapq0ClabvKvQ58Bws8+wkLCV+Rxg7tUVbo9xu034Nm536QTII4YzhaFriQ7rMrorfnFKUsArD2lqKbFY4vw==",
49
  "cpu": [
50
  "arm"
51
  ],
 
58
  }
59
  },
60
  "node_modules/@esbuild/android-arm64": {
61
+ "version": "0.19.11",
62
+ "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.19.11.tgz",
63
+ "integrity": "sha512-aiu7K/5JnLj//KOnOfEZ0D90obUkRzDMyqd/wNAUQ34m4YUPVhRZpnqKV9uqDGxT7cToSDnIHsGooyIczu9T+Q==",
64
  "cpu": [
65
  "arm64"
66
  ],
 
73
  }
74
  },
75
  "node_modules/@esbuild/android-x64": {
76
+ "version": "0.19.11",
77
+ "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.19.11.tgz",
78
+ "integrity": "sha512-eccxjlfGw43WYoY9QgB82SgGgDbibcqyDTlk3l3C0jOVHKxrjdc9CTwDUQd0vkvYg5um0OH+GpxYvp39r+IPOg==",
79
  "cpu": [
80
  "x64"
81
  ],
 
88
  }
89
  },
90
  "node_modules/@esbuild/darwin-arm64": {
91
+ "version": "0.19.11",
92
+ "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.19.11.tgz",
93
+ "integrity": "sha512-ETp87DRWuSt9KdDVkqSoKoLFHYTrkyz2+65fj9nfXsaV3bMhTCjtQfw3y+um88vGRKRiF7erPrh/ZuIdLUIVxQ==",
94
  "cpu": [
95
  "arm64"
96
  ],
 
103
  }
104
  },
105
  "node_modules/@esbuild/darwin-x64": {
106
+ "version": "0.19.11",
107
+ "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.19.11.tgz",
108
+ "integrity": "sha512-fkFUiS6IUK9WYUO/+22omwetaSNl5/A8giXvQlcinLIjVkxwTLSktbF5f/kJMftM2MJp9+fXqZ5ezS7+SALp4g==",
109
  "cpu": [
110
  "x64"
111
  ],
 
118
  }
119
  },
120
  "node_modules/@esbuild/freebsd-arm64": {
121
+ "version": "0.19.11",
122
+ "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.19.11.tgz",
123
+ "integrity": "sha512-lhoSp5K6bxKRNdXUtHoNc5HhbXVCS8V0iZmDvyWvYq9S5WSfTIHU2UGjcGt7UeS6iEYp9eeymIl5mJBn0yiuxA==",
124
  "cpu": [
125
  "arm64"
126
  ],
 
133
  }
134
  },
135
  "node_modules/@esbuild/freebsd-x64": {
136
+ "version": "0.19.11",
137
+ "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.19.11.tgz",
138
+ "integrity": "sha512-JkUqn44AffGXitVI6/AbQdoYAq0TEullFdqcMY/PCUZ36xJ9ZJRtQabzMA+Vi7r78+25ZIBosLTOKnUXBSi1Kw==",
139
  "cpu": [
140
  "x64"
141
  ],
 
148
  }
149
  },
150
  "node_modules/@esbuild/linux-arm": {
151
+ "version": "0.19.11",
152
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.19.11.tgz",
153
+ "integrity": "sha512-3CRkr9+vCV2XJbjwgzjPtO8T0SZUmRZla+UL1jw+XqHZPkPgZiyWvbDvl9rqAN8Zl7qJF0O/9ycMtjU67HN9/Q==",
154
  "cpu": [
155
  "arm"
156
  ],
 
163
  }
164
  },
165
  "node_modules/@esbuild/linux-arm64": {
166
+ "version": "0.19.11",
167
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.19.11.tgz",
168
+ "integrity": "sha512-LneLg3ypEeveBSMuoa0kwMpCGmpu8XQUh+mL8XXwoYZ6Be2qBnVtcDI5azSvh7vioMDhoJFZzp9GWp9IWpYoUg==",
169
  "cpu": [
170
  "arm64"
171
  ],
 
178
  }
179
  },
180
  "node_modules/@esbuild/linux-ia32": {
181
+ "version": "0.19.11",
182
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.19.11.tgz",
183
+ "integrity": "sha512-caHy++CsD8Bgq2V5CodbJjFPEiDPq8JJmBdeyZ8GWVQMjRD0sU548nNdwPNvKjVpamYYVL40AORekgfIubwHoA==",
184
  "cpu": [
185
  "ia32"
186
  ],
 
193
  }
194
  },
195
  "node_modules/@esbuild/linux-loong64": {
196
+ "version": "0.19.11",
197
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.19.11.tgz",
198
+ "integrity": "sha512-ppZSSLVpPrwHccvC6nQVZaSHlFsvCQyjnvirnVjbKSHuE5N24Yl8F3UwYUUR1UEPaFObGD2tSvVKbvR+uT1Nrg==",
199
  "cpu": [
200
  "loong64"
201
  ],
 
208
  }
209
  },
210
  "node_modules/@esbuild/linux-mips64el": {
211
+ "version": "0.19.11",
212
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.19.11.tgz",
213
+ "integrity": "sha512-B5x9j0OgjG+v1dF2DkH34lr+7Gmv0kzX6/V0afF41FkPMMqaQ77pH7CrhWeR22aEeHKaeZVtZ6yFwlxOKPVFyg==",
214
  "cpu": [
215
  "mips64el"
216
  ],
 
223
  }
224
  },
225
  "node_modules/@esbuild/linux-ppc64": {
226
+ "version": "0.19.11",
227
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.19.11.tgz",
228
+ "integrity": "sha512-MHrZYLeCG8vXblMetWyttkdVRjQlQUb/oMgBNurVEnhj4YWOr4G5lmBfZjHYQHHN0g6yDmCAQRR8MUHldvvRDA==",
229
  "cpu": [
230
  "ppc64"
231
  ],
 
238
  }
239
  },
240
  "node_modules/@esbuild/linux-riscv64": {
241
+ "version": "0.19.11",
242
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.19.11.tgz",
243
+ "integrity": "sha512-f3DY++t94uVg141dozDu4CCUkYW+09rWtaWfnb3bqe4w5NqmZd6nPVBm+qbz7WaHZCoqXqHz5p6CM6qv3qnSSQ==",
244
  "cpu": [
245
  "riscv64"
246
  ],
 
253
  }
254
  },
255
  "node_modules/@esbuild/linux-s390x": {
256
+ "version": "0.19.11",
257
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.19.11.tgz",
258
+ "integrity": "sha512-A5xdUoyWJHMMlcSMcPGVLzYzpcY8QP1RtYzX5/bS4dvjBGVxdhuiYyFwp7z74ocV7WDc0n1harxmpq2ePOjI0Q==",
259
  "cpu": [
260
  "s390x"
261
  ],
 
268
  }
269
  },
270
  "node_modules/@esbuild/linux-x64": {
271
+ "version": "0.19.11",
272
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.19.11.tgz",
273
+ "integrity": "sha512-grbyMlVCvJSfxFQUndw5mCtWs5LO1gUlwP4CDi4iJBbVpZcqLVT29FxgGuBJGSzyOxotFG4LoO5X+M1350zmPA==",
274
  "cpu": [
275
  "x64"
276
  ],
 
283
  }
284
  },
285
  "node_modules/@esbuild/netbsd-x64": {
286
+ "version": "0.19.11",
287
+ "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.19.11.tgz",
288
+ "integrity": "sha512-13jvrQZJc3P230OhU8xgwUnDeuC/9egsjTkXN49b3GcS5BKvJqZn86aGM8W9pd14Kd+u7HuFBMVtrNGhh6fHEQ==",
289
  "cpu": [
290
  "x64"
291
  ],
 
298
  }
299
  },
300
  "node_modules/@esbuild/openbsd-x64": {
301
+ "version": "0.19.11",
302
+ "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.19.11.tgz",
303
+ "integrity": "sha512-ysyOGZuTp6SNKPE11INDUeFVVQFrhcNDVUgSQVDzqsqX38DjhPEPATpid04LCoUr2WXhQTEZ8ct/EgJCUDpyNw==",
304
  "cpu": [
305
  "x64"
306
  ],
 
313
  }
314
  },
315
  "node_modules/@esbuild/sunos-x64": {
316
+ "version": "0.19.11",
317
+ "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.19.11.tgz",
318
+ "integrity": "sha512-Hf+Sad9nVwvtxy4DXCZQqLpgmRTQqyFyhT3bZ4F2XlJCjxGmRFF0Shwn9rzhOYRB61w9VMXUkxlBy56dk9JJiQ==",
319
  "cpu": [
320
  "x64"
321
  ],
 
328
  }
329
  },
330
  "node_modules/@esbuild/win32-arm64": {
331
+ "version": "0.19.11",
332
+ "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.19.11.tgz",
333
+ "integrity": "sha512-0P58Sbi0LctOMOQbpEOvOL44Ne0sqbS0XWHMvvrg6NE5jQ1xguCSSw9jQeUk2lfrXYsKDdOe6K+oZiwKPilYPQ==",
334
  "cpu": [
335
  "arm64"
336
  ],
 
343
  }
344
  },
345
  "node_modules/@esbuild/win32-ia32": {
346
+ "version": "0.19.11",
347
+ "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.19.11.tgz",
348
+ "integrity": "sha512-6YOrWS+sDJDmshdBIQU+Uoyh7pQKrdykdefC1avn76ss5c+RN6gut3LZA4E2cH5xUEp5/cA0+YxRaVtRAb0xBg==",
349
  "cpu": [
350
  "ia32"
351
  ],
 
358
  }
359
  },
360
  "node_modules/@esbuild/win32-x64": {
361
+ "version": "0.19.11",
362
+ "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.19.11.tgz",
363
+ "integrity": "sha512-vfkhltrjCAb603XaFhqhAF4LGDi2M4OrCRrFusyQ+iTLQ/o60QQXxc9cZC/FFpihBI9N1Grn6SMKVJ4KP7Fuiw==",
364
  "cpu": [
365
  "x64"
366
  ],
 
499
  "peer": true
500
  },
501
  "node_modules/@jridgewell/trace-mapping": {
502
+ "version": "0.3.22",
503
+ "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.22.tgz",
504
+ "integrity": "sha512-Wf963MzWtA2sjrNt+g18IAln9lKnlRp+K2eH4jjIoF1wYeq3aMREpG09xhlhdzS0EjwU7qmUJYangWa+151vZw==",
505
  "peer": true,
506
  "dependencies": {
507
  "@jridgewell/resolve-uri": "^3.1.0",
 
515
  "peer": true
516
  },
517
  "node_modules/acorn": {
518
+ "version": "8.11.3",
519
+ "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.3.tgz",
520
+ "integrity": "sha512-Y9rRfJG5jcKOE0CLisYbojUjIrIEE7AGMzA/Sm4BslANhbS+cDMpgBdcPT91oJ7OuJ9hYJBx59RjbhxVnrF8Xg==",
521
  "peer": true,
522
  "bin": {
523
  "acorn": "bin/acorn"
 
536
  }
537
  },
538
  "node_modules/axobject-query": {
539
+ "version": "4.0.0",
540
+ "resolved": "https://registry.npmjs.org/axobject-query/-/axobject-query-4.0.0.tgz",
541
+ "integrity": "sha512-+60uv1hiVFhHZeO+Lz0RYzsVHy5Wr1ayX0mwda9KPDVLNJgZ1T9Ny7VmFbLDzxsH0D87I86vgj3gFrjTJUYznw==",
542
  "peer": true,
543
  "dependencies": {
544
  "dequal": "^2.0.3"
 
656
  }
657
  },
658
  "node_modules/esbuild": {
659
+ "version": "0.19.11",
660
+ "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.19.11.tgz",
661
+ "integrity": "sha512-HJ96Hev2hX/6i5cDVwcqiJBBtuo9+FeIJOtZ9W1kA5M6AMJRHUZlpYZ1/SbEwtO0ioNAW8rUooVpC/WehY2SfA==",
662
  "hasInstallScript": true,
663
  "bin": {
664
  "esbuild": "bin/esbuild"
 
667
  "node": ">=12"
668
  },
669
  "optionalDependencies": {
670
+ "@esbuild/aix-ppc64": "0.19.11",
671
+ "@esbuild/android-arm": "0.19.11",
672
+ "@esbuild/android-arm64": "0.19.11",
673
+ "@esbuild/android-x64": "0.19.11",
674
+ "@esbuild/darwin-arm64": "0.19.11",
675
+ "@esbuild/darwin-x64": "0.19.11",
676
+ "@esbuild/freebsd-arm64": "0.19.11",
677
+ "@esbuild/freebsd-x64": "0.19.11",
678
+ "@esbuild/linux-arm": "0.19.11",
679
+ "@esbuild/linux-arm64": "0.19.11",
680
+ "@esbuild/linux-ia32": "0.19.11",
681
+ "@esbuild/linux-loong64": "0.19.11",
682
+ "@esbuild/linux-mips64el": "0.19.11",
683
+ "@esbuild/linux-ppc64": "0.19.11",
684
+ "@esbuild/linux-riscv64": "0.19.11",
685
+ "@esbuild/linux-s390x": "0.19.11",
686
+ "@esbuild/linux-x64": "0.19.11",
687
+ "@esbuild/netbsd-x64": "0.19.11",
688
+ "@esbuild/openbsd-x64": "0.19.11",
689
+ "@esbuild/sunos-x64": "0.19.11",
690
+ "@esbuild/win32-arm64": "0.19.11",
691
+ "@esbuild/win32-ia32": "0.19.11",
692
+ "@esbuild/win32-x64": "0.19.11"
693
  }
694
  },
695
  "node_modules/estree-walker": {
 
850
  }
851
  },
852
  "node_modules/svelte": {
853
+ "version": "4.2.9",
854
+ "resolved": "https://registry.npmjs.org/svelte/-/svelte-4.2.9.tgz",
855
+ "integrity": "sha512-hsoB/WZGEPFXeRRLPhPrbRz67PhP6sqYgvwcAs+gWdSQSvNDw+/lTeUJSWe5h2xC97Fz/8QxAOqItwBzNJPU8w==",
856
  "peer": true,
857
  "dependencies": {
858
  "@ampproject/remapping": "^2.2.1",
859
  "@jridgewell/sourcemap-codec": "^1.4.15",
860
  "@jridgewell/trace-mapping": "^0.3.18",
861
+ "@types/estree": "^1.0.1",
862
  "acorn": "^8.9.0",
863
  "aria-query": "^5.3.0",
864
+ "axobject-query": "^4.0.0",
865
  "code-red": "^1.0.3",
866
  "css-tree": "^2.3.1",
867
  "estree-walker": "^3.0.3",
components/iframe/frontend/shared/HTML.svelte CHANGED
@@ -8,6 +8,7 @@
8
  const dispatch = createEventDispatcher<{ change: undefined }>();
9
 
10
  $: value, dispatch("change");
 
11
  </script>
12
 
13
  <div
@@ -15,7 +16,7 @@
15
  class:min={min_height}
16
  class:hide={!visible}
17
  >
18
- {@html value}
19
  </div>
20
 
21
  <style>
 
8
  const dispatch = createEventDispatcher<{ change: undefined }>();
9
 
10
  $: value, dispatch("change");
11
+
12
  </script>
13
 
14
  <div
 
16
  class:min={min_height}
17
  class:hide={!visible}
18
  >
19
+ <iframe title="iframe component" width="100%" height="100%" srcdoc={value} allow=""></iframe>
20
  </div>
21
 
22
  <style>
components/iframe/pyproject.toml CHANGED
@@ -8,12 +8,12 @@ build-backend = "hatchling.build"
8
 
9
  [project]
10
  name = "gradio_iframe"
11
- version = "0.0.1"
12
- description = "iFrame components that wraps html and js code to make them interactive."
13
  readme = "README.md"
14
  license = "MIT"
15
  requires-python = ">=3.8"
16
- authors = [{ name = "YOUR NAME", email = "YOUREMAIL@domain.com" }]
17
  keywords = ["gradio-custom-component", "gradio-template-HTML", "HTML", "iFrame"]
18
  # Add dependencies here
19
  dependencies = ["gradio>=4.0,<5.0"]
@@ -36,7 +36,7 @@ classifiers = [
36
  dev = ["build", "twine"]
37
 
38
  [tool.hatch.build]
39
- artifacts = ["/backend/gradio_iframe/templates", "*.pyi", "backend/gradio_iframe/templates"]
40
 
41
  [tool.hatch.build.targets.wheel]
42
  packages = ["/backend/gradio_iframe"]
 
8
 
9
  [project]
10
  name = "gradio_iframe"
11
+ version = "0.0.5"
12
+ description = "Enhanced HTML components that display an interactive iframe element."
13
  readme = "README.md"
14
  license = "MIT"
15
  requires-python = ">=3.8"
16
+ authors = [{ name = "Lennard Zündorf", email = "lennard@zuendorf.me" }]
17
  keywords = ["gradio-custom-component", "gradio-template-HTML", "HTML", "iFrame"]
18
  # Add dependencies here
19
  dependencies = ["gradio>=4.0,<5.0"]
 
36
  dev = ["build", "twine"]
37
 
38
  [tool.hatch.build]
39
+ artifacts = ["/backend/gradio_iframe/templates", "*.pyi", "backend/gradio_iframe/templates", "backend/gradio_iframe/templates", "home/lennard/.virtualenvs/thesis/lib/python3.11/site-packages/gradio_iframe/templates", "home/lennard/.virtualenvs/thesis/lib/python3.11/site-packages/gradio_iframe/templates", "home/lennard/.virtualenvs/thesis/lib/python3.11/site-packages/gradio_iframe/templates"]
40
 
41
  [tool.hatch.build.targets.wheel]
42
  packages = ["/backend/gradio_iframe"]
explanation/interpret.py CHANGED
@@ -8,6 +8,7 @@ import torch
8
 
9
  # internal imports
10
  from utils import formatting as fmt
 
11
 
12
  # global variables
13
  TEACHER_FORCING = None
@@ -25,11 +26,18 @@ def chat_explained(model, prompt):
25
 
26
  # create the explanation graphic and plot
27
  graphic = create_graphic(shap_values)
28
- plot = create_plot(shap_values)
 
 
 
 
 
 
 
29
 
30
  # create the response text
31
  response_text = fmt.format_output_text(shap_values.output_names)
32
- return response_text, graphic, plot
33
 
34
 
35
  def wrap_shap(model):
@@ -65,10 +73,7 @@ def create_graphic(shap_values):
65
  # creating an attention heatmap plot using matplotlib/seaborn
66
  # CREDIT: adopted from official Matplotlib documentation
67
  ## see https://matplotlib.org/stable/
68
- def create_plot(shap_values):
69
- values = shap_values.values[0]
70
- output_names = shap_values.output_names
71
- input_names = shap_values.data[0]
72
 
73
  # Set seaborn style to dark
74
  sns.set(style="white")
 
8
 
9
  # internal imports
10
  from utils import formatting as fmt
11
+ from .markup import markup_text
12
 
13
  # global variables
14
  TEACHER_FORCING = None
 
26
 
27
  # create the explanation graphic and plot
28
  graphic = create_graphic(shap_values)
29
+ plot = create_plot(
30
+ values=shap_values.values[0],
31
+ output_names=shap_values.output_names,
32
+ input_names=shap_values.data[0],
33
+ )
34
+ marked_text = markup_text(
35
+ shap_values.data[0], shap_values.values[0], variant="shap"
36
+ )
37
 
38
  # create the response text
39
  response_text = fmt.format_output_text(shap_values.output_names)
40
+ return response_text, graphic, plot, marked_text
41
 
42
 
43
  def wrap_shap(model):
 
73
  # creating an attention heatmap plot using matplotlib/seaborn
74
  # CREDIT: adopted from official Matplotlib documentation
75
  ## see https://matplotlib.org/stable/
76
+ def create_plot(values, output_names, input_names):
 
 
 
77
 
78
  # Set seaborn style to dark
79
  sns.set(style="white")
explanation/markup.py ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # markup module that provides marked up text and a plot for the explanations
2
+
3
+ # external imports
4
+ import numpy as np
5
+ from numpy import ndarray
6
+
7
+ # internal imports
8
+ from utils import formatting as fmt
9
+
10
+
11
+ def markup_text(input_text: list, text_values: ndarray, variant: str):
12
+ buckets = 10
13
+
14
+ # Flatten the explanations values
15
+ if variant == "shap":
16
+ text_values = np.transpose(text_values)
17
+ text_values = fmt.flatten_values(text_values)
18
+
19
+ # Determine the minimum and maximum values
20
+ min_val, max_val = np.min(text_values), np.max(text_values)
21
+
22
+ # Separate the threshold calculation for negative and positive values
23
+ if variant == "visualizer":
24
+ thresholds = np.linspace(min_val, max_val, num=buckets, endpoint=False)[1:]
25
+ else:
26
+ neg_thresholds = np.linspace(min_val, 0, num=buckets // 2 + 1, endpoint=False)[
27
+ 1:
28
+ ]
29
+ pos_thresholds = np.linspace(0, max_val, num=buckets // 2 + 1)[1:]
30
+ thresholds = np.concatenate([neg_thresholds, pos_thresholds])
31
+
32
+ marked_text = []
33
+
34
+ # Function to determine the bucket for a given value
35
+ for text, value in zip(input_text, text_values):
36
+ bucket = 0
37
+ for i, threshold in enumerate(thresholds, start=1):
38
+ if value > threshold:
39
+ bucket = i
40
+ marked_text.append((text, str(bucket)))
41
+
42
+ return marked_text
43
+
44
+
45
+ def color_codes():
46
+ return {
47
+ # 1-5: Strong Light Red to Lighter Red
48
+ "1": "#FF6666", # Strong Light Red
49
+ "2": "#FF8080", # Slightly Lighter Red
50
+ "3": "#FF9999", # Intermediate Light Red
51
+ "4": "#FFB3B3", # Light Red
52
+ "5": "#FFCCCC", # Very Light Red
53
+ # 6-10: Light Green to Strong Light Green
54
+ "6": "#B3FFB3", # Light Green
55
+ "7": "#99FF99", # Slightly Stronger Green
56
+ "8": "#80FF80", # Intermediate Green
57
+ "9": "#66FF66", # Strong Green
58
+ "10": "#4DFF4D", # Very Strong Green
59
+ }
explanation/visualize.py CHANGED
@@ -1,13 +1,13 @@
1
  # visualization module that creates an attention visualization using BERTViz
2
 
3
  # external imports
4
- from bertviz import head_view
5
  import matplotlib.pyplot as plt
6
  import seaborn as sns
7
  import numpy as np
8
 
9
  # internal imports
10
  from utils import formatting as fmt
 
11
 
12
 
13
  # plotting function that plots the attention values in a heatmap
@@ -34,36 +34,21 @@ def chat_explained(model, prompt):
34
  output_attentions=True,
35
  )
36
 
 
 
37
  # create the response text, graphic and plot
38
  response_text = fmt.format_output_text(decoder_text)
39
- graphic = create_graphic(attention_output, (encoder_text, decoder_text))
40
- plot = create_plot(attention_output, (encoder_text, decoder_text))
41
- return response_text, graphic, plot
42
-
43
-
44
- # creating a html graphic using BERTViz
45
- def create_graphic(attention_output, enc_dec_texts: tuple):
46
-
47
- # calls the head_view function of BERTViz to return html graphic
48
- hview = head_view(
49
- encoder_attention=attention_output.encoder_attentions,
50
- decoder_attention=attention_output.decoder_attentions,
51
- cross_attention=attention_output.cross_attentions,
52
- encoder_tokens=enc_dec_texts[0],
53
- decoder_tokens=enc_dec_texts[1],
54
- html_action="return",
55
- )
56
 
57
- return str(hview.data)
58
 
59
 
60
  # creating an attention heatmap plot using matplotlib/seaborn
61
  # CREDIT: adopted from official Matplotlib documentation
62
  ## see https://matplotlib.org/stable/
63
- def create_plot(attention_output, enc_dec_texts: tuple):
64
- # get the averaged attention weights
65
- attention = attention_output.cross_attentions[0][0].detach().numpy()
66
- averaged_attention_weights = np.mean(attention, axis=0)
67
  averaged_attention_weights = np.transpose(averaged_attention_weights)
68
 
69
  # get the encoder and decoder tokens in text form
@@ -115,3 +100,8 @@ def create_plot(attention_output, enc_dec_texts: tuple):
115
 
116
  # return the plot
117
  return plt
 
 
 
 
 
 
1
  # visualization module that creates an attention visualization using BERTViz
2
 
3
  # external imports
 
4
  import matplotlib.pyplot as plt
5
  import seaborn as sns
6
  import numpy as np
7
 
8
  # internal imports
9
  from utils import formatting as fmt
10
+ from .markup import markup_text
11
 
12
 
13
  # plotting function that plots the attention values in a heatmap
 
34
  output_attentions=True,
35
  )
36
 
37
+ averaged_attention = avg_attention(attention_output)
38
+
39
  # create the response text, graphic and plot
40
  response_text = fmt.format_output_text(decoder_text)
41
+ plot = create_plot(averaged_attention, (encoder_text, decoder_text))
42
+ marked_text = markup_text(encoder_text, averaged_attention, variant="visualizer")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
43
 
44
+ return response_text, "", plot, marked_text
45
 
46
 
47
  # creating an attention heatmap plot using matplotlib/seaborn
48
  # CREDIT: adopted from official Matplotlib documentation
49
  ## see https://matplotlib.org/stable/
50
+ def create_plot(averaged_attention_weights, enc_dec_texts: tuple):
51
+ # transpose the attention weights
 
 
52
  averaged_attention_weights = np.transpose(averaged_attention_weights)
53
 
54
  # get the encoder and decoder tokens in text form
 
100
 
101
  # return the plot
102
  return plt
103
+
104
+
105
+ def avg_attention(attention_values):
106
+ attention = attention_values.cross_attentions[0][0].detach().numpy()
107
+ return np.mean(attention, axis=0)
main.py CHANGED
@@ -9,14 +9,14 @@ import markdown
9
  import gradio as gr
10
  from uvicorn import run
11
 
12
-
13
  # internal imports
14
  from backend.controller import interference
15
-
16
 
17
  # Global Variables and css
18
  app = FastAPI()
19
  css = "body {text-align: start !important;}"
 
20
 
21
 
22
  # different functions to provide frontend abilities
@@ -47,7 +47,10 @@ def xai_info(xai_radio):
47
  # ui interface based on Gradio Blocks (see documentation:
48
  # https://www.gradio.app/docs/interface)
49
  with gr.Blocks(
50
- css="text-align: start !important",
 
 
 
51
  title="Thesis Webapp Showcase",
52
  head="<head>",
53
  ) as ui:
@@ -72,7 +75,7 @@ with gr.Blocks(
72
 
73
  """)
74
  # row with columns for the different settings
75
- with gr.Row(equal_height=True):
76
  # column that takes up 3/5 of the row
77
  with gr.Column(scale=3):
78
  # textbox to enter the system prompt
@@ -101,44 +104,53 @@ with gr.Blocks(
101
 
102
  # row with chatbot ui displaying "conversation" with the model
103
  with gr.Row(equal_height=True):
104
- # out of the box chatbot component
105
- # see documentation: https://www.gradio.app/docs/chatbot
106
- chatbot = gr.Chatbot(
107
- layout="panel",
108
- show_copy_button=True,
109
- avatar_images=("./public/human.jpg", "./public/bot.jpg"),
110
- )
111
- # rows with input textboxes
112
- with gr.Row():
113
- # textbox to enter the knowledge
114
- with gr.Accordion(label="Additional Knowledge", open=False):
115
- knowledge_input = gr.Textbox(
116
- value="",
117
- label="Knowledge",
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
118
  max_lines=5,
119
- info="Add additional context knowledge.",
 
 
 
120
  show_label=True,
121
  )
122
- with gr.Row():
123
- # textbox to enter the user prompt
124
- user_prompt = gr.Textbox(
125
- label="Input Message",
126
- max_lines=5,
127
- info="""
128
- Ask the ChatBot a question.
129
- Hint: More complicated question give better explanation insights!
130
- """,
131
- show_label=True,
132
- )
133
  # row with columns for buttons to submit and clear content
134
- with gr.Row():
135
  with gr.Column(scale=1):
136
  # out of the box clear button which clearn the given components (see
137
  # documentation: https://www.gradio.app/docs/clearbutton)
138
  clear_btn = gr.ClearButton([user_prompt, chatbot])
139
  with gr.Column(scale=1):
140
  submit_btn = gr.Button("Submit", variant="primary")
141
- with gr.Row():
142
  gr.Examples(
143
  label="Example Questions",
144
  examples=[
@@ -177,9 +189,9 @@ with gr.Blocks(
177
  """)
178
  # row that displays the generated explanation of the model (if applicable)
179
  with gr.Row(variant="panel"):
180
- # wraps the explanation html in an iframe to display it interactively
181
  xai_interactive = gr.HTML(
182
- label="Interactive Explanation",
183
  value=(
184
  '<div style="text-align: center"><h4>No Graphic to Display'
185
  " (Yet)</h4></div>"
@@ -203,13 +215,13 @@ with gr.Blocks(
203
  submit_btn.click(
204
  interference,
205
  [user_prompt, chatbot, knowledge_input, system_prompt, xai_selection],
206
- [user_prompt, chatbot, xai_interactive, xai_plot],
207
  )
208
  # function triggered by the enter key
209
  user_prompt.submit(
210
  interference,
211
  [user_prompt, chatbot, knowledge_input, system_prompt, xai_selection],
212
- [user_prompt, chatbot, xai_interactive, xai_plot],
213
  )
214
 
215
  # final row to show legal information
 
9
  import gradio as gr
10
  from uvicorn import run
11
 
 
12
  # internal imports
13
  from backend.controller import interference
14
+ from explanation.markup import color_codes
15
 
16
  # Global Variables and css
17
  app = FastAPI()
18
  css = "body {text-align: start !important;}"
19
+ coloring = color_codes()
20
 
21
 
22
  # different functions to provide frontend abilities
 
47
  # ui interface based on Gradio Blocks (see documentation:
48
  # https://www.gradio.app/docs/interface)
49
  with gr.Blocks(
50
+ css="""
51
+ .examples {text-align: start;}
52
+ .seperatedRow {border-top: 1rem solid;}",
53
+ """,
54
  title="Thesis Webapp Showcase",
55
  head="<head>",
56
  ) as ui:
 
75
 
76
  """)
77
  # row with columns for the different settings
78
+ with gr.Row(equal_height=True, variant="compact"):
79
  # column that takes up 3/5 of the row
80
  with gr.Column(scale=3):
81
  # textbox to enter the system prompt
 
104
 
105
  # row with chatbot ui displaying "conversation" with the model
106
  with gr.Row(equal_height=True):
107
+ with gr.Group(elem_classes="border: 1px solid black;"):
108
+ # accordion to display the normalized input explanation
109
+ with gr.Accordion(label="Input Explanation", open=False):
110
+ gr.Markdown("""
111
+ #### Input Explanation
112
+ The input explanation shows the explanation for the last message
113
+ you sent to the AI ChatBot. The explanation is based on the
114
+ XAI method you selected.
115
+ """)
116
+ xai_text = gr.HighlightedText(
117
+ color_map=coloring, label="Input Explanation", show_legend=True
118
+ )
119
+ # out of the box chatbot component
120
+ # see documentation: https://www.gradio.app/docs/chatbot
121
+ chatbot = gr.Chatbot(
122
+ layout="panel",
123
+ show_copy_button=True,
124
+ avatar_images=("./public/human.jpg", "./public/bot.jpg"),
125
+ )
126
+ # textbox to enter the knowledge
127
+ with gr.Accordion(label="Additional Knowledge", open=False):
128
+ knowledge_input = gr.Textbox(
129
+ value="",
130
+ label="Knowledge",
131
+ max_lines=5,
132
+ info="Add additional context knowledge.",
133
+ show_label=True,
134
+ )
135
+ # textbox to enter the user prompt
136
+ user_prompt = gr.Textbox(
137
+ label="Input Message",
138
  max_lines=5,
139
+ info="""
140
+ Ask the ChatBot a question.
141
+ Hint: More complicated question give better explanation insights!
142
+ """,
143
  show_label=True,
144
  )
 
 
 
 
 
 
 
 
 
 
 
145
  # row with columns for buttons to submit and clear content
146
+ with gr.Row(elem_classes="border-"):
147
  with gr.Column(scale=1):
148
  # out of the box clear button which clearn the given components (see
149
  # documentation: https://www.gradio.app/docs/clearbutton)
150
  clear_btn = gr.ClearButton([user_prompt, chatbot])
151
  with gr.Column(scale=1):
152
  submit_btn = gr.Button("Submit", variant="primary")
153
+ with gr.Row(elem_classes="examples"):
154
  gr.Examples(
155
  label="Example Questions",
156
  examples=[
 
189
  """)
190
  # row that displays the generated explanation of the model (if applicable)
191
  with gr.Row(variant="panel"):
192
+ # wraps the explanation html to display it statically
193
  xai_interactive = gr.HTML(
194
+ label="Static Explanation",
195
  value=(
196
  '<div style="text-align: center"><h4>No Graphic to Display'
197
  " (Yet)</h4></div>"
 
215
  submit_btn.click(
216
  interference,
217
  [user_prompt, chatbot, knowledge_input, system_prompt, xai_selection],
218
+ [user_prompt, chatbot, xai_interactive, xai_plot, xai_text],
219
  )
220
  # function triggered by the enter key
221
  user_prompt.submit(
222
  interference,
223
  [user_prompt, chatbot, knowledge_input, system_prompt, xai_selection],
224
+ [user_prompt, chatbot, xai_interactive, xai_plot, xai_text],
225
  )
226
 
227
  # final row to show legal information
requirements.txt CHANGED
@@ -16,4 +16,4 @@ numpy
16
  matplotlib
17
  pre-commit
18
  ipython
19
- #./components/iframe/dist/gradio_iframe-0.0.1-py3-none-any.whl
 
16
  matplotlib
17
  pre-commit
18
  ipython
19
+ ./components/iframe/dist/gradio_iframe-0.0.2-py3-none-any.whl
utils/formatting.py CHANGED
@@ -2,6 +2,8 @@
2
 
3
  # external imports
4
  import re
 
 
5
 
6
 
7
  # function to format the model reponse nicely
@@ -33,7 +35,17 @@ def format_output_text(output: list):
33
  # format the tokens by removing special tokens and special characters
34
  def format_tokens(tokens: list):
35
  # define special tokens to remove and initialize empty list
36
- special_tokens = ["[CLS]", "[SEP]", "[PAD]", "[UNK]", "[MASK]", "▁", "Ġ", "</w>"]
 
 
 
 
 
 
 
 
 
 
37
  updated_tokens = []
38
 
39
  # loop through tokens
@@ -51,3 +63,8 @@ def format_tokens(tokens: list):
51
 
52
  # return the list of tokens
53
  return updated_tokens
 
 
 
 
 
 
2
 
3
  # external imports
4
  import re
5
+ import numpy as np
6
+ from numpy import ndarray
7
 
8
 
9
  # function to format the model reponse nicely
 
35
  # format the tokens by removing special tokens and special characters
36
  def format_tokens(tokens: list):
37
  # define special tokens to remove and initialize empty list
38
+ special_tokens = [
39
+ "[CLS]",
40
+ "[SEP]",
41
+ "[PAD]",
42
+ "[UNK]",
43
+ "[MASK]",
44
+ "▁",
45
+ "Ġ",
46
+ "</w>",
47
+ "/n",
48
+ ]
49
  updated_tokens = []
50
 
51
  # loop through tokens
 
63
 
64
  # return the list of tokens
65
  return updated_tokens
66
+
67
+
68
+ # function to flatten values into a 2d list by averaging the explanation values
69
+ def flatten_values(values: ndarray, axis: int = 0):
70
+ return np.mean(values, axis=axis)