jbilcke-hf HF staff commited on
Commit
44fe180
·
1 Parent(s): 702b7b3

add a cache system following Julien's suggestion

Browse files
package-lock.json CHANGED
@@ -9,6 +9,7 @@
9
  "version": "1.0.0",
10
  "license": "Apache License",
11
  "dependencies": {
 
12
  "@gorgonjs/gorgon": "^1.4.1",
13
  "@gradio/client": "^0.1.4",
14
  "@huggingface/inference": "^2.6.1",
@@ -75,6 +76,17 @@
75
  "node": ">=12"
76
  }
77
  },
 
 
 
 
 
 
 
 
 
 
 
78
  "node_modules/@gorgonjs/gorgon": {
79
  "version": "1.4.1",
80
  "resolved": "https://registry.npmjs.org/@gorgonjs/gorgon/-/gorgon-1.4.1.tgz",
@@ -212,6 +224,38 @@
212
  "@jridgewell/sourcemap-codec": "^1.4.10"
213
  }
214
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
215
  "node_modules/@npmcli/fs": {
216
  "version": "3.1.0",
217
  "resolved": "https://registry.npmjs.org/@npmcli/fs/-/fs-3.1.0.tgz",
@@ -811,6 +855,17 @@
811
  "concat-map": "0.0.1"
812
  }
813
  },
 
 
 
 
 
 
 
 
 
 
 
814
  "node_modules/buffer": {
815
  "version": "5.7.1",
816
  "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz",
@@ -1696,6 +1751,21 @@
1696
  "resolved": "https://registry.npmjs.org/fast-fifo/-/fast-fifo-1.3.0.tgz",
1697
  "integrity": "sha512-IgfweLvEpwyA4WgiQe9Nx6VV2QkML2NkvZnk1oKnIzXgXdWxuhF7zw4DvLTPZJn6PIUneiAXPF24QmoEqHTjyw=="
1698
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1699
  "node_modules/fast-json-stable-stringify": {
1700
  "version": "2.1.0",
1701
  "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz",
@@ -1706,6 +1776,14 @@
1706
  "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz",
1707
  "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw=="
1708
  },
 
 
 
 
 
 
 
 
1709
  "node_modules/fd-slicer": {
1710
  "version": "1.1.0",
1711
  "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz",
@@ -1901,6 +1979,17 @@
1901
  "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz",
1902
  "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw=="
1903
  },
 
 
 
 
 
 
 
 
 
 
 
1904
  "node_modules/finalhandler": {
1905
  "version": "1.2.0",
1906
  "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.2.0.tgz",
@@ -2386,6 +2475,17 @@
2386
  "resolved": "https://registry.npmjs.org/glob-option-error/-/glob-option-error-1.0.0.tgz",
2387
  "integrity": "sha512-AD7lbWbwF2Ii9gBQsQIOEzwuqP/jsnyvK27/3JDq1kn/JyfDtYI6AWz3ZQwcPuQdHSBcFh+A2yT/SEep27LOGg=="
2388
  },
 
 
 
 
 
 
 
 
 
 
 
2389
  "node_modules/glsl-shader-name": {
2390
  "version": "1.0.0",
2391
  "resolved": "https://registry.npmjs.org/glsl-shader-name/-/glsl-shader-name-1.0.0.tgz",
@@ -2733,6 +2833,14 @@
2733
  "node": ">=8"
2734
  }
2735
  },
 
 
 
 
 
 
 
 
2736
  "node_modules/is-fullwidth-code-point": {
2737
  "version": "3.0.0",
2738
  "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
@@ -2741,11 +2849,30 @@
2741
  "node": ">=8"
2742
  }
2743
  },
 
 
 
 
 
 
 
 
 
 
 
2744
  "node_modules/is-lambda": {
2745
  "version": "1.0.1",
2746
  "resolved": "https://registry.npmjs.org/is-lambda/-/is-lambda-1.0.1.tgz",
2747
  "integrity": "sha512-z7CMFGNrENq5iFB9Bqo64Xk6Y9sg+epq1myIcdHaGnbMTYOxvzsEtdYqQUylB7LxfkvgrrjP32T6Ywciio9UIQ=="
2748
  },
 
 
 
 
 
 
 
 
2749
  "node_modules/is-plain-obj": {
2750
  "version": "1.1.0",
2751
  "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-1.1.0.tgz",
@@ -3035,6 +3162,14 @@
3035
  "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz",
3036
  "integrity": "sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w=="
3037
  },
 
 
 
 
 
 
 
 
3038
  "node_modules/methods": {
3039
  "version": "1.1.2",
3040
  "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz",
@@ -3043,6 +3178,18 @@
3043
  "node": ">= 0.6"
3044
  }
