Alex Cabrera commited on
Commit
ef9a72e
1 Parent(s): e3f428b

initial commit

Browse files
.dockerignore ADDED
@@ -0,0 +1 @@
 
1
+ .git
.zeno_cache/PREDISTILLlength.pickle ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4ffa123a5017b310990a9b70ad99c59c87ad2d6b725b02d0231397baae94d76a
3
+ size 100459948
.zeno_cache/folders.pickle ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ec0a6ccf9debf1c16781445c4b9106080d00478b0559469336db7c7b7b9711c8
3
+ size 5
.zeno_cache/reports.pickle ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ed33d091985df7f4735052eb8e43b8f939cece07b04e70954f55a743452c239e
3
+ size 407
.zeno_cache/slices.pickle ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:960fc2cdd2f0422a602e0240e22d554dfa33df5a640453648c8ff51206475e27
3
+ size 844
.zeno_cache/view.mjs ADDED
@@ -0,0 +1,781 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ function noop() { }
2
+ function run(fn) {
3
+ return fn();
4
+ }
5
+ function blank_object() {
6
+ return Object.create(null);
7
+ }
8
+ function run_all(fns) {
9
+ fns.forEach(run);
10
+ }
11
+ function is_function(thing) {
12
+ return typeof thing === 'function';
13
+ }
14
+ function safe_not_equal(a, b) {
15
+ return a != a ? b == b : a !== b || ((a && typeof a === 'object') || typeof a === 'function');
16
+ }
17
+ let src_url_equal_anchor;
18
+ function src_url_equal(element_src, url) {
19
+ if (!src_url_equal_anchor) {
20
+ src_url_equal_anchor = document.createElement('a');
21
+ }
22
+ src_url_equal_anchor.href = url;
23
+ return element_src === src_url_equal_anchor.href;
24
+ }
25
+ function is_empty(obj) {
26
+ return Object.keys(obj).length === 0;
27
+ }
28
+
29
+ // Track which nodes are claimed during hydration. Unclaimed nodes can then be removed from the DOM
30
+ // at the end of hydration without touching the remaining nodes.
31
+ let is_hydrating = false;
32
+ function start_hydrating() {
33
+ is_hydrating = true;
34
+ }
35
+ function end_hydrating() {
36
+ is_hydrating = false;
37
+ }
38
+ function upper_bound(low, high, key, value) {
39
+ // Return first index of value larger than input value in the range [low, high)
40
+ while (low < high) {
41
+ const mid = low + ((high - low) >> 1);
42
+ if (key(mid) <= value) {
43
+ low = mid + 1;
44
+ }
45
+ else {
46
+ high = mid;
47
+ }
48
+ }
49
+ return low;
50
+ }
51
+ function init_hydrate(target) {
52
+ if (target.hydrate_init)
53
+ return;
54
+ target.hydrate_init = true;
55
+ // We know that all children have claim_order values since the unclaimed have been detached if target is not <head>
56
+ let children = target.childNodes;
57
+ // If target is <head>, there may be children without claim_order
58
+ if (target.nodeName === 'HEAD') {
59
+ const myChildren = [];
60
+ for (let i = 0; i < children.length; i++) {
61
+ const node = children[i];
62
+ if (node.claim_order !== undefined) {
63
+ myChildren.push(node);
64
+ }
65
+ }
66
+ children = myChildren;
67
+ }
68
+ /*
69
+ * Reorder claimed children optimally.
70
+ * We can reorder claimed children optimally by finding the longest subsequence of
71
+ * nodes that are already claimed in order and only moving the rest. The longest
72
+ * subsequence subsequence of nodes that are claimed in order can be found by
73
+ * computing the longest increasing subsequence of .claim_order values.
74
+ *
75
+ * This algorithm is optimal in generating the least amount of reorder operations
76
+ * possible.
77
+ *
78
+ * Proof:
79
+ * We know that, given a set of reordering operations, the nodes that do not move
80
+ * always form an increasing subsequence, since they do not move among each other
81
+ * meaning that they must be already ordered among each other. Thus, the maximal
82
+ * set of nodes that do not move form a longest increasing subsequence.
83
+ */
84
+ // Compute longest increasing subsequence
85
+ // m: subsequence length j => index k of smallest value that ends an increasing subsequence of length j
86
+ const m = new Int32Array(children.length + 1);
87
+ // Predecessor indices + 1
88
+ const p = new Int32Array(children.length);
89
+ m[0] = -1;
90
+ let longest = 0;
91
+ for (let i = 0; i < children.length; i++) {
92
+ const current = children[i].claim_order;
93
+ // Find the largest subsequence length such that it ends in a value less than our current value
94
+ // upper_bound returns first greater value, so we subtract one
95
+ // with fast path for when we are on the current longest subsequence
96
+ const seqLen = ((longest > 0 && children[m[longest]].claim_order <= current) ? longest + 1 : upper_bound(1, longest, idx => children[m[idx]].claim_order, current)) - 1;
97
+ p[i] = m[seqLen] + 1;
98
+ const newLen = seqLen + 1;
99
+ // We can guarantee that current is the smallest value. Otherwise, we would have generated a longer sequence.
100
+ m[newLen] = i;
101
+ longest = Math.max(newLen, longest);
102
+ }
103
+ // The longest increasing subsequence of nodes (initially reversed)
104
+ const lis = [];
105
+ // The rest of the nodes, nodes that will be moved
106
+ const toMove = [];
107
+ let last = children.length - 1;
108
+ for (let cur = m[longest] + 1; cur != 0; cur = p[cur - 1]) {
109
+ lis.push(children[cur - 1]);
110
+ for (; last >= cur; last--) {
111
+ toMove.push(children[last]);
112
+ }
113
+ last--;
114
+ }
115
+ for (; last >= 0; last--) {
116
+ toMove.push(children[last]);
117
+ }
118
+ lis.reverse();
119
+ // We sort the nodes being moved to guarantee that their insertion order matches the claim order
120
+ toMove.sort((a, b) => a.claim_order - b.claim_order);
121
+ // Finally, we move the nodes
122
+ for (let i = 0, j = 0; i < toMove.length; i++) {
123
+ while (j < lis.length && toMove[i].claim_order >= lis[j].claim_order) {
124
+ j++;
125
+ }
126
+ const anchor = j < lis.length ? lis[j] : null;
127
+ target.insertBefore(toMove[i], anchor);
128
+ }
129
+ }
130
+ function append(target, node) {
131
+ target.appendChild(node);
132
+ }
133
+ function append_styles(target, style_sheet_id, styles) {
134
+ const append_styles_to = get_root_for_style(target);
135
+ if (!append_styles_to.getElementById(style_sheet_id)) {
136
+ const style = element('style');
137
+ style.id = style_sheet_id;
138
+ style.textContent = styles;
139
+ append_stylesheet(append_styles_to, style);
140
+ }
141
+ }
142
+ function get_root_for_style(node) {
143
+ if (!node)
144
+ return document;
145
+ const root = node.getRootNode ? node.getRootNode() : node.ownerDocument;
146
+ if (root && root.host) {
147
+ return root;
148
+ }
149
+ return node.ownerDocument;
150
+ }
151
+ function append_stylesheet(node, style) {
152
+ append(node.head || node, style);
153
+ }
154
+ function append_hydration(target, node) {
155
+ if (is_hydrating) {
156
+ init_hydrate(target);
157
+ if ((target.actual_end_child === undefined) || ((target.actual_end_child !== null) && (target.actual_end_child.parentElement !== target))) {
158
+ target.actual_end_child = target.firstChild;
159
+ }
160
+ // Skip nodes of undefined ordering
161
+ while ((target.actual_end_child !== null) && (target.actual_end_child.claim_order === undefined)) {
162
+ target.actual_end_child = target.actual_end_child.nextSibling;
163
+ }
164
+ if (node !== target.actual_end_child) {
165
+ // We only insert if the ordering of this node should be modified or the parent node is not target
166
+ if (node.claim_order !== undefined || node.parentNode !== target) {
167
+ target.insertBefore(node, target.actual_end_child);
168
+ }
169
+ }
170
+ else {
171
+ target.actual_end_child = node.nextSibling;
172
+ }
173
+ }
174
+ else if (node.parentNode !== target || node.nextSibling !== null) {
175
+ target.appendChild(node);
176
+ }
177
+ }
178
+ function insert_hydration(target, node, anchor) {
179
+ if (is_hydrating && !anchor) {
180
+ append_hydration(target, node);
181
+ }
182
+ else if (node.parentNode !== target || node.nextSibling != anchor) {
183
+ target.insertBefore(node, anchor || null);
184
+ }
185
+ }
186
+ function detach(node) {
187
+ node.parentNode.removeChild(node);
188
+ }
189
+ function element(name) {
190
+ return document.createElement(name);
191
+ }
192
+ function text(data) {
193
+ return document.createTextNode(data);
194
+ }
195
+ function space() {
196
+ return text(' ');
197
+ }
198
+ function attr(node, attribute, value) {
199
+ if (value == null)
200
+ node.removeAttribute(attribute);
201
+ else if (node.getAttribute(attribute) !== value)
202
+ node.setAttribute(attribute, value);
203
+ }
204
+ function children(element) {
205
+ return Array.from(element.childNodes);
206
+ }
207
+ function init_claim_info(nodes) {
208
+ if (nodes.claim_info === undefined) {
209
+ nodes.claim_info = { last_index: 0, total_claimed: 0 };
210
+ }
211
+ }
212
+ function claim_node(nodes, predicate, processNode, createNode, dontUpdateLastIndex = false) {
213
+ // Try to find nodes in an order such that we lengthen the longest increasing subsequence
214
+ init_claim_info(nodes);
215
+ const resultNode = (() => {
216
+ // We first try to find an element after the previous one
217
+ for (let i = nodes.claim_info.last_index; i < nodes.length; i++) {
218
+ const node = nodes[i];
219
+ if (predicate(node)) {
220
+ const replacement = processNode(node);
221
+ if (replacement === undefined) {
222
+ nodes.splice(i, 1);
223
+ }
224
+ else {
225
+ nodes[i] = replacement;
226
+ }
227
+ if (!dontUpdateLastIndex) {
228
+ nodes.claim_info.last_index = i;
229
+ }
230
+ return node;
231
+ }
232
+ }
233
+ // Otherwise, we try to find one before
234
+ // We iterate in reverse so that we don't go too far back
235
+ for (let i = nodes.claim_info.last_index - 1; i >= 0; i--) {
236
+ const node = nodes[i];
237
+ if (predicate(node)) {
238
+ const replacement = processNode(node);
239
+ if (replacement === undefined) {
240
+ nodes.splice(i, 1);
241
+ }
242
+ else {
243
+ nodes[i] = replacement;
244
+ }
245
+ if (!dontUpdateLastIndex) {
246
+ nodes.claim_info.last_index = i;
247
+ }
248
+ else if (replacement === undefined) {
249
+ // Since we spliced before the last_index, we decrease it
250
+ nodes.claim_info.last_index--;
251
+ }
252
+ return node;
253
+ }
254
+ }
255
+ // If we can't find any matching node, we create a new one
256
+ return createNode();
257
+ })();
258
+ resultNode.claim_order = nodes.claim_info.total_claimed;
259
+ nodes.claim_info.total_claimed += 1;
260
+ return resultNode;
261
+ }
262
+ function claim_element_base(nodes, name, attributes, create_element) {
263
+ return claim_node(nodes, (node) => node.nodeName === name, (node) => {
264
+ const remove = [];
265
+ for (let j = 0; j < node.attributes.length; j++) {
266
+ const attribute = node.attributes[j];
267
+ if (!attributes[attribute.name]) {
268
+ remove.push(attribute.name);
269
+ }
270
+ }
271
+ remove.forEach(v => node.removeAttribute(v));
272
+ return undefined;
273
+ }, () => create_element(name));
274
+ }
275
+ function claim_element(nodes, name, attributes) {
276
+ return claim_element_base(nodes, name, attributes, element);
277
+ }
278
+ function claim_text(nodes, data) {
279
+ return claim_node(nodes, (node) => node.nodeType === 3, (node) => {
280
+ const dataStr = '' + data;
281
+ if (node.data.startsWith(dataStr)) {
282
+ if (node.data.length !== dataStr.length) {
283
+ return node.splitText(dataStr.length);
284
+ }
285
+ }
286
+ else {
287
+ node.data = dataStr;
288
+ }
289
+ }, () => text(data), true // Text nodes should not update last index since it is likely not worth it to eliminate an increasing subsequence of actual elements
290
+ );
291
+ }
292
+ function claim_space(nodes) {
293
+ return claim_text(nodes, ' ');
294
+ }
295
+ function set_data(text, data) {
296
+ data = '' + data;
297
+ if (text.wholeText !== data)
298
+ text.data = data;
299
+ }
300
+ function set_style(node, key, value, important) {
301
+ if (value === null) {
302
+ node.style.removeProperty(key);
303
+ }
304
+ else {
305
+ node.style.setProperty(key, value, important ? 'important' : '');
306
+ }
307
+ }
308
+
309
+ let current_component;
310
+ function set_current_component(component) {
311
+ current_component = component;
312
+ }
313
+
314
+ const dirty_components = [];
315
+ const binding_callbacks = [];
316
+ const render_callbacks = [];
317
+ const flush_callbacks = [];
318
+ const resolved_promise = Promise.resolve();
319
+ let update_scheduled = false;
320
+ function schedule_update() {
321
+ if (!update_scheduled) {
322
+ update_scheduled = true;
323
+ resolved_promise.then(flush);
324
+ }
325
+ }
326
+ function add_render_callback(fn) {
327
+ render_callbacks.push(fn);
328
+ }
329
+ // flush() calls callbacks in this order:
330
+ // 1. All beforeUpdate callbacks, in order: parents before children
331
+ // 2. All bind:this callbacks, in reverse order: children before parents.
332
+ // 3. All afterUpdate callbacks, in order: parents before children. EXCEPT
333
+ // for afterUpdates called during the initial onMount, which are called in
334
+ // reverse order: children before parents.
335
+ // Since callbacks might update component values, which could trigger another
336
+ // call to flush(), the following steps guard against this:
337
+ // 1. During beforeUpdate, any updated components will be added to the
338
+ // dirty_components array and will cause a reentrant call to flush(). Because
339
+ // the flush index is kept outside the function, the reentrant call will pick
340
+ // up where the earlier call left off and go through all dirty components. The
341
+ // current_component value is saved and restored so that the reentrant call will
342
+ // not interfere with the "parent" flush() call.
343
+ // 2. bind:this callbacks cannot trigger new flush() calls.
344
+ // 3. During afterUpdate, any updated components will NOT have their afterUpdate
345
+ // callback called a second time; the seen_callbacks set, outside the flush()
346
+ // function, guarantees this behavior.
347
+ const seen_callbacks = new Set();
348
+ let flushidx = 0; // Do *not* move this inside the flush() function
349
+ function flush() {
350
+ const saved_component = current_component;
351
+ do {
352
+ // first, call beforeUpdate functions
353
+ // and update components
354
+ while (flushidx < dirty_components.length) {
355
+ const component = dirty_components[flushidx];
356
+ flushidx++;
357
+ set_current_component(component);
358
+ update(component.$$);
359
+ }
360
+ set_current_component(null);
361
+ dirty_components.length = 0;
362
+ flushidx = 0;
363
+ while (binding_callbacks.length)
364
+ binding_callbacks.pop()();
365
+ // then, once components are updated, call
366
+ // afterUpdate functions. This may cause
367
+ // subsequent updates...
368
+ for (let i = 0; i < render_callbacks.length; i += 1) {
369
+ const callback = render_callbacks[i];
370
+ if (!seen_callbacks.has(callback)) {
371
+ // ...so guard against infinite loops
372
+ seen_callbacks.add(callback);
373
+ callback();
374
+ }
375
+ }
376
+ render_callbacks.length = 0;
377
+ } while (dirty_components.length);
378
+ while (flush_callbacks.length) {
379
+ flush_callbacks.pop()();
380
+ }
381
+ update_scheduled = false;
382
+ seen_callbacks.clear();
383
+ set_current_component(saved_component);
384
+ }
385
+ function update($$) {
386
+ if ($$.fragment !== null) {
387
+ $$.update();
388
+ run_all($$.before_update);
389
+ const dirty = $$.dirty;
390
+ $$.dirty = [-1];
391
+ $$.fragment && $$.fragment.p($$.ctx, dirty);
392
+ $$.after_update.forEach(add_render_callback);
393
+ }
394
+ }
395
+ const outroing = new Set();
396
+ function transition_in(block, local) {
397
+ if (block && block.i) {
398
+ outroing.delete(block);
399
+ block.i(local);
400
+ }
401
+ }
402
+ function mount_component(component, target, anchor, customElement) {
403
+ const { fragment, on_mount, on_destroy, after_update } = component.$$;
404
+ fragment && fragment.m(target, anchor);
405
+ if (!customElement) {
406
+ // onMount happens before the initial afterUpdate
407
+ add_render_callback(() => {
408
+ const new_on_destroy = on_mount.map(run).filter(is_function);
409
+ if (on_destroy) {
410
+ on_destroy.push(...new_on_destroy);
411
+ }
412
+ else {
413
+ // Edge case - component was destroyed immediately,
414
+ // most likely as a result of a binding initialising
415
+ run_all(new_on_destroy);
416
+ }
417
+ component.$$.on_mount = [];
418
+ });
419
+ }
420
+ after_update.forEach(add_render_callback);
421
+ }
422
+ function destroy_component(component, detaching) {
423
+ const $$ = component.$$;
424
+ if ($$.fragment !== null) {
425
+ run_all($$.on_destroy);
426
+ $$.fragment && $$.fragment.d(detaching);
427
+ // TODO null out other refs, including component.$$ (but need to
428
+ // preserve final state?)
429
+ $$.on_destroy = $$.fragment = null;
430
+ $$.ctx = [];
431
+ }
432
+ }
433
+ function make_dirty(component, i) {
434
+ if (component.$$.dirty[0] === -1) {
435
+ dirty_components.push(component);
436
+ schedule_update();
437
+ component.$$.dirty.fill(0);
438
+ }
439
+ component.$$.dirty[(i / 31) | 0] |= (1 << (i % 31));
440
+ }
441
+ function init(component, options, instance, create_fragment, not_equal, props, append_styles, dirty = [-1]) {
442
+ const parent_component = current_component;
443
+ set_current_component(component);
444
+ const $$ = component.$$ = {
445
+ fragment: null,
446
+ ctx: null,
447
+ // state
448
+ props,
449
+ update: noop,
450
+ not_equal,
451
+ bound: blank_object(),
452
+ // lifecycle
453
+ on_mount: [],
454
+ on_destroy: [],
455
+ on_disconnect: [],
456
+ before_update: [],
457
+ after_update: [],
458
+ context: new Map(options.context || (parent_component ? parent_component.$$.context : [])),
459
+ // everything else
460
+ callbacks: blank_object(),
461
+ dirty,
462
+ skip_bound: false,
463
+ root: options.target || parent_component.$$.root
464
+ };
465
+ append_styles && append_styles($$.root);
466
+ let ready = false;
467
+ $$.ctx = instance
468
+ ? instance(component, options.props || {}, (i, ret, ...rest) => {
469
+ const value = rest.length ? rest[0] : ret;
470
+ if ($$.ctx && not_equal($$.ctx[i], $$.ctx[i] = value)) {
471
+ if (!$$.skip_bound && $$.bound[i])
472
+ $$.bound[i](value);
473
+ if (ready)
474
+ make_dirty(component, i);
475
+ }
476
+ return ret;
477
+ })
478
+ : [];
479
+ $$.update();
480
+ ready = true;
481
+ run_all($$.before_update);
482
+ // `false` as a special case of no DOM component
483
+ $$.fragment = create_fragment ? create_fragment($$.ctx) : false;
484
+ if (options.target) {
485
+ if (options.hydrate) {
486
+ start_hydrating();
487
+ const nodes = children(options.target);
488
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
489
+ $$.fragment && $$.fragment.l(nodes);
490
+ nodes.forEach(detach);
491
+ }
492
+ else {
493
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
494
+ $$.fragment && $$.fragment.c();
495
+ }
496
+ if (options.intro)
497
+ transition_in(component.$$.fragment);
498
+ mount_component(component, options.target, options.anchor, options.customElement);
499
+ end_hydrating();
500
+ flush();
501
+ }
502
+ set_current_component(parent_component);
503
+ }
504
+ /**
505
+ * Base class for Svelte components. Used when dev=false.
506
+ */
507
+ class SvelteComponent {
508
+ $destroy() {
509
+ destroy_component(this, 1);
510
+ this.$destroy = noop;
511
+ }
512
+ $on(type, callback) {
513
+ const callbacks = (this.$$.callbacks[type] || (this.$$.callbacks[type] = []));
514
+ callbacks.push(callback);
515
+ return () => {
516
+ const index = callbacks.indexOf(callback);
517
+ if (index !== -1)
518
+ callbacks.splice(index, 1);
519
+ };
520
+ }
521
+ $set($$props) {
522
+ if (this.$$set && !is_empty($$props)) {
523
+ this.$$.skip_bound = true;
524
+ this.$$set($$props);
525
+ this.$$.skip_bound = false;
526
+ }
527
+ }
528
+ }
529
+
530
+ /* src/InstanceView.svelte generated by Svelte v3.49.0 */
531
+
532
+ function add_css(target) {
533
+ append_styles(target, "svelte-8lajst", ".label.svelte-8lajst{margin-right:5px;font-size:10px;color:rgba(0, 0, 0, 0.5);font-variant:small-caps}.text.svelte-8lajst{display:flex;flex-direction:row}.value.svelte-8lajst{font-size:10px}.box.svelte-8lajst{width:min-content;padding:5px;border:0.5px solid rgb(224, 224, 224)}");
534
+ }
535
+
536
+ // (22:2) {#if modelColumn && entry[modelColumn]}
537
+ function create_if_block(ctx) {
538
+ let div;
539
+ let span0;
540
+ let t0;
541
+ let t1;
542
+ let span1;
543
+ let t2_value = /*entry*/ ctx[0][/*modelColumn*/ ctx[1]] + "";
544
+ let t2;
545
+
546
+ return {
547
+ c() {
548
+ div = element("div");
549
+ span0 = element("span");
550
+ t0 = text("output:");
551
+ t1 = space();
552
+ span1 = element("span");
553
+ t2 = text(t2_value);
554
+ this.h();
555
+ },
556
+ l(nodes) {
557
+ div = claim_element(nodes, "DIV", { class: true });
558
+ var div_nodes = children(div);
559
+ span0 = claim_element(div_nodes, "SPAN", { class: true });
560
+ var span0_nodes = children(span0);
561
+ t0 = claim_text(span0_nodes, "output:");
562
+ span0_nodes.forEach(detach);
563
+ t1 = claim_space(div_nodes);
564
+ span1 = claim_element(div_nodes, "SPAN", { class: true });
565
+ var span1_nodes = children(span1);
566
+ t2 = claim_text(span1_nodes, t2_value);
567
+ span1_nodes.forEach(detach);
568
+ div_nodes.forEach(detach);
569
+ this.h();
570
+ },
571
+ h() {
572
+ attr(span0, "class", "label svelte-8lajst");
573
+ attr(span1, "class", "value svelte-8lajst");
574
+ attr(div, "class", "text svelte-8lajst");
575
+ },
576
+ m(target, anchor) {
577
+ insert_hydration(target, div, anchor);
578
+ append_hydration(div, span0);
579
+ append_hydration(span0, t0);
580
+ append_hydration(div, t1);
581
+ append_hydration(div, span1);
582
+ append_hydration(span1, t2);
583
+ },
584
+ p(ctx, dirty) {
585
+ if (dirty & /*entry, modelColumn*/ 3 && t2_value !== (t2_value = /*entry*/ ctx[0][/*modelColumn*/ ctx[1]] + "")) set_data(t2, t2_value);
586
+ },
587
+ d(detaching) {
588
+ if (detaching) detach(div);
589
+ }
590
+ };
591
+ }
592
+
593
+ function create_fragment(ctx) {
594
+ let div1;
595
+ let img;
596
+ let img_src_value;
597
+ let img_alt_value;
598
+ let t0;
599
+ let br;
600
+ let t1;
601
+ let div0;
602
+ let span0;
603
+ let t2;
604
+ let t3;
605
+ let span1;
606
+ let t4_value = /*entry*/ ctx[0][/*labelColumn*/ ctx[2]] + "";
607
+ let t4;
608
+ let t5;
609
+ let if_block = /*modelColumn*/ ctx[1] && /*entry*/ ctx[0][/*modelColumn*/ ctx[1]] && create_if_block(ctx);
610
+
611
+ return {
612
+ c() {
613
+ div1 = element("div");
614
+ img = element("img");
615
+ t0 = space();
616
+ br = element("br");
617
+ t1 = space();
618
+ div0 = element("div");
619
+ span0 = element("span");
620
+ t2 = text("label:");
621
+ t3 = space();
622
+ span1 = element("span");
623
+ t4 = text(t4_value);
624
+ t5 = space();
625
+ if (if_block) if_block.c();
626
+ this.h();
627
+ },
628
+ l(nodes) {
629
+ div1 = claim_element(nodes, "DIV", { class: true });
630
+ var div1_nodes = children(div1);
631
+ img = claim_element(div1_nodes, "IMG", { src: true, alt: true });
632
+ t0 = claim_space(div1_nodes);
633
+ br = claim_element(div1_nodes, "BR", {});
634
+ t1 = claim_space(div1_nodes);
635
+ div0 = claim_element(div1_nodes, "DIV", { class: true });
636
+ var div0_nodes = children(div0);
637
+ span0 = claim_element(div0_nodes, "SPAN", { class: true });
638
+ var span0_nodes = children(span0);
639
+ t2 = claim_text(span0_nodes, "label:");
640
+ span0_nodes.forEach(detach);
641
+ t3 = claim_space(div0_nodes);
642
+ span1 = claim_element(div0_nodes, "SPAN", { class: true });
643
+ var span1_nodes = children(span1);
644
+ t4 = claim_text(span1_nodes, t4_value);
645
+ span1_nodes.forEach(detach);
646
+ div0_nodes.forEach(detach);
647
+ t5 = claim_space(div1_nodes);
648
+ if (if_block) if_block.l(div1_nodes);
649
+ div1_nodes.forEach(detach);
650
+ this.h();
651
+ },
652
+ h() {
653
+ if (!src_url_equal(img.src, img_src_value = "" + (/*dataOrigin*/ ctx[3] + /*entry*/ ctx[0][/*idColumn*/ ctx[4]]))) attr(img, "src", img_src_value);
654
+ attr(img, "alt", img_alt_value = "Image thumbnail for instance " + /*entry*/ ctx[0][/*idColumn*/ ctx[4]]);
655
+ set_style(img, "max-width", `200px`, false);
656
+ attr(span0, "class", "label svelte-8lajst");
657
+ attr(span1, "class", "value svelte-8lajst");
658
+ attr(div0, "class", "text svelte-8lajst");
659
+ attr(div1, "class", "box svelte-8lajst");
660
+ set_style(div1, "background-color", `white`, false);
661
+ },
662
+ m(target, anchor) {
663
+ insert_hydration(target, div1, anchor);
664
+ append_hydration(div1, img);
665
+ append_hydration(div1, t0);
666
+ append_hydration(div1, br);
667
+ append_hydration(div1, t1);
668
+ append_hydration(div1, div0);
669
+ append_hydration(div0, span0);
670
+ append_hydration(span0, t2);
671
+ append_hydration(div0, t3);
672
+ append_hydration(div0, span1);
673
+ append_hydration(span1, t4);
674
+ append_hydration(div1, t5);
675
+ if (if_block) if_block.m(div1, null);
676
+ },
677
+ p(ctx, [dirty]) {
678
+ if (dirty & /*dataOrigin, entry, idColumn*/ 25 && !src_url_equal(img.src, img_src_value = "" + (/*dataOrigin*/ ctx[3] + /*entry*/ ctx[0][/*idColumn*/ ctx[4]]))) {
679
+ attr(img, "src", img_src_value);
680
+ }
681
+
682
+ if (dirty & /*entry, idColumn*/ 17 && img_alt_value !== (img_alt_value = "Image thumbnail for instance " + /*entry*/ ctx[0][/*idColumn*/ ctx[4]])) {
683
+ attr(img, "alt", img_alt_value);
684
+ }
685
+
686
+ if (dirty & /*entry, labelColumn*/ 5 && t4_value !== (t4_value = /*entry*/ ctx[0][/*labelColumn*/ ctx[2]] + "")) set_data(t4, t4_value);
687
+
688
+ if (/*modelColumn*/ ctx[1] && /*entry*/ ctx[0][/*modelColumn*/ ctx[1]]) {
689
+ if (if_block) {
690
+ if_block.p(ctx, dirty);
691
+ } else {
692
+ if_block = create_if_block(ctx);
693
+ if_block.c();
694
+ if_block.m(div1, null);
695
+ }
696
+ } else if (if_block) {
697
+ if_block.d(1);
698
+ if_block = null;
699
+ }
700
+ },
701
+ i: noop,
702
+ o: noop,
703
+ d(detaching) {
704
+ if (detaching) detach(div1);
705
+ if (if_block) if_block.d();
706
+ }
707
+ };
708
+ }
709
+
710
+ function instance($$self, $$props, $$invalidate) {
711
+ let { entry } = $$props;
712
+ let { options } = $$props;
713
+ let { modelColumn } = $$props;
714
+ let { labelColumn } = $$props;
715
+ let { dataColumn } = $$props;
716
+ let { dataOrigin } = $$props;
717
+ let { idColumn } = $$props;
718
+
719
+ $$self.$$set = $$props => {
720
+ if ('entry' in $$props) $$invalidate(0, entry = $$props.entry);
721
+ if ('options' in $$props) $$invalidate(5, options = $$props.options);
722
+ if ('modelColumn' in $$props) $$invalidate(1, modelColumn = $$props.modelColumn);
723
+ if ('labelColumn' in $$props) $$invalidate(2, labelColumn = $$props.labelColumn);
724
+ if ('dataColumn' in $$props) $$invalidate(6, dataColumn = $$props.dataColumn);
725
+ if ('dataOrigin' in $$props) $$invalidate(3, dataOrigin = $$props.dataOrigin);
726
+ if ('idColumn' in $$props) $$invalidate(4, idColumn = $$props.idColumn);
727
+ };
728
+
729
+ return [entry, modelColumn, labelColumn, dataOrigin, idColumn, options, dataColumn];
730
+ }
731
+
732
+ class InstanceView extends SvelteComponent {
733
+ constructor(options) {
734
+ super();
735
+
736
+ init(
737
+ this,
738
+ options,
739
+ instance,
740
+ create_fragment,
741
+ safe_not_equal,
742
+ {
743
+ entry: 0,
744
+ options: 5,
745
+ modelColumn: 1,
746
+ labelColumn: 2,
747
+ dataColumn: 6,
748
+ dataOrigin: 3,
749
+ idColumn: 4
750
+ },
751
+ add_css
752
+ );
753
+ }
754
+ }
755
+
756
+ function getInstance(
757
+ div,
758
+ options,
759
+ entry,
760
+ modelColumn,
761
+ labelColumn,
762
+ dataColumn,
763
+ dataOrigin,
764
+ idColumn
765
+ ) {
766
+ new InstanceView({
767
+ target: div,
768
+ props: {
769
+ entry: entry,
770
+ options: options,
771
+ modelColumn: modelColumn,
772
+ labelColumn: labelColumn,
773
+ dataColumn: dataColumn,
774
+ dataOrigin: dataOrigin,
775
+ idColumn: idColumn,
776
+ },
777
+ hydrate: true,
778
+ });
779
+ }
780
+
781
+ export { getInstance };
Dockerfile ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker
2
+ # you will also find guides on how best to write your Dockerfile
3
+
4
+ FROM python:3.8
5
+
6
+ RUN useradd -m -u 1000 user
7
+ USER user
8
+ # Set home to the user's home directory
9
+ ENV HOME=/home/user \
10
+ PATH=/home/user/.local/bin:$PATH
11
+ WORKDIR $HOME/app
12
+ # Copy the current directory contents into the container at $HOME/app setting the owner to the user
13
+ COPY --chown=user . $HOME/app
14
+ ADD --chown=user ./.zeno_cache $HOME/app/.zeno_cache
15
+ RUN chown user:user -R $HOME/app
16
+
17
+ COPY ./requirements.txt /code/requirements.txt
18
+
19
+ RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
20
+
21
+
22
+ CMD ["zeno", "config.toml"]
config.toml ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ functions = "./"
2
+ view = "image-classification"
3
+ metadata = "./metadata_f.parquet"
4
+ data_path = "https://diffusiondb.m4ke.org/"
5
+ data_column = "image_name"
6
+ label_column = "prompt"
7
+ batch_size = 100000
8
+ port = 7860
9
+ host = "0.0.0.0"
10
+ editable = false
functions.py ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from zeno import distill, metric, ZenoOptions
2
+ from pandas import DataFrame
3
+
4
+
5
+ @distill
6
+ def length(df: DataFrame, ops: ZenoOptions):
7
+ return df["prompt"].str.len()
8
+
9
+
10
+ @metric
11
+ def avg_image_nswf(df: DataFrame, ops: ZenoOptions):
12
+ return float(df["image_nsfw"].dropna().mean())
13
+
14
+
15
+ @metric
16
+ def avg_prompt_nsfw(df: DataFrame, ops: ZenoOptions):
17
+ return float(df["prompt_nsfw"].dropna().mean())
metadata_f.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:73e54fc07b6b870103ae969c7fe4b9e671aa84a04f45fa06d338e75d165c07aa
3
+ size 201460442
requirements.txt ADDED
@@ -0,0 +1,2 @@
 
 
1
+ zenoml
2
+ transformers