3045
  },
 
 
 
 
 
 
 
 
 
 
 
 
3046
  "node_modules/mime": {
3047
  "version": "1.6.0",
3048
  "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz",
@@ -3806,6 +3953,17 @@
3806
  "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz",
3807
  "integrity": "sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow=="
3808
  },
 
 
 
 
 
 
 
 
 
 
 
3809
  "node_modules/pngjs": {
3810
  "version": "3.4.0",
3811
  "resolved": "https://registry.npmjs.org/pngjs/-/pngjs-3.4.0.tgz",
@@ -4054,6 +4212,25 @@
4054
  "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz",
4055
  "integrity": "sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ=="
4056
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4057
  "node_modules/queue-tick": {
4058
  "version": "1.0.1",
4059
  "resolved": "https://registry.npmjs.org/queue-tick/-/queue-tick-1.0.1.tgz",
@@ -4209,6 +4386,15 @@
4209
  "node": ">= 4"
4210
  }
4211
  },
 
 
 
 
 
 
 
 
 
4212
  "node_modules/rimraf": {
4213
  "version": "3.0.2",
4214
  "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz",
@@ -4246,6 +4432,28 @@
4246
  "rimraf": "bin.js"
4247
  }
4248
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4249
  "node_modules/safe-buffer": {
4250
  "version": "5.2.1",
4251
  "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
@@ -4816,6 +5024,17 @@
4816
  "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz",
4817
  "integrity": "sha512-ev2QzSzWPYmy9GuqfIVildA4OdcGLeFZQrq5ys6RtiuF+RQQiZWr8TZNyAcuVXyQRYfEO+MsoB/1BuQVhOJuoQ=="
4818
  },
 
 
 
 
 
 
 
 
 
 
 
4819
  "node_modules/toidentifier": {
4820
  "version": "1.0.1",
4821
  "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz",
 
9
  "version": "1.0.0",
10
  "license": "Apache License",
11
  "dependencies": {
12
+ "@gorgonjs/file-provider": "^1.4.1",
13
  "@gorgonjs/gorgon": "^1.4.1",
14
  "@gradio/client": "^0.1.4",
15
  "@huggingface/inference": "^2.6.1",
 
76
  "node": ">=12"
77
  }
78
  },
79
+ "node_modules/@gorgonjs/file-provider": {
80
+ "version": "1.4.1",
81
+ "resolved": "https://registry.npmjs.org/@gorgonjs/file-provider/-/file-provider-1.4.1.tgz",
82
+ "integrity": "sha512-pDhD7KvFmukHkfL69AHL/hpu5GFBJX9lUlJIll7K6yUxdZmJcXW7Egy7o3XPDff7Lfn8hftKNVUngfETdTTXAw==",
83
+ "dependencies": {
84
+ "fast-glob": "^3.3.0"
85
+ },
86
+ "peerDependencies": {
87
+ "@gorgonjs/gorgon": "^1.4.0"
88
+ }
89
+ },
90
  "node_modules/@gorgonjs/gorgon": {
91
  "version": "1.4.1",
92
  "resolved": "https://registry.npmjs.org/@gorgonjs/gorgon/-/gorgon-1.4.1.tgz",
 
224
  "@jridgewell/sourcemap-codec": "^1.4.10"
225
  }
226
  },
227
+ "node_modules/@nodelib/fs.scandir": {
228
+ "version": "2.1.5",
229
+ "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz",
230
+ "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==",
231
+ "dependencies": {
232
+ "@nodelib/fs.stat": "2.0.5",
233
+ "run-parallel": "^1.1.9"
234
+ },
235
+ "engines": {
236
+ "node": ">= 8"
237
+ }
238
+ },
239
+ "node_modules/@nodelib/fs.stat": {
240
+ "version": "2.0.5",
241
+ "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz",
242
+ "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==",
243
+ "engines": {
244
+ "node": ">= 8"
245
+ }
246
+ },
247
+ "node_modules/@nodelib/fs.walk": {
248
+ "version": "1.2.8",
249
+ "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz",
250
+ "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==",
251
+ "dependencies": {
252
+ "@nodelib/fs.scandir": "2.1.5",
253
+ "fastq": "^1.6.0"
254
+ },
255
+ "engines": {
256
+ "node": ">= 8"
257
+ }
258
+ },
259
  "node_modules/@npmcli/fs": {
260
  "version": "3.1.0",
261
  "resolved": "https://registry.npmjs.org/@npmcli/fs/-/fs-3.1.0.tgz",
 
855
  "concat-map": "0.0.1"
856
  }
857
  },
858
+ "node_modules/braces": {
859
+ "version": "3.0.2",
860
+ "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz",
861
+ "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==",
862
+ "dependencies": {
863
+ "fill-range": "^7.0.1"
864
+ },
865
+ "engines": {
866
+ "node": ">=8"
867
+ }
868
+ },
869
  "node_modules/buffer": {
870
  "version": "5.7.1",
871
  "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz",
 
1751
  "resolved": "https://registry.npmjs.org/fast-fifo/-/fast-fifo-1.3.0.tgz",
1752
  "integrity": "sha512-IgfweLvEpwyA4WgiQe9Nx6VV2QkML2NkvZnk1oKnIzXgXdWxuhF7zw4DvLTPZJn6PIUneiAXPF24QmoEqHTjyw=="
1753
  },
1754
+ "node_modules/fast-glob": {
1755
+ "version": "3.3.1",
1756
+ "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.1.tgz",
1757
+ "integrity": "sha512-kNFPyjhh5cKjrUltxs+wFx+ZkbRaxxmZ+X0ZU31SOsxCEtP9VPgtq2teZw1DebupL5GmDaNQ6yKMMVcM41iqDg==",
1758
+ "dependencies": {
1759
+ "@nodelib/fs.stat": "^2.0.2",
1760
+ "@nodelib/fs.walk": "^1.2.3",
1761
+ "glob-parent": "^5.1.2",
1762
+ "merge2": "^1.3.0",
1763
+ "micromatch": "^4.0.4"
1764
+ },
1765
+ "engines": {
1766
+ "node": ">=8.6.0"
1767
+ }
1768
+ },
1769
  "node_modules/fast-json-stable-stringify": {
1770
  "version": "2.1.0",
1771
  "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz",
 
1776
  "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz",
1777
  "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw=="
1778
  },
1779
+ "node_modules/fastq": {
1780
+ "version": "1.15.0",
1781
+ "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.15.0.tgz",
1782
+ "integrity": "sha512-wBrocU2LCXXa+lWBt8RoIRD89Fi8OdABODa/kEnyeyjS5aZO5/GNvI5sEINADqP/h8M29UHTHUb53sUu5Ihqdw==",
1783
+ "dependencies": {
1784
+ "reusify": "^1.0.4"
1785
+ }
1786
+ },
1787
  "node_modules/fd-slicer": {
1788
  "version": "1.1.0",
1789
  "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz",
 
1979
  "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz",
1980
  "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw=="
1981
  },
1982
+ "node_modules/fill-range": {
1983
+ "version": "7.0.1",
1984
+ "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz",
1985
+ "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==",
1986
+ "dependencies": {
1987
+ "to-regex-range": "^5.0.1"
1988
+ },
1989
+ "engines": {
1990
+ "node": ">=8"
1991
+ }
1992
+ },
1993
  "node_modules/finalhandler": {
1994
  "version": "1.2.0",
1995
  "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.2.0.tgz",
 
2475
  "resolved": "https://registry.npmjs.org/glob-option-error/-/glob-option-error-1.0.0.tgz",
2476
  "integrity": "sha512-AD7lbWbwF2Ii9gBQsQIOEzwuqP/jsnyvK27/3JDq1kn/JyfDtYI6AWz3ZQwcPuQdHSBcFh+A2yT/SEep27LOGg=="
2477
  },
2478
+ "node_modules/glob-parent": {
2479
+ "version": "5.1.2",
2480
+ "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz",
2481
+ "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==",
2482
+ "dependencies": {
2483
+ "is-glob": "^4.0.1"
2484
+ },
2485
+ "engines": {
2486
+ "node": ">= 6"
2487
+ }
2488
+ },
2489
  "node_modules/glsl-shader-name": {
2490
  "version": "1.0.0",
2491
  "resolved": "https://registry.npmjs.org/glsl-shader-name/-/glsl-shader-name-1.0.0.tgz",
 
2833
  "node": ">=8"
2834
  }
2835
  },
2836
+ "node_modules/is-extglob": {
2837
+ "version": "2.1.1",
2838
+ "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz",
2839
+ "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==",
2840
+ "engines": {
2841
+ "node": ">=0.10.0"
2842
+ }
2843
+ },
2844
  "node_modules/is-fullwidth-code-point": {
2845
  "version": "3.0.0",
2846
  "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
 
2849
  "node": ">=8"
2850
  }
2851
  },
2852
+ "node_modules/is-glob": {
2853
+ "version": "4.0.3",
2854
+ "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz",
2855
+ "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==",
2856
+ "dependencies": {
2857
+ "is-extglob": "^2.1.1"
2858
+ },
2859
+ "engines": {
2860
+ "node": ">=0.10.0"
2861
+ }
2862
+ },
2863
  "node_modules/is-lambda": {
2864
  "version": "1.0.1",
2865
  "resolved": "https://registry.npmjs.org/is-lambda/-/is-lambda-1.0.1.tgz",
2866
  "integrity": "sha512-z7CMFGNrENq5iFB9Bqo64Xk6Y9sg+epq1myIcdHaGnbMTYOxvzsEtdYqQUylB7LxfkvgrrjP32T6Ywciio9UIQ=="
2867
  },
2868
+ "node_modules/is-number": {
2869
+ "version": "7.0.0",
2870
+ "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz",
2871
+ "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==",
2872
+ "engines": {
2873
+ "node": ">=0.12.0"
2874
+ }
2875
+ },
2876
  "node_modules/is-plain-obj": {
2877
  "version": "1.1.0",
2878
  "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-1.1.0.tgz",
 
3162
  "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz",
3163
  "integrity": "sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w=="
3164
  },
3165
+ "node_modules/merge2": {
3166
+ "version": "1.4.1",
3167
+ "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz",
3168
+ "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==",
3169
+ "engines": {
3170
+ "node": ">= 8"
3171
+ }
3172
+ },
3173
  "node_modules/methods": {
3174
  "version": "1.1.2",
3175
  "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz",
 
3178
  "node": ">= 0.6"
3179
  }
3180
  },
3181
+ "node_modules/micromatch": {
3182
+ "version": "4.0.5",
3183
+ "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz",
3184
+ "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==",
3185
+ "dependencies": {
3186
+ "braces": "^3.0.2",
3187
+ "picomatch": "^2.3.1"
3188
+ },
3189
+ "engines": {
3190
+ "node": ">=8.6"
3191
+ }
3192
+ },
3193
  "node_modules/mime": {
3194
  "version": "1.6.0",
3195
  "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz",
 
3953
  "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz",
3954
  "integrity": "sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow=="
3955
  },
3956
+ "node_modules/picomatch": {
3957
+ "version": "2.3.1",
3958
+ "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz",
3959
+ "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==",
3960
+ "engines": {
3961
+ "node": ">=8.6"
3962
+ },
3963
+ "funding": {
3964
+ "url": "https://github.com/sponsors/jonschlinkert"
3965
+ }
3966
+ },
3967
  "node_modules/pngjs": {
3968
  "version": "3.4.0",
3969
  "resolved": "https://registry.npmjs.org/pngjs/-/pngjs-3.4.0.tgz",
 
4212
  "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz",
4213
  "integrity": "sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ=="
4214
  },
4215
+ "node_modules/queue-microtask": {
4216
+ "version": "1.2.3",
4217
+ "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz",
4218
+ "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==",
4219
+ "funding": [
4220
+ {
4221
+ "type": "github",
4222
+ "url": "https://github.com/sponsors/feross"
4223
+ },
4224
+ {
4225
+ "type": "patreon",
4226
+ "url": "https://www.patreon.com/feross"
4227
+ },
4228
+ {
4229
+ "type": "consulting",
4230
+ "url": "https://feross.org/support"
4231
+ }
4232
+ ]
4233
+ },
4234
  "node_modules/queue-tick": {
4235
  "version": "1.0.1",
4236
  "resolved": "https://registry.npmjs.org/queue-tick/-/queue-tick-1.0.1.tgz",
 
4386
  "node": ">= 4"
4387
  }
4388
  },
4389
+ "node_modules/reusify": {
4390
+ "version": "1.0.4",
4391
+ "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz",
4392
+ "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==",
4393
+ "engines": {
4394
+ "iojs": ">=1.0.0",
4395
+ "node": ">=0.10.0"
4396
+ }
4397
+ },
4398
  "node_modules/rimraf": {
4399
  "version": "3.0.2",
4400
  "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz",
 
4432
  "rimraf": "bin.js"
4433
  }
4434
  },
4435
+ "node_modules/run-parallel": {
4436
+ "version": "1.2.0",
4437
+ "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz",
4438
+ "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==",
4439
+ "funding": [
4440
+ {
4441
+ "type": "github",
4442
+ "url": "https://github.com/sponsors/feross"
4443
+ },
4444
+ {
4445
+ "type": "patreon",
4446
+ "url": "https://www.patreon.com/feross"
4447
+ },
4448
+ {
4449
+ "type": "consulting",
4450
+ "url": "https://feross.org/support"
4451
+ }
4452
+ ],
4453
+ "dependencies": {
4454
+ "queue-microtask": "^1.2.2"
4455
+ }
4456
+ },
4457
  "node_modules/safe-buffer": {
4458
  "version": "5.2.1",
4459
  "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
 
5024
  "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz",
5025
  "integrity": "sha512-ev2QzSzWPYmy9GuqfIVildA4OdcGLeFZQrq5ys6RtiuF+RQQiZWr8TZNyAcuVXyQRYfEO+MsoB/1BuQVhOJuoQ=="
5026
  },
5027
+ "node_modules/to-regex-range": {
5028
+ "version": "5.0.1",
5029
+ "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",
5030
+ "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==",
5031
+ "dependencies": {
5032
+ "is-number": "^7.0.0"
5033
+ },
5034
+ "engines": {
5035
+ "node": ">=8.0"
5036
+ }
5037
+ },
5038
  "node_modules/toidentifier": {
5039
  "version": "1.0.1",
5040
  "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz",
package.json CHANGED
@@ -16,6 +16,7 @@
16
  "author": "Julian Bilcke <[email protected]>",
17
  "license": "Apache License",
18
  "dependencies": {
 
19
  "@gorgonjs/gorgon": "^1.4.1",
20
  "@gradio/client": "^0.1.4",
21
  "@huggingface/inference": "^2.6.1",
 
16
  "author": "Julian Bilcke <[email protected]>",
17
  "license": "Apache License",
18
  "dependencies": {
19
+ "@gorgonjs/file-provider": "^1.4.1",
20
  "@gorgonjs/gorgon": "^1.4.1",
21
  "@gradio/client": "^0.1.4",
22
  "@huggingface/inference": "^2.6.1",
src/config.mts CHANGED
@@ -2,6 +2,7 @@ import path from "node:path"
2
 
3
  export const storagePath = `${process.env.VC_STORAGE_PATH || './sandbox'}`
4
 
 
5
  export const metadataDirPath = path.join(storagePath, "metadata")
6
  export const pendingMetadataDirFilePath = path.join(metadataDirPath, "pending")
7
  export const completedMetadataDirFilePath = path.join(metadataDirPath, "completed")
@@ -10,5 +11,9 @@ export const filesDirPath = path.join(storagePath, "files")
10
  export const pendingFilesDirFilePath = path.join(filesDirPath, "pending")
11
  export const completedFilesDirFilePath = path.join(filesDirPath, "completed")
12
 
 
 
 
 
13
  export const shotFormatVersion = 1
14
  export const sequenceFormatVersion = 1
 
2
 
3
  export const storagePath = `${process.env.VC_STORAGE_PATH || './sandbox'}`
4
 
5
+ // those are persistent storage (we want to keep the data for months/years)
6
  export const metadataDirPath = path.join(storagePath, "metadata")
7
  export const pendingMetadataDirFilePath = path.join(metadataDirPath, "pending")
8
  export const completedMetadataDirFilePath = path.join(metadataDirPath, "completed")
 
11
  export const pendingFilesDirFilePath = path.join(filesDirPath, "pending")
12
  export const completedFilesDirFilePath = path.join(filesDirPath, "completed")
13
 
14
+ // this is a semi-persistent storage (we want to renew it from time to time)
15
+ export const cacheDirPath = path.join(storagePath, "cache")
16
+ export const renderedDirFilePath = path.join(filesDirPath, "rendered")
17
+
18
  export const shotFormatVersion = 1
19
  export const sequenceFormatVersion = 1
src/index.mts CHANGED
@@ -1,10 +1,11 @@
1
  import { createReadStream, existsSync } from "node:fs"
2
  import path from "node:path"
3
 
4
- import { v4 as uuidv4, validate as uuidValidate } from "uuid"
5
  import express from "express"
6
 
7
  import { Video, VideoStatus, VideoAPIRequest, RenderRequest, RenderedScene } from "./types.mts"
 
8
  import { parseVideoRequest } from "./utils/parseVideoRequest.mts"
9
  import { savePendingVideo } from "./scheduler/savePendingVideo.mts"
10
  import { getVideo } from "./scheduler/getVideo.mts"
@@ -19,9 +20,9 @@ import { hasValidAuthorization } from "./utils/hasValidAuthorization.mts"
19
  import { getAllVideosForOwner } from "./scheduler/getAllVideosForOwner.mts"
20
  import { initFolders } from "./initFolders.mts"
21
  import { sortVideosByYoungestFirst } from "./utils/sortVideosByYoungestFirst.mts"
22
- import { generateVideo } from "./production/generateVideo.mts"
23
- import { generateSeed } from "./utils/generateSeed.mts"
24
  import { getRenderedScene, renderScene } from "./production/renderScene.mts"
 
 
25
 
26
  initFolders()
27
  // to disable all processing (eg. to debug)
@@ -38,8 +39,10 @@ let isRendering = false
38
  // a "fast track" pipeline
39
  app.post("/render", async (req, res) => {
40
 
41
- const request = req.body as RenderRequest
42
  console.log(req.body)
 
 
 
43
  if (!request.prompt) {
44
  console.log("Invalid prompt")
45
  res.status(400)
@@ -48,6 +51,16 @@ app.post("/render", async (req, res) => {
48
  return
49
  }
50
 
 
 
 
 
 
 
 
 
 
 
51
  let response: RenderedScene = {
52
  renderId: "",
53
  status: "pending",
@@ -56,7 +69,7 @@ app.post("/render", async (req, res) => {
56
  error: "",
57
  segments: []
58
  }
59
-
60
  try {
61
  response = await renderScene(request)
62
  } catch (err) {
@@ -98,6 +111,16 @@ app.get("/render/:renderId", async (req, res) => {
98
  return
99
  }
100
 
 
 
 
 
 
 
 
 
 
 
101
  let response: RenderedScene = {
102
  renderId: "",
103
  status: "pending",
@@ -135,52 +158,6 @@ app.get("/render/:renderId", async (req, res) => {
135
  }
136
  })
137
 
138
-
139
- // a "fast track" pipeline
140
- /*
141
- app.post("/segment", async (req, res) => {
142
-
143
- const request = req.body as RenderRequest
144
- console.log(req.body)
145
-
146
- let result: RenderedScene = {
147
- assetUrl: "",
148
- maskUrl: "",
149
- error: "",
150
- segments: []
151
- }
152
-
153
- try {
154
- result = await renderScene(request)
155
- } catch (err) {
156
- // console.log("failed to render scene!")
157
- result.error = `failed to render scene: ${err}`
158
- }
159
-
160
- if (result.error === "already rendering") {
161
- console.log("server busy")
162
- res.status(200)
163
- res.write(JSON.stringify({ url: "", error: result.error }))
164
- res.end()
165
- return
166
- } else if (result.error.length > 0) {
167
- // console.log("server error")
168
- res.status(500)
169
- res.write(JSON.stringify({ url: "", error: result.error }))
170
- res.end()
171
- return
172
- } else {
173
- // console.log("all good")
174
- res.status(200)
175
- res.write(JSON.stringify(result))
176
- res.end()
177
- return
178
- }
179
- })
180
- */
181
-
182
-
183
-
184
  app.post("/:ownerId", async (req, res) => {
185
  const request = req.body as VideoAPIRequest
186
 
 
1
  import { createReadStream, existsSync } from "node:fs"
2
  import path from "node:path"
3
 
4
+ import { validate as uuidValidate } from "uuid"
5
  import express from "express"
6
 
7
  import { Video, VideoStatus, VideoAPIRequest, RenderRequest, RenderedScene } from "./types.mts"
8
+
9
  import { parseVideoRequest } from "./utils/parseVideoRequest.mts"
10
  import { savePendingVideo } from "./scheduler/savePendingVideo.mts"
11
  import { getVideo } from "./scheduler/getVideo.mts"
 
20
  import { getAllVideosForOwner } from "./scheduler/getAllVideosForOwner.mts"
21
  import { initFolders } from "./initFolders.mts"
22
  import { sortVideosByYoungestFirst } from "./utils/sortVideosByYoungestFirst.mts"
 
 
23
  import { getRenderedScene, renderScene } from "./production/renderScene.mts"
24
+ import { parseRenderRequest } from "./utils/parseRenderRequest.mts"
25
+ import { loadRenderedSceneFromCache } from "./utils/loadRenderedSceneFromCache.mts"
26
 
27
  initFolders()
28
  // to disable all processing (eg. to debug)
 
39
  // a "fast track" pipeline
40
  app.post("/render", async (req, res) => {
41
 
 
42
  console.log(req.body)
43
+
44
+ const request = parseRenderRequest(req.body as RenderRequest)
45
+
46
  if (!request.prompt) {
47
  console.log("Invalid prompt")
48
  res.status(400)
 
51
  return
52
  }
53
 
54
+ try {
55
+ const cached = await loadRenderedSceneFromCache(request)
56
+ const cachedJson = JSON.stringify(cached)
57
+ res.status(200)
58
+ res.write(cachedJson)
59
+ res.end()
60
+ } catch (err) {
61
+ // move along
62
+ }
63
+
64
  let response: RenderedScene = {
65
  renderId: "",
66
  status: "pending",
 
69
  error: "",
70
  segments: []
71
  }
72
+
73
  try {
74
  response = await renderScene(request)
75
  } catch (err) {
 
111
  return
112
  }
113
 
114
+ try {
115
+ const cached = await loadRenderedSceneFromCache(undefined, renderId)
116
+ const cachedJson = JSON.stringify(cached)
117
+ res.status(200)
118
+ res.write(cachedJson)
119
+ res.end()
120
+ } catch (err) {
121
+ // move along
122
+ }
123
+
124
  let response: RenderedScene = {
125
  renderId: "",
126
  status: "pending",
 
158
  }
159
  })
160
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
161
  app.post("/:ownerId", async (req, res) => {
162
  const request = req.body as VideoAPIRequest
163
 
src/production/renderScene.mts CHANGED
@@ -4,6 +4,7 @@ import { RenderedScene, RenderRequest } from "../types.mts"
4
  import { generateSeed } from "../utils/generateSeed.mts"
5
  import { getValidNumber } from "../utils/getValidNumber.mts"
6
  import { renderPipeline } from "./renderPipeline.mts"
 
7
 
8
  const cache: Record<string, RenderedScene> = {}
9
  const cacheQueue: string[] = []
@@ -11,23 +12,8 @@ const maxCacheSize = 1000
11
 
12
  export async function renderScene(request: RenderRequest): Promise<RenderedScene> {
13
  // const key = getCacheKey(scene)
14
- const renderId = uuidv4()
15
-
16
- request.nbFrames = getValidNumber(request.nbFrames, 1, 24, 16)
17
-
18
- const isVideo = request?.nbFrames === 1
19
-
20
- // important: we need a consistent seed for our multiple rendering passes
21
- request.seed = getValidNumber(request.seed, 0, 2147483647, generateSeed())
22
- request.nbSteps = getValidNumber(request.nbSteps, 5, 50, 10)
23
 
24
- if (isVideo) {
25
- request.width = getValidNumber(request.width, 256, 1024, 1024)
26
- request.height = getValidNumber(request.height, 256, 1024, 512)
27
- } else {
28
- request.width = getValidNumber(request.width, 256, 1280, 576)
29
- request.height = getValidNumber(request.height, 256, 720, 320)
30
- }
31
 
32
  const response: RenderedScene = {
33
  renderId,
@@ -59,4 +45,5 @@ export async function getRenderedScene(renderId: string): Promise<RenderedScene>
59
  throw new Error(`couldn't find any rendered scene with renderId ${renderId}`)
60
  }
61
  return cache[renderId]
62
- }
 
 
4
  import { generateSeed } from "../utils/generateSeed.mts"
5
  import { getValidNumber } from "../utils/getValidNumber.mts"
6
  import { renderPipeline } from "./renderPipeline.mts"
7
+ import { getValidBoolean } from "../utils/getValidBoolean.mts"
8
 
9
  const cache: Record<string, RenderedScene> = {}
10
  const cacheQueue: string[] = []
 
12
 
13
  export async function renderScene(request: RenderRequest): Promise<RenderedScene> {
14
  // const key = getCacheKey(scene)
 
 
 
 
 
 
 
 
 
15
 
16
+ const renderId = uuidv4()
 
 
 
 
 
 
17
 
18
  const response: RenderedScene = {
19
  renderId,
 
45
  throw new Error(`couldn't find any rendered scene with renderId ${renderId}`)
46
  }
47
  return cache[renderId]
48
+ }
49
+
src/types.mts CHANGED
@@ -299,6 +299,8 @@ export interface RenderRequest {
299
  height: number
300
 
301
  projection: ProjectionMode
 
 
302
  }
303
 
304
  export interface ImageSegmentationRequest {
@@ -325,6 +327,12 @@ export interface RenderedScene {
325
  segments: ImageSegment[]
326
  }
327
 
 
 
 
 
 
 
328
  // note: for video generation we are always going to have slow jobs,
329
  // because we need multiple seconds, minutes, hours.. of video + audio
330
  // but for rendering we aim at shorter delays, less than 45 seconds
 
299
  height: number
300
 
301
  projection: ProjectionMode
302
+
303
+ useCache: boolean
304
  }
305
 
306
  export interface ImageSegmentationRequest {
 
327
  segments: ImageSegment[]
328
  }
329
 
330
+ export interface RenderCache {
331
+ id: string
332
+ hash: string
333
+ scene: RenderedScene
334
+ }
335
+
336
  // note: for video generation we are always going to have slow jobs,
337
  // because we need multiple seconds, minutes, hours.. of video + audio
338
  // but for rendering we aim at shorter delays, less than 45 seconds
src/utils/computeSha256.mts ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { createHash } from 'node:crypto'
2
+
3
+ /**
4
+ * Returns a SHA256 hash using SHA-3 for the given `content`.
5
+ *
6
+ * @see https://en.wikipedia.org/wiki/SHA-3
7
+ *
8
+ * @param {String} content
9
+ *
10
+ * @returns {String}
11
+ */
12
+ export function computeSha256(strContent: string) {
13
+ return createHash('sha3-256').update(strContent).digest('hex')
14
+ }
src/utils/getValidBoolean.mts ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ export const getValidBoolean = (something: any, defaultValue: boolean) => {
2
+ if (typeof something === "boolean") {
3
+ return something
4
+ }
5
+
6
+ const strValue = `${something || defaultValue}`.toLowerCase()
7
+
8
+ return strValue === "true" || strValue === "1" || strValue === "on"
9
+ }
src/utils/loadRenderedSceneFromCache.mts ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { promises as fs } from "node:fs"
2
+ import path from "node:path"
3
+
4
+ import { RenderRequest, RenderedScene } from "../types.mts"
5
+ import { renderedDirFilePath } from "../config.mts"
6
+ import { computeSha256 } from "./computeSha256.mts"
7
+
8
+ export async function loadRenderedSceneFromCache(request?: RenderRequest, id?: string): Promise<RenderedScene> {
9
+
10
+ let pattern = ""
11
+
12
+ if (request?.prompt) {
13
+ try {
14
+ const requestJson = JSON.stringify(request)
15
+ const hash = computeSha256(requestJson)
16
+ pattern = `hash_${hash}`
17
+ } catch (err) {
18
+ }
19
+ } else if (id) {
20
+ pattern = `id_${id}`
21
+ }
22
+
23
+ if (!pattern) {
24
+ throw new Error("invalid request or id")
25
+ }
26
+
27
+ for (const cachedFile of await fs.readdir(renderedDirFilePath)) {
28
+
29
+ if (cachedFile.includes(pattern)) {
30
+
31
+ const cacheFilePath = path.join(renderedDirFilePath, cachedFile)
32
+
33
+ const scene = JSON.parse(
34
+ await fs.readFile(cacheFilePath, 'utf8')
35
+ ) as RenderedScene
36
+
37
+ if (!scene.assetUrl) {
38
+ throw new Error("there is something wrong with the cached rendered scene (url is empty)")
39
+ }
40
+
41
+ if (!scene.assetUrl) {
42
+ throw new Error("there is something wrong with the cached rendered scene (statis is not completed)")
43
+ }
44
+
45
+ return scene
46
+ }
47
+ }
48
+
49
+ throw new Error("couldn't find a cached scene with id entry")
50
+ }
src/utils/parseRenderRequest.mts ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { RenderRequest } from "../types.mts"
2
+ import { generateSeed } from "./generateSeed.mts"
3
+ import { getValidBoolean } from "./getValidBoolean.mts"
4
+ import { getValidNumber } from "./getValidNumber.mts"
5
+
6
+ export function parseRenderRequest(request: RenderRequest) {
7
+
8
+ try {
9
+ request.nbFrames = getValidNumber(request.nbFrames, 1, 24, 16)
10
+
11
+ const isVideo = request?.nbFrames === 1
12
+
13
+ // important: we need a consistent seed for our multiple rendering passes
14
+ request.seed = getValidNumber(request.seed, 0, 2147483647, generateSeed())
15
+ request.nbSteps = getValidNumber(request.nbSteps, 5, 50, 10)
16
+
17
+ if (isVideo) {
18
+ request.width = getValidNumber(request.width, 256, 1024, 1024)
19
+ request.height = getValidNumber(request.height, 256, 1024, 512)
20
+ } else {
21
+ request.width = getValidNumber(request.width, 256, 1280, 576)
22
+ request.height = getValidNumber(request.height, 256, 720, 320)
23
+ }
24
+
25
+ request.useCache = getValidBoolean(request.useCache, false)
26
+ } catch (err) {
27
+ console.error(`failed to parse the render request: ${err}`)
28
+ }
29
+ return request
30
+ }
src/utils/saveRenderedSceneToCache.mts ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { promises as fs } from "node:fs"
2
+ import path from "node:path"
3
+
4
+ import { RenderRequest, RenderedScene } from "../types.mts"
5
+ import { renderedDirFilePath } from "../config.mts"
6
+
7
+ import { computeSha256 } from "./computeSha256.mts"
8
+
9
+ export async function saveRenderedSceneToCache(
10
+ request: RenderRequest,
11
+ scene: RenderedScene
12
+ ): Promise<RenderedScene> {
13
+ if (scene.status !== "completed") {
14
+ throw new Error("sorry, it only makes sense to cache a *completed* scene, not a pending or failed one.")
15
+ }
16
+
17
+ const requestJson = JSON.stringify(request)
18
+ const hash = computeSha256(requestJson)
19
+ const id = scene.renderId
20
+
21
+ const cacheFileName = `hash_${hash}_id_${id}.json`
22
+ const cacheFilePath = path.join(renderedDirFilePath, cacheFileName)
23
+
24
+ const renderedSceneJson = JSON.stringify(scene)
25
+
26
+ await fs.writeFile(cacheFilePath, renderedSceneJson, "utf8")
27
+
28
+ return scene
29
+ }