jbilcke-hf HF staff commited on
Commit
9c9e5d3
β€’
0 Parent(s):

initial commit

Browse files
.dockerignore ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ node_modules
2
+ npm-debug.log
3
+ models
.gitignore ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ node_modules
2
+ *.log
3
+ *.bin
4
+ .DS_Store
5
+ .venv
6
+ models/
.nvmrc ADDED
@@ -0,0 +1 @@
 
 
1
+ v18.16.0
Dockerfile ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM node:18
2
+
3
+ # Set up a new user named "user" with user ID 1000
4
+ RUN useradd -o -u 1000 user
5
+
6
+ # Switch to the "user" user
7
+ USER user
8
+
9
+ # Set home to the user's home directory
10
+ ENV HOME=/home/user \
11
+ PATH=/home/user/.local/bin:$PATH
12
+
13
+ # Set the working directory to the user's home directory
14
+ WORKDIR $HOME/app
15
+
16
+ # Install app dependencies
17
+ # A wildcard is used to ensure both package.json AND package-lock.json are copied
18
+ # where available (npm@5+)
19
+ COPY --chown=user package*.json $HOME/app
20
+
21
+ RUN npm install
22
+
23
+ # Copy the current directory contents into the container at $HOME/app setting the owner to the user
24
+ COPY --chown=user . $HOME/app
25
+
26
+ EXPOSE 7860
27
+ CMD [ "npm", "run", "start" ]
LICENSE.txt ADDED
@@ -0,0 +1,201 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
README.md ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: Space Factory
3
+ emoji: πŸ§‘β€πŸ’»πŸ¦™
4
+ colorFrom: blue
5
+ colorTo: yellow
6
+ sdk: docker
7
+ pinned: false
8
+ app_port: 7860
9
+ ---
10
+
11
+ Generate Hugging Face Spaces using CodeLlama 34b
12
+
13
+ # Examples
14
+
15
+ ## Local prompt examples
16
+
17
+ ```
18
+ http://localhost:7860/?prompt=A%20simple%20page%20to%20compute%20the%20BMI%20(use%20SI%20units)
19
+ ```
20
+
21
+ # Installation
22
+ ## Building and run without Docker
23
+
24
+ ```bash
25
+ nvm use
26
+ npm i
27
+ HF_API_TOKEN=******* npm run start
28
+ ```
29
+
30
+ ## Building and running with Docker
31
+
32
+ ```bash
33
+ npm run docker
34
+ ```
35
+
36
+ This script is a shortcut executing the following commands:
37
+
38
+ ```bash
39
+ docker build -t space-factory .
40
+ docker run -it -p 7860:7860 space-factory
41
+ ```
package-lock.json ADDED
@@ -0,0 +1,887 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "space-factory",
3
+ "version": "1.0.0",
4
+ "lockfileVersion": 3,
5
+ "requires": true,
6
+ "packages": {
7
+ "": {
8
+ "name": "space-factory",
9
+ "version": "1.0.0",
10
+ "license": "Apache License",
11
+ "dependencies": {
12
+ "@huggingface/hub": "^0.8.3",
13
+ "@huggingface/inference": "^2.6.1",
14
+ "@types/express": "^4.17.17",
15
+ "express": "^4.18.2",
16
+ "ts-node": "^10.9.1",
17
+ "uuid": "^9.0.0"
18
+ }
19
+ },
20
+ "node_modules/@cspotcode/source-map-support": {
21
+ "version": "0.8.1",
22
+ "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz",
23
+ "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==",
24
+ "dependencies": {
25
+ "@jridgewell/trace-mapping": "0.3.9"
26
+ },
27
+ "engines": {
28
+ "node": ">=12"
29
+ }
30
+ },
31
+ "node_modules/@huggingface/hub": {
32
+ "version": "0.8.3",
33
+ "resolved": "https://registry.npmjs.org/@huggingface/hub/-/hub-0.8.3.tgz",
34
+ "integrity": "sha512-tysAE1afXqEHsuu1oCR3mKu5+/KVkHFWsaLBB3e67Llo0m2ZL+7SE0pQPq8SopO8zxmYH8QIm5m8OhlNn+QJHA==",
35
+ "dependencies": {
36
+ "hash-wasm": "^4.9.0"
37
+ },
38
+ "engines": {
39
+ "node": ">=18"
40
+ }
41
+ },
42
+ "node_modules/@huggingface/inference": {
43
+ "version": "2.6.1",
44
+ "resolved": "https://registry.npmjs.org/@huggingface/inference/-/inference-2.6.1.tgz",
45
+ "integrity": "sha512-qFYchgOCPeEkZJKiSr7Kz62QwukJtgkeQCT7Q0SSKUcvHpTQVNJp6i/JrJMR4dBdzQysJ1SZDC0pLBBnnskTag==",
46
+ "engines": {
47
+ "node": ">=18"
48
+ }
49
+ },
50
+ "node_modules/@jridgewell/resolve-uri": {
51
+ "version": "3.1.1",
52
+ "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.1.tgz",
53
+ "integrity": "sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA==",
54
+ "engines": {
55
+ "node": ">=6.0.0"
56
+ }
57
+ },
58
+ "node_modules/@jridgewell/sourcemap-codec": {
59
+ "version": "1.4.15",
60
+ "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz",
61
+ "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg=="
62
+ },
63
+ "node_modules/@jridgewell/trace-mapping": {
64
+ "version": "0.3.9",
65
+ "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz",
66
+ "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==",
67
+ "dependencies": {
68
+ "@jridgewell/resolve-uri": "^3.0.3",
69
+ "@jridgewell/sourcemap-codec": "^1.4.10"
70
+ }
71
+ },
72
+ "node_modules/@tsconfig/node10": {
73
+ "version": "1.0.9",
74
+ "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.9.tgz",
75
+ "integrity": "sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA=="
76
+ },
77
+ "node_modules/@tsconfig/node12": {
78
+ "version": "1.0.11",
79
+ "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz",
80
+ "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag=="
81
+ },
82
+ "node_modules/@tsconfig/node14": {
83
+ "version": "1.0.3",
84
+ "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz",
85
+ "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow=="
86
+ },
87
+ "node_modules/@tsconfig/node16": {
88
+ "version": "1.0.4",
89
+ "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.4.tgz",
90
+ "integrity": "sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA=="
91
+ },
92
+ "node_modules/@types/body-parser": {
93
+ "version": "1.19.2",
94
+ "resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.19.2.tgz",
95
+ "integrity": "sha512-ALYone6pm6QmwZoAgeyNksccT9Q4AWZQ6PvfwR37GT6r6FWUPguq6sUmNGSMV2Wr761oQoBxwGGa6DR5o1DC9g==",
96
+ "dependencies": {
97
+ "@types/connect": "*",
98
+ "@types/node": "*"
99
+ }
100
+ },
101
+ "node_modules/@types/connect": {
102
+ "version": "3.4.35",
103
+ "resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.35.tgz",
104
+ "integrity": "sha512-cdeYyv4KWoEgpBISTxWvqYsVy444DOqehiF3fM3ne10AmJ62RSyNkUnxMJXHQWRQQX2eR94m5y1IZyDwBjV9FQ==",
105
+ "dependencies": {
106
+ "@types/node": "*"
107
+ }
108
+ },
109
+ "node_modules/@types/express": {
110
+ "version": "4.17.17",
111
+ "resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.17.tgz",
112
+ "integrity": "sha512-Q4FmmuLGBG58btUnfS1c1r/NQdlp3DMfGDGig8WhfpA2YRUtEkxAjkZb0yvplJGYdF1fsQ81iMDcH24sSCNC/Q==",
113
+ "dependencies": {
114
+ "@types/body-parser": "*",
115
+ "@types/express-serve-static-core": "^4.17.33",
116
+ "@types/qs": "*",
117
+ "@types/serve-static": "*"
118
+ }
119
+ },
120
+ "node_modules/@types/express-serve-static-core": {
121
+ "version": "4.17.35",
122
+ "resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.17.35.tgz",
123
+ "integrity": "sha512-wALWQwrgiB2AWTT91CB62b6Yt0sNHpznUXeZEcnPU3DRdlDIz74x8Qg1UUYKSVFi+va5vKOLYRBI1bRKiLLKIg==",
124
+ "dependencies": {
125
+ "@types/node": "*",
126
+ "@types/qs": "*",
127
+ "@types/range-parser": "*",
128
+ "@types/send": "*"
129
+ }
130
+ },
131
+ "node_modules/@types/http-errors": {
132
+ "version": "2.0.1",
133
+ "resolved": "https://registry.npmjs.org/@types/http-errors/-/http-errors-2.0.1.tgz",
134
+ "integrity": "sha512-/K3ds8TRAfBvi5vfjuz8y6+GiAYBZ0x4tXv1Av6CWBWn0IlADc+ZX9pMq7oU0fNQPnBwIZl3rmeLp6SBApbxSQ=="
135
+ },
136
+ "node_modules/@types/mime": {
137
+ "version": "1.3.2",
138
+ "resolved": "https://registry.npmjs.org/@types/mime/-/mime-1.3.2.tgz",
139
+ "integrity": "sha512-YATxVxgRqNH6nHEIsvg6k2Boc1JHI9ZbH5iWFFv/MTkchz3b1ieGDa5T0a9RznNdI0KhVbdbWSN+KWWrQZRxTw=="
140
+ },
141
+ "node_modules/@types/node": {
142
+ "version": "20.4.2",
143
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-20.4.2.tgz",
144
+ "integrity": "sha512-Dd0BYtWgnWJKwO1jkmTrzofjK2QXXcai0dmtzvIBhcA+RsG5h8R3xlyta0kGOZRNfL9GuRtb1knmPEhQrePCEw=="
145
+ },
146
+ "node_modules/@types/qs": {
147
+ "version": "6.9.7",
148
+ "resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.9.7.tgz",
149
+ "integrity": "sha512-FGa1F62FT09qcrueBA6qYTrJPVDzah9a+493+o2PCXsesWHIn27G98TsSMs3WPNbZIEj4+VJf6saSFpvD+3Zsw=="
150
+ },
151
+ "node_modules/@types/range-parser": {
152
+ "version": "1.2.4",
153
+ "resolved": "https://registry.npmjs.org/@types/range-parser/-/range-parser-1.2.4.tgz",
154
+ "integrity": "sha512-EEhsLsD6UsDM1yFhAvy0Cjr6VwmpMWqFBCb9w07wVugF7w9nfajxLuVmngTIpgS6svCnm6Vaw+MZhoDCKnOfsw=="
155
+ },
156
+ "node_modules/@types/send": {
157
+ "version": "0.17.1",
158
+ "resolved": "https://registry.npmjs.org/@types/send/-/send-0.17.1.tgz",
159
+ "integrity": "sha512-Cwo8LE/0rnvX7kIIa3QHCkcuF21c05Ayb0ZfxPiv0W8VRiZiNW/WuRupHKpqqGVGf7SUA44QSOUKaEd9lIrd/Q==",
160
+ "dependencies": {
161
+ "@types/mime": "^1",
162
+ "@types/node": "*"
163
+ }
164
+ },
165
+ "node_modules/@types/serve-static": {
166
+ "version": "1.15.2",
167
+ "resolved": "https://registry.npmjs.org/@types/serve-static/-/serve-static-1.15.2.tgz",
168
+ "integrity": "sha512-J2LqtvFYCzaj8pVYKw8klQXrLLk7TBZmQ4ShlcdkELFKGwGMfevMLneMMRkMgZxotOD9wg497LpC7O8PcvAmfw==",
169
+ "dependencies": {
170
+ "@types/http-errors": "*",
171
+ "@types/mime": "*",
172
+ "@types/node": "*"
173
+ }
174
+ },
175
+ "node_modules/accepts": {
176
+ "version": "1.3.8",
177
+ "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz",
178
+ "integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==",
179
+ "dependencies": {
180
+ "mime-types": "~2.1.34",
181
+ "negotiator": "0.6.3"
182
+ },
183
+ "engines": {
184
+ "node": ">= 0.6"
185
+ }
186
+ },
187
+ "node_modules/acorn": {
188
+ "version": "8.10.0",
189
+ "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.10.0.tgz",
190
+ "integrity": "sha512-F0SAmZ8iUtS//m8DmCTA0jlh6TDKkHQyK6xc6V4KDTyZKA9dnvX9/3sRTVQrWm79glUAZbnmmNcdYwUIHWVybw==",
191
+ "bin": {
192
+ "acorn": "bin/acorn"
193
+ },
194
+ "engines": {
195
+ "node": ">=0.4.0"
196
+ }
197
+ },
198
+ "node_modules/acorn-walk": {
199
+ "version": "8.2.0",
200
+ "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz",
201
+ "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==",
202
+ "engines": {
203
+ "node": ">=0.4.0"
204
+ }
205
+ },
206
+ "node_modules/arg": {
207
+ "version": "4.1.3",
208
+ "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz",
209
+ "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA=="
210
+ },
211
+ "node_modules/array-flatten": {
212
+ "version": "1.1.1",
213
+ "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz",
214
+ "integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg=="
215
+ },
216
+ "node_modules/body-parser": {
217
+ "version": "1.20.1",
218
+ "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.1.tgz",
219
+ "integrity": "sha512-jWi7abTbYwajOytWCQc37VulmWiRae5RyTpaCyDcS5/lMdtwSz5lOpDE67srw/HYe35f1z3fDQw+3txg7gNtWw==",
220
+ "dependencies": {
221
+ "bytes": "3.1.2",
222
+ "content-type": "~1.0.4",
223
+ "debug": "2.6.9",
224
+ "depd": "2.0.0",
225
+ "destroy": "1.2.0",
226
+ "http-errors": "2.0.0",
227
+ "iconv-lite": "0.4.24",
228
+ "on-finished": "2.4.1",
229
+ "qs": "6.11.0",
230
+ "raw-body": "2.5.1",
231
+ "type-is": "~1.6.18",
232
+ "unpipe": "1.0.0"
233
+ },
234
+ "engines": {
235
+ "node": ">= 0.8",
236
+ "npm": "1.2.8000 || >= 1.4.16"
237
+ }
238
+ },
239
+ "node_modules/bytes": {
240
+ "version": "3.1.2",
241
+ "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz",
242
+ "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==",
243
+ "engines": {
244
+ "node": ">= 0.8"
245
+ }
246
+ },
247
+ "node_modules/call-bind": {
248
+ "version": "1.0.2",
249
+ "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz",
250
+ "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==",
251
+ "dependencies": {
252
+ "function-bind": "^1.1.1",
253
+ "get-intrinsic": "^1.0.2"
254
+ },
255
+ "funding": {
256
+ "url": "https://github.com/sponsors/ljharb"
257
+ }
258
+ },
259
+ "node_modules/content-disposition": {
260
+ "version": "0.5.4",
261
+ "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz",
262
+ "integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==",
263
+ "dependencies": {
264
+ "safe-buffer": "5.2.1"
265
+ },
266
+ "engines": {
267
+ "node": ">= 0.6"
268
+ }
269
+ },
270
+ "node_modules/content-type": {
271
+ "version": "1.0.5",
272
+ "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz",
273
+ "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==",
274
+ "engines": {
275
+ "node": ">= 0.6"
276
+ }
277
+ },
278
+ "node_modules/cookie": {
279
+ "version": "0.5.0",
280
+ "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.5.0.tgz",
281
+ "integrity": "sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw==",
282
+ "engines": {
283
+ "node": ">= 0.6"
284
+ }
285
+ },
286
+ "node_modules/cookie-signature": {
287
+ "version": "1.0.6",
288
+ "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz",
289
+ "integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ=="
290
+ },
291
+ "node_modules/create-require": {
292
+ "version": "1.1.1",
293
+ "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz",
294
+ "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ=="
295
+ },
296
+ "node_modules/debug": {
297
+ "version": "2.6.9",
298
+ "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
299
+ "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
300
+ "dependencies": {
301
+ "ms": "2.0.0"
302
+ }
303
+ },
304
+ "node_modules/depd": {
305
+ "version": "2.0.0",
306
+ "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz",
307
+ "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==",
308
+ "engines": {
309
+ "node": ">= 0.8"
310
+ }
311
+ },
312
+ "node_modules/destroy": {
313
+ "version": "1.2.0",
314
+ "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz",
315
+ "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==",
316
+ "engines": {
317
+ "node": ">= 0.8",
318
+ "npm": "1.2.8000 || >= 1.4.16"
319
+ }
320
+ },
321
+ "node_modules/diff": {
322
+ "version": "4.0.2",
323
+ "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz",
324
+ "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==",
325
+ "engines": {
326
+ "node": ">=0.3.1"
327
+ }
328
+ },
329
+ "node_modules/ee-first": {
330
+ "version": "1.1.1",
331
+ "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
332
+ "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow=="
333
+ },
334
+ "node_modules/encodeurl": {
335
+ "version": "1.0.2",
336
+ "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz",
337
+ "integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==",
338
+ "engines": {
339
+ "node": ">= 0.8"
340
+ }
341
+ },
342
+ "node_modules/escape-html": {
343
+ "version": "1.0.3",
344
+ "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
345
+ "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow=="
346
+ },
347
+ "node_modules/etag": {
348
+ "version": "1.8.1",
349
+ "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz",
350
+ "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==",
351
+ "engines": {
352
+ "node": ">= 0.6"
353
+ }
354
+ },
355
+ "node_modules/express": {
356
+ "version": "4.18.2",
357
+ "resolved": "https://registry.npmjs.org/express/-/express-4.18.2.tgz",
358
+ "integrity": "sha512-5/PsL6iGPdfQ/lKM1UuielYgv3BUoJfz1aUwU9vHZ+J7gyvwdQXFEBIEIaxeGf0GIcreATNyBExtalisDbuMqQ==",
359
+ "dependencies": {
360
+ "accepts": "~1.3.8",
361
+ "array-flatten": "1.1.1",
362
+ "body-parser": "1.20.1",
363
+ "content-disposition": "0.5.4",
364
+ "content-type": "~1.0.4",
365
+ "cookie": "0.5.0",
366
+ "cookie-signature": "1.0.6",
367
+ "debug": "2.6.9",
368
+ "depd": "2.0.0",
369
+ "encodeurl": "~1.0.2",
370
+ "escape-html": "~1.0.3",
371
+ "etag": "~1.8.1",
372
+ "finalhandler": "1.2.0",
373
+ "fresh": "0.5.2",
374
+ "http-errors": "2.0.0",
375
+ "merge-descriptors": "1.0.1",
376
+ "methods": "~1.1.2",
377
+ "on-finished": "2.4.1",
378
+ "parseurl": "~1.3.3",
379
+ "path-to-regexp": "0.1.7",
380
+ "proxy-addr": "~2.0.7",
381
+ "qs": "6.11.0",
382
+ "range-parser": "~1.2.1",
383
+ "safe-buffer": "5.2.1",
384
+ "send": "0.18.0",
385
+ "serve-static": "1.15.0",
386
+ "setprototypeof": "1.2.0",
387
+ "statuses": "2.0.1",
388
+ "type-is": "~1.6.18",
389
+ "utils-merge": "1.0.1",
390
+ "vary": "~1.1.2"
391
+ },
392
+ "engines": {
393
+ "node": ">= 0.10.0"
394
+ }
395
+ },
396
+ "node_modules/finalhandler": {
397
+ "version": "1.2.0",
398
+ "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.2.0.tgz",
399
+ "integrity": "sha512-5uXcUVftlQMFnWC9qu/svkWv3GTd2PfUhK/3PLkYNAe7FbqJMt3515HaxE6eRL74GdsriiwujiawdaB1BpEISg==",
400
+ "dependencies": {
401
+ "debug": "2.6.9",
402
+ "encodeurl": "~1.0.2",
403
+ "escape-html": "~1.0.3",
404
+ "on-finished": "2.4.1",
405
+ "parseurl": "~1.3.3",
406
+ "statuses": "2.0.1",
407
+ "unpipe": "~1.0.0"
408
+ },
409
+ "engines": {
410
+ "node": ">= 0.8"
411
+ }
412
+ },
413
+ "node_modules/forwarded": {
414
+ "version": "0.2.0",
415
+ "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz",
416
+ "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==",
417
+ "engines": {
418
+ "node": ">= 0.6"
419
+ }
420
+ },
421
+ "node_modules/fresh": {
422
+ "version": "0.5.2",
423
+ "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz",
424
+ "integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==",
425
+ "engines": {
426
+ "node": ">= 0.6"
427
+ }
428
+ },
429
+ "node_modules/function-bind": {
430
+ "version": "1.1.1",
431
+ "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz",
432
+ "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A=="
433
+ },
434
+ "node_modules/get-intrinsic": {
435
+ "version": "1.2.1",
436
+ "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.1.tgz",
437
+ "integrity": "sha512-2DcsyfABl+gVHEfCOaTrWgyt+tb6MSEGmKq+kI5HwLbIYgjgmMcV8KQ41uaKz1xxUcn9tJtgFbQUEVcEbd0FYw==",
438
+ "dependencies": {
439
+ "function-bind": "^1.1.1",
440
+ "has": "^1.0.3",
441
+ "has-proto": "^1.0.1",
442
+ "has-symbols": "^1.0.3"
443
+ },
444
+ "funding": {
445
+ "url": "https://github.com/sponsors/ljharb"
446
+ }
447
+ },
448
+ "node_modules/has": {
449
+ "version": "1.0.3",
450
+ "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz",
451
+ "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==",
452
+ "dependencies": {
453
+ "function-bind": "^1.1.1"
454
+ },
455
+ "engines": {
456
+ "node": ">= 0.4.0"
457
+ }
458
+ },
459
+ "node_modules/has-proto": {
460
+ "version": "1.0.1",
461
+ "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.1.tgz",
462
+ "integrity": "sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg==",
463
+ "engines": {
464
+ "node": ">= 0.4"
465
+ },
466
+ "funding": {
467
+ "url": "https://github.com/sponsors/ljharb"
468
+ }
469
+ },
470
+ "node_modules/has-symbols": {
471
+ "version": "1.0.3",
472
+ "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz",
473
+ "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==",
474
+ "engines": {
475
+ "node": ">= 0.4"
476
+ },
477
+ "funding": {
478
+ "url": "https://github.com/sponsors/ljharb"
479
+ }
480
+ },
481
+ "node_modules/hash-wasm": {
482
+ "version": "4.9.0",
483
+ "resolved": "https://registry.npmjs.org/hash-wasm/-/hash-wasm-4.9.0.tgz",
484
+ "integrity": "sha512-7SW7ejyfnRxuOc7ptQHSf4LDoZaWOivfzqw+5rpcQku0nHfmicPKE51ra9BiRLAmT8+gGLestr1XroUkqdjL6w=="
485
+ },
486
+ "node_modules/http-errors": {
487
+ "version": "2.0.0",
488
+ "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz",
489
+ "integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==",
490
+ "dependencies": {
491
+ "depd": "2.0.0",
492
+ "inherits": "2.0.4",
493
+ "setprototypeof": "1.2.0",
494
+ "statuses": "2.0.1",
495
+ "toidentifier": "1.0.1"
496
+ },
497
+ "engines": {
498
+ "node": ">= 0.8"
499
+ }
500
+ },
501
+ "node_modules/iconv-lite": {
502
+ "version": "0.4.24",
503
+ "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",
504
+ "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==",
505
+ "dependencies": {
506
+ "safer-buffer": ">= 2.1.2 < 3"
507
+ },
508
+ "engines": {
509
+ "node": ">=0.10.0"
510
+ }
511
+ },
512
+ "node_modules/inherits": {
513
+ "version": "2.0.4",
514
+ "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
515
+ "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
516
+ },
517
+ "node_modules/ipaddr.js": {
518
+ "version": "1.9.1",
519
+ "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz",
520
+ "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==",
521
+ "engines": {
522
+ "node": ">= 0.10"
523
+ }
524
+ },
525
+ "node_modules/make-error": {
526
+ "version": "1.3.6",
527
+ "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz",
528
+ "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw=="
529
+ },
530
+ "node_modules/media-typer": {
531
+ "version": "0.3.0",
532
+ "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
533
+ "integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==",
534
+ "engines": {
535
+ "node": ">= 0.6"
536
+ }
537
+ },
538
+ "node_modules/merge-descriptors": {
539
+ "version": "1.0.1",
540
+ "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz",
541
+ "integrity": "sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w=="
542
+ },
543
+ "node_modules/methods": {
544
+ "version": "1.1.2",
545
+ "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz",
546
+ "integrity": "sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==",
547
+ "engines": {
548
+ "node": ">= 0.6"
549
+ }
550
+ },
551
+ "node_modules/mime": {
552
+ "version": "1.6.0",
553
+ "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz",
554
+ "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==",
555
+ "bin": {
556
+ "mime": "cli.js"
557
+ },
558
+ "engines": {
559
+ "node": ">=4"
560
+ }
561
+ },
562
+ "node_modules/mime-db": {
563
+ "version": "1.52.0",
564
+ "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
565
+ "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
566
+ "engines": {
567
+ "node": ">= 0.6"
568
+ }
569
+ },
570
+ "node_modules/mime-types": {
571
+ "version": "2.1.35",
572
+ "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
573
+ "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
574
+ "dependencies": {
575
+ "mime-db": "1.52.0"
576
+ },
577
+ "engines": {
578
+ "node": ">= 0.6"
579
+ }
580
+ },
581
+ "node_modules/ms": {
582
+ "version": "2.0.0",
583
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
584
+ "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A=="
585
+ },
586
+ "node_modules/negotiator": {
587
+ "version": "0.6.3",
588
+ "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz",
589
+ "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==",
590
+ "engines": {
591
+ "node": ">= 0.6"
592
+ }
593
+ },
594
+ "node_modules/object-inspect": {
595
+ "version": "1.12.3",
596
+ "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.3.tgz",
597
+ "integrity": "sha512-geUvdk7c+eizMNUDkRpW1wJwgfOiOeHbxBR/hLXK1aT6zmVSO0jsQcs7fj6MGw89jC/cjGfLcNOrtMYtGqm81g==",
598
+ "funding": {
599
+ "url": "https://github.com/sponsors/ljharb"
600
+ }
601
+ },
602
+ "node_modules/on-finished": {
603
+ "version": "2.4.1",
604
+ "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz",
605
+ "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==",
606
+ "dependencies": {
607
+ "ee-first": "1.1.1"
608
+ },
609
+ "engines": {
610
+ "node": ">= 0.8"
611
+ }
612
+ },
613
+ "node_modules/parseurl": {
614
+ "version": "1.3.3",
615
+ "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",
616
+ "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==",
617
+ "engines": {
618
+ "node": ">= 0.8"
619
+ }
620
+ },
621
+ "node_modules/path-to-regexp": {
622
+ "version": "0.1.7",
623
+ "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz",
624
+ "integrity": "sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ=="
625
+ },
626
+ "node_modules/proxy-addr": {
627
+ "version": "2.0.7",
628
+ "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz",
629
+ "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==",
630
+ "dependencies": {
631
+ "forwarded": "0.2.0",
632
+ "ipaddr.js": "1.9.1"
633
+ },
634
+ "engines": {
635
+ "node": ">= 0.10"
636
+ }
637
+ },
638
+ "node_modules/qs": {
639
+ "version": "6.11.0",
640
+ "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz",
641
+ "integrity": "sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==",
642
+ "dependencies": {
643
+ "side-channel": "^1.0.4"
644
+ },
645
+ "engines": {
646
+ "node": ">=0.6"
647
+ },
648
+ "funding": {
649
+ "url": "https://github.com/sponsors/ljharb"
650
+ }
651
+ },
652
+ "node_modules/range-parser": {
653
+ "version": "1.2.1",
654
+ "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz",
655
+ "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==",
656
+ "engines": {
657
+ "node": ">= 0.6"
658
+ }
659
+ },
660
+ "node_modules/raw-body": {
661
+ "version": "2.5.1",
662
+ "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.1.tgz",
663
+ "integrity": "sha512-qqJBtEyVgS0ZmPGdCFPWJ3FreoqvG4MVQln/kCgF7Olq95IbOp0/BWyMwbdtn4VTvkM8Y7khCQ2Xgk/tcrCXig==",
664
+ "dependencies": {
665
+ "bytes": "3.1.2",
666
+ "http-errors": "2.0.0",
667
+ "iconv-lite": "0.4.24",
668
+ "unpipe": "1.0.0"
669
+ },
670
+ "engines": {
671
+ "node": ">= 0.8"
672
+ }
673
+ },
674
+ "node_modules/safe-buffer": {
675
+ "version": "5.2.1",
676
+ "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
677
+ "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",
678
+ "funding": [
679
+ {
680
+ "type": "github",
681
+ "url": "https://github.com/sponsors/feross"
682
+ },
683
+ {
684
+ "type": "patreon",
685
+ "url": "https://www.patreon.com/feross"
686
+ },
687
+ {
688
+ "type": "consulting",
689
+ "url": "https://feross.org/support"
690
+ }
691
+ ]
692
+ },
693
+ "node_modules/safer-buffer": {
694
+ "version": "2.1.2",
695
+ "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
696
+ "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
697
+ },
698
+ "node_modules/send": {
699
+ "version": "0.18.0",
700
+ "resolved": "https://registry.npmjs.org/send/-/send-0.18.0.tgz",
701
+ "integrity": "sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg==",
702
+ "dependencies": {
703
+ "debug": "2.6.9",
704
+ "depd": "2.0.0",
705
+ "destroy": "1.2.0",
706
+ "encodeurl": "~1.0.2",
707
+ "escape-html": "~1.0.3",
708
+ "etag": "~1.8.1",
709
+ "fresh": "0.5.2",
710
+ "http-errors": "2.0.0",
711
+ "mime": "1.6.0",
712
+ "ms": "2.1.3",
713
+ "on-finished": "2.4.1",
714
+ "range-parser": "~1.2.1",
715
+ "statuses": "2.0.1"
716
+ },
717
+ "engines": {
718
+ "node": ">= 0.8.0"
719
+ }
720
+ },
721
+ "node_modules/send/node_modules/ms": {
722
+ "version": "2.1.3",
723
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
724
+ "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="
725
+ },
726
+ "node_modules/serve-static": {
727
+ "version": "1.15.0",
728
+ "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.15.0.tgz",
729
+ "integrity": "sha512-XGuRDNjXUijsUL0vl6nSD7cwURuzEgglbOaFuZM9g3kwDXOWVTck0jLzjPzGD+TazWbboZYu52/9/XPdUgne9g==",
730
+ "dependencies": {
731
+ "encodeurl": "~1.0.2",
732
+ "escape-html": "~1.0.3",
733
+ "parseurl": "~1.3.3",
734
+ "send": "0.18.0"
735
+ },
736
+ "engines": {
737
+ "node": ">= 0.8.0"
738
+ }
739
+ },
740
+ "node_modules/setprototypeof": {
741
+ "version": "1.2.0",
742
+ "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz",
743
+ "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw=="
744
+ },
745
+ "node_modules/side-channel": {
746
+ "version": "1.0.4",
747
+ "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz",
748
+ "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==",
749
+ "dependencies": {
750
+ "call-bind": "^1.0.0",
751
+ "get-intrinsic": "^1.0.2",
752
+ "object-inspect": "^1.9.0"
753
+ },
754
+ "funding": {
755
+ "url": "https://github.com/sponsors/ljharb"
756
+ }
757
+ },
758
+ "node_modules/statuses": {
759
+ "version": "2.0.1",
760
+ "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz",
761
+ "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==",
762
+ "engines": {
763
+ "node": ">= 0.8"
764
+ }
765
+ },
766
+ "node_modules/toidentifier": {
767
+ "version": "1.0.1",
768
+ "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz",
769
+ "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==",
770
+ "engines": {
771
+ "node": ">=0.6"
772
+ }
773
+ },
774
+ "node_modules/ts-node": {
775
+ "version": "10.9.1",
776
+ "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.1.tgz",
777
+ "integrity": "sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==",
778
+ "dependencies": {
779
+ "@cspotcode/source-map-support": "^0.8.0",
780
+ "@tsconfig/node10": "^1.0.7",
781
+ "@tsconfig/node12": "^1.0.7",
782
+ "@tsconfig/node14": "^1.0.0",
783
+ "@tsconfig/node16": "^1.0.2",
784
+ "acorn": "^8.4.1",
785
+ "acorn-walk": "^8.1.1",
786
+ "arg": "^4.1.0",
787
+ "create-require": "^1.1.0",
788
+ "diff": "^4.0.1",
789
+ "make-error": "^1.1.1",
790
+ "v8-compile-cache-lib": "^3.0.1",
791
+ "yn": "3.1.1"
792
+ },
793
+ "bin": {
794
+ "ts-node": "dist/bin.js",
795
+ "ts-node-cwd": "dist/bin-cwd.js",
796
+ "ts-node-esm": "dist/bin-esm.js",
797
+ "ts-node-script": "dist/bin-script.js",
798
+ "ts-node-transpile-only": "dist/bin-transpile.js",
799
+ "ts-script": "dist/bin-script-deprecated.js"
800
+ },
801
+ "peerDependencies": {
802
+ "@swc/core": ">=1.2.50",
803
+ "@swc/wasm": ">=1.2.50",
804
+ "@types/node": "*",
805
+ "typescript": ">=2.7"
806
+ },
807
+ "peerDependenciesMeta": {
808
+ "@swc/core": {
809
+ "optional": true
810
+ },
811
+ "@swc/wasm": {
812
+ "optional": true
813
+ }
814
+ }
815
+ },
816
+ "node_modules/type-is": {
817
+ "version": "1.6.18",
818
+ "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz",
819
+ "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==",
820
+ "dependencies": {
821
+ "media-typer": "0.3.0",
822
+ "mime-types": "~2.1.24"
823
+ },
824
+ "engines": {
825
+ "node": ">= 0.6"
826
+ }
827
+ },
828
+ "node_modules/typescript": {
829
+ "version": "5.1.6",
830
+ "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.1.6.tgz",
831
+ "integrity": "sha512-zaWCozRZ6DLEWAWFrVDz1H6FVXzUSfTy5FUMWsQlU8Ym5JP9eO4xkTIROFCQvhQf61z6O/G6ugw3SgAnvvm+HA==",
832
+ "peer": true,
833
+ "bin": {
834
+ "tsc": "bin/tsc",
835
+ "tsserver": "bin/tsserver"
836
+ },
837
+ "engines": {
838
+ "node": ">=14.17"
839
+ }
840
+ },
841
+ "node_modules/unpipe": {
842
+ "version": "1.0.0",
843
+ "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
844
+ "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==",
845
+ "engines": {
846
+ "node": ">= 0.8"
847
+ }
848
+ },
849
+ "node_modules/utils-merge": {
850
+ "version": "1.0.1",
851
+ "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz",
852
+ "integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==",
853
+ "engines": {
854
+ "node": ">= 0.4.0"
855
+ }
856
+ },
857
+ "node_modules/uuid": {
858
+ "version": "9.0.0",
859
+ "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.0.tgz",
860
+ "integrity": "sha512-MXcSTerfPa4uqyzStbRoTgt5XIe3x5+42+q1sDuy3R5MDk66URdLMOZe5aPX/SQd+kuYAh0FdP/pO28IkQyTeg==",
861
+ "bin": {
862
+ "uuid": "dist/bin/uuid"
863
+ }
864
+ },
865
+ "node_modules/v8-compile-cache-lib": {
866
+ "version": "3.0.1",
867
+ "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz",
868
+ "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg=="
869
+ },
870
+ "node_modules/vary": {
871
+ "version": "1.1.2",
872
+ "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",
873
+ "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==",
874
+ "engines": {
875
+ "node": ">= 0.8"
876
+ }
877
+ },
878
+ "node_modules/yn": {
879
+ "version": "3.1.1",
880
+ "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz",
881
+ "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==",
882
+ "engines": {
883
+ "node": ">=6"
884
+ }
885
+ }
886
+ }
887
+ }
package.json ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "space-factory",
3
+ "version": "1.0.0",
4
+ "description": "A Hugging Face Space generator",
5
+ "main": "src/index.mts",
6
+ "scripts": {
7
+ "start": "node --loader ts-node/esm src/index.mts",
8
+ "test": "node --loader ts-node/esm src/test.mts",
9
+ "docker": "npm run docker:build && npm run docker:run",
10
+ "docker:build": "docker build -t space-factory-llama2 .",
11
+ "docker:run": "docker run -it -p 7860:7860 space-factory-llama2"
12
+ },
13
+ "author": "Julian Bilcke <[email protected]>",
14
+ "license": "Apache License",
15
+ "dependencies": {
16
+ "@huggingface/hub": "^0.8.3",
17
+ "@huggingface/inference": "^2.6.1",
18
+ "@types/express": "^4.17.17",
19
+ "express": "^4.18.2",
20
+ "ts-node": "^10.9.1",
21
+ "uuid": "^9.0.0"
22
+ }
23
+ }
public/index.html ADDED
@@ -0,0 +1,186 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <html>
2
+ <head>
3
+ <title>Space Factory 🏭</title>
4
+ <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/full.css" rel="stylesheet" type="text/css" />
5
+ <script defer src="https://cdn.jsdelivr.net/npm/[email protected]/dist/cdn.min.js"></script>
6
+ <script src="https://cdn.tailwindcss.com?plugins=forms,typography,aspect-ratio"></script>
7
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/iframe-resizer/4.3.2/iframeResizer.contentWindow.min.js"></script>
8
+ </head>
9
+ <body>
10
+ <div class="flex flex-col md:flex-row" x-data="app()" x-init="init()">
11
+ <div
12
+ class="hero md:h-screen bg-stone-100 transition-[width] delay-150 ease-in-out"
13
+ :class="open ? 'w-full md:w-2/6' : 'w-full md:w-6/6'"
14
+ >
15
+ <div class="hero-content text-center">
16
+ <div class="flex flex-col w-full md:max-w-xl space-y-3 md:space-y-6">
17
+ <h1
18
+ class="font-bold text-stone-600 mb-1 md:mb-3 transition-all delay-150 ease-in-out"
19
+ :class="open
20
+ ? 'text-2xl md:text-3xl lg:text-4xl'
21
+ : 'text-2xl md:text-3xl lg:text-6xl'"
22
+ >
23
+ Space Factory 🏭
24
+ </h1>
25
+ <div
26
+ class="py-1 md:py-2 space-y-2 md:space-y-3 text-stone-600 transition-all delay-150 ease-in-out"
27
+ :class="open
28
+ ? 'text-lg lg:text-xl'
29
+ : 'text-lg lg:text-xl'"
30
+ >
31
+ <p>A space to generate tiny web apps.</p>
32
+ <p>In case of hallucination try generating again 🎲</p>
33
+ </div>
34
+ <textarea
35
+ name="promptDraft"
36
+ x-model="promptDraft"
37
+ rows="10"
38
+ placeholder="Describe your web app"
39
+ class="input w-full rounded text-stone-800 bg-stone-50 border-2 border-stone-400 font-mono text-md md:text-lg h-24 md:h-48"
40
+ ></textarea>
41
+ <p class="py-1 md:py-2 text-stone-700 text-italic">
42
+ Examples:
43
+
44
+ <a href="/?prompt=a simple page to compute the BMI using metric units" class="text-bold underline">compute my BMI</a>,
45
+ <a href="/?prompt=app listing various types of savanna animals, with their photos" class="text-bold underline">photos of savanna animals</a>
46
+ </p>
47
+ <button
48
+ class="btn disabled:text-stone-400"
49
+ @click="open = true, prompt = promptDraft, state = state === 'stopped' ? 'loading' : 'stopped', state === 'streaming' ? stopGeneration() : true"
50
+ :class="promptDraft.length < minPromptSize ? 'btn-neutral' : state === 'stopped' ? 'btn-accent' : 'btn-warning'"
51
+ :disabled="promptDraft.length < minPromptSize"
52
+ >
53
+ <span x-show="promptDraft.length < minPromptSize">Prompt too short to generate</span>
54
+ <span x-show="promptDraft.length >= minPromptSize && state !== 'stopped'">Stop now</span>
55
+ <span x-show="promptDraft.length >= minPromptSize && state === 'stopped'">Generate!</span>
56
+ </button>
57
+ <div class="flex flex-col text-stone-700 space-y-1 md:space-y-2">
58
+ <p class="text-stone-700">
59
+ Model used:
60
+ <a href="https://huggingface.co/meta-llama" class="underline" target="_blank">
61
+ Llama-2
62
+ </a>
63
+ </p>
64
+ <p>Powered by πŸ€— <a href="https://huggingface.co/inference-endpoints" class="underline" target="_blank">Inference Endpoints</a></p>
65
+ <p class="text-stone-700" x-show="state === 'loading'">
66
+ Waiting for the stream to begin (might take a few minutes)..
67
+ </p>
68
+ <p class="text-stone-700" x-show="state === 'streaming'">
69
+ Content size: <span x-text="humanFileSize(size, true, 2)"></span>. This version generates up
70
+ to 1150 tokens.
71
+ </p>
72
+ </div>
73
+ </div>
74
+ </div>
75
+ </div>
76
+ <div
77
+ class="flex flex-col transition-[width] delay-150 ease-in-out md:h-screen"
78
+ :class="open ? 'w-full md:w-4/6' : 'w-full md:w-0'"
79
+ >
80
+ <iframe
81
+ id="iframe"
82
+ class="border-none w-full md:min-h-screen"
83
+ :src="!open
84
+ ? '/placeholder.html'
85
+ : `/app?prompt=${encodeURIComponent(prompt)}`
86
+ "
87
+ ></iframe>
88
+
89
+ <div
90
+ x-show="state !== 'stopped'"
91
+ class="flex w-full -mt-20 items-end justify-center pointer-events-none">
92
+ <div class="flex flex-row py-3 px-8 text-center bg-stone-200 text-stone-600 rounded-md shadow-md">
93
+ <div class="animate-bounce duration-150 mr-1">πŸ€–</div>
94
+ <div>Generating your app..</div>
95
+ </div>
96
+ </div>
97
+ </div>
98
+ </div>
99
+ <script>
100
+ /**
101
+ * Format bytes as human-readable text.
102
+ *
103
+ * @param bytes Number of bytes.
104
+ * @param si True to use metric (SI) units, aka powers of 1000. False to use
105
+ * binary (IEC), aka powers of 1024.
106
+ * @param dp Number of decimal places to display.
107
+ *
108
+ * @return Formatted string.
109
+ */
110
+ function humanFileSize(bytes, si = false, dp = 1) {
111
+ const thresh = si ? 1000 : 1024;
112
+
113
+ if (Math.abs(bytes) < thresh) {
114
+ return bytes + " B";
115
+ }
116
+
117
+ const units = si
118
+ ? ["kB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"]
119
+ : ["KiB", "MiB", "GiB", "TiB", "PiB", "EiB", "ZiB", "YiB"];
120
+ let u = -1;
121
+ const r = 10 ** dp;
122
+
123
+ do {
124
+ bytes /= thresh;
125
+ ++u;
126
+ } while (Math.round(Math.abs(bytes) * r) / r >= thresh && u < units.length - 1);
127
+
128
+ return bytes.toFixed(dp) + " " + units[u];
129
+ }
130
+
131
+ function stopGeneration() {
132
+ console.log("stopping generation..");
133
+ document?.getElementById("iframe")?.contentWindow?.stop?.();
134
+ }
135
+
136
+ function app() {
137
+ return {
138
+ open: false,
139
+ promptDraft:
140
+ new URLSearchParams(window.location.search).get("prompt") || '',
141
+ prompt: "",
142
+ size: 0,
143
+ minPromptSize: 16, // if you change this, you will need to also change in src/index.mts
144
+ timeoutInSec: 15, // time before we determine something went wrong
145
+ state: "stopped",
146
+ lastTokenAt: +new Date(),
147
+ init() {
148
+ setInterval(() => {
149
+ if (this.state === "stopped") {
150
+ this.lastTokenAt = +new Date();
151
+ return;
152
+ }
153
+ const html = document?.getElementById("iframe")?.contentWindow?.document?.documentElement?.outerHTML;
154
+ const size = Number(html?.length); // count how many characters we have generated
155
+
156
+ if (isNaN(size) || !isFinite(size)) {
157
+ this.size = 0;
158
+ this.state = "loading";
159
+ return;
160
+ }
161
+
162
+ this.state = "streaming";
163
+
164
+ const now = +new Date();
165
+ const newSize = new Blob([html]).size;
166
+ const hasChanged = newSize !== this.size;
167
+
168
+ if (hasChanged) {
169
+ this.lastTokenAt = now;
170
+ }
171
+
172
+ this.size = newSize;
173
+
174
+ const timeSinceLastUpdate = (now - this.lastTokenAt) / 1000;
175
+
176
+ if (timeSinceLastUpdate > this.timeoutInSec) {
177
+ console.log(`no changes detected for the past ${this.timeoutInSec} seconds -> considering we're done`);
178
+ this.state = "stopped";
179
+ }
180
+ }, 100);
181
+ },
182
+ };
183
+ }
184
+ </script>
185
+ </body>
186
+ </html>
public/placeholder.html ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <html>
2
+ <head>
3
+ <title>Nothing to show (yet)</title>
4
+ <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/full.css" rel="stylesheet" type="text/css" />
5
+ <script src="https://cdn.tailwindcss.com?plugins=forms,typography,aspect-ratio"></script>
6
+ </head>
7
+ <body>
8
+ <div class="hero min-h-screen bg-stone-100">
9
+ <div class="hero-content text-center">
10
+ <div class="flex flex-col max-w-xl space-y-6">
11
+ <h1 class="font-bold text-stone-600 mb-4">Nothing to show here (note: minimum prompt size is 16 characters)</h1>
12
+ </div>
13
+ </div>
14
+ </div>
15
+ </body>
16
+ </html>
src/alpine.mts ADDED
@@ -0,0 +1,220 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ interface FeatureAPI {
3
+ title: string
4
+ description: string
5
+ pattern: string
6
+ }
7
+
8
+ const getPromptFromFeatures = (feats: FeatureAPI[]) =>
9
+ feats.map(({ title, description, pattern }) => `## "${title}": ${description}.\nExample: \`${pattern}\``).join("\n")
10
+
11
+
12
+ export const attributes: FeatureAPI[] = [
13
+ {
14
+ title: "x-data",
15
+ description: "Declare a new Alpine component and its data for a block of HTML",
16
+ pattern:
17
+ `<div x-data="{ open: false }">
18
+ ...
19
+ </div>`
20
+ },
21
+ {
22
+ title: "x-bind",
23
+ description: "Dynamically set HTML attributes on an element",
24
+ pattern:
25
+ `<div x-bind:class="! open ? 'hidden' : ''">
26
+ ...
27
+ </div>`
28
+ },
29
+ {
30
+ title: "x-on",
31
+ description: "Listen for browser events on an element",
32
+ pattern:
33
+ `<button x-on:click="open = ! open">
34
+ Toggle
35
+ </button>`
36
+ },
37
+ {
38
+ title: "x-text",
39
+ description: "Set the text content of an element",
40
+ pattern:
41
+ `<div>
42
+ Copyright Β©
43
+
44
+ <span x-text="new Date().getFullYear()"></span>
45
+ </div>`
46
+ },
47
+ {
48
+ title: "x-html",
49
+ description: "Set the inner HTML of an element",
50
+ pattern:
51
+ `<div x-html="(await axios.get('/some/html/partial')).data">
52
+ ...
53
+ </div>`
54
+ },
55
+ {
56
+ title: "x-model",
57
+ description: "Synchronize a piece of data with an input element",
58
+ pattern:
59
+ `<div x-data="{ search: '' }">
60
+ <input type="text" x-model="search">
61
+
62
+ Searching for: <span x-text="search"></span>
63
+ </div>`
64
+ },
65
+ {
66
+ title: "x-show",
67
+ description: "Toggle the visibility of an element",
68
+ pattern:
69
+ `<div x-show="open">
70
+ ...
71
+ </div>`
72
+ },
73
+ {
74
+ title: "x-transition",
75
+ description: "Transition an element in and out using CSS transitions",
76
+ pattern:
77
+ `<div x-show="open" x-transition>
78
+ ...
79
+ </div>`
80
+ },
81
+ {
82
+ title: "x-for",
83
+ description: "Repeat a block of HTML based on a data set",
84
+ pattern:
85
+ `<template x-for="post in posts">
86
+ <h2 x-text="post.title"></h2>
87
+ </template>`
88
+ },
89
+ {
90
+ title: "x-if",
91
+ description: "Conditionally add/remove a block of HTML from the page entirely",
92
+ pattern:
93
+ `<template x-if="open">
94
+ <div>...</div>
95
+ </template>`
96
+ },
97
+ {
98
+ title: "x-init",
99
+ description: "Run code when an element is initialized by Alpine",
100
+ pattern:
101
+ `<div x-init="date = new Date()"></div>`
102
+ },
103
+ {
104
+ title: "x-effect",
105
+ description: "Execute a script each time one of its dependencies change",
106
+ pattern:
107
+ `<div x-effect="console.log('Count is '+count)"></div>`
108
+ },
109
+ {
110
+ title: "x-ref",
111
+ description: "Reference elements directly by their specified keys using the $refs magic property",
112
+ pattern:
113
+ `<input type="text" x-ref="content">
114
+
115
+ <button x-on:click="navigator.clipboard.writeText($refs.content.value)">
116
+ Copy
117
+ </button>`
118
+ },
119
+ {
120
+ title: "x-cloak",
121
+ description: "Hide a block of HTML until after Alpine is finished initializing its contents",
122
+ pattern:
123
+ `<div x-cloak>
124
+ ...
125
+ </div>`
126
+ },
127
+ {
128
+ title: "x-ignore",
129
+ description: "Prevent a block of HTML from being initialized by Alpine",
130
+ pattern:
131
+ `<div x-ignore>
132
+ ...
133
+ </div>`
134
+ },
135
+ ]
136
+
137
+ export const attributesPrompt = getPromptFromFeatures(attributes)
138
+
139
+ export const properties: FeatureAPI[] = [
140
+ {
141
+ title: "$store",
142
+ description: "Access a global store registered using Alpine.store(...)",
143
+ pattern: `<h1 x-text="$store.site.title"></h1>`
144
+ },
145
+ {
146
+ title: "$el",
147
+ description: "Reference the current DOM element",
148
+ pattern:`<div x-init="new Pikaday($el)"></div>`
149
+ },
150
+ {
151
+ title: "$dispatch",
152
+ description: "Dispatch a custom browser event from the current element",
153
+ pattern:
154
+ `<div x-on:notify="...">
155
+ <button x-on:click="$dispatch('notify')">...</button>
156
+ </div>`
157
+ },
158
+ {
159
+ title: "$watch",
160
+ description: "Watch a piece of data and run the provided callback anytime it changes",
161
+ pattern:
162
+ `<div x-init="$watch('count', value => {
163
+ console.log('count is ' + value)
164
+ })">...</div>`
165
+ },
166
+ {
167
+ title: "$refs",
168
+ description: "Reference an element by key (specified using x-ref)",
169
+ pattern:
170
+ `<div x-init="$refs.button.remove()">
171
+ <button x-ref="button">Remove Me</button>
172
+ </div>`
173
+ },
174
+ {
175
+ title: "$nextTick",
176
+ description: "Wait until the next \"tick\" (browser paint) to run a bit of code",
177
+ pattern:
178
+ `<div
179
+ x-text="count"
180
+ x-text="$nextTick(() => {"
181
+ console.log('count is ' + $el.textContent)
182
+ })
183
+ >...</div>`
184
+ },
185
+ ]
186
+
187
+ export const propertiesPrompt = getPromptFromFeatures(properties)
188
+
189
+ export const methods: FeatureAPI[] = [
190
+ {
191
+ title: "Alpine.data",
192
+ description: "Reuse a data object and reference it using x-data",
193
+ pattern:
194
+ `<div x-data="dropdown">
195
+ ...
196
+ </div>`
197
+ },
198
+ {
199
+ title: "Alpine.store",
200
+ description: "Declare a piece of global, reactive, data that can be accessed from anywhere using $store",
201
+ pattern:
202
+ `<button @click="$store.notifications.notify('...')">
203
+ Notify
204
+ </button>
205
+
206
+ ...
207
+
208
+ Alpine.store('notifications', {
209
+ items: [],
210
+
211
+ notify(message) {
212
+ this.items.push(message)
213
+ }
214
+ })`
215
+ },
216
+ ]
217
+
218
+ export const methodsPrompt = getPromptFromFeatures(methods)
219
+
220
+ export const alpine = "# Alpine.js docs\n"+ attributesPrompt // + propertiesPrompt + methodsPrompt
src/createLlamaPrompt.mts ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // adapted from https://huggingface.co/TheBloke/Llama-2-13B-chat-GPTQ/discussions/5
2
+ export function createLlamaPrompt(messages: Array<{ role: string, content: string }>) {
3
+ const B_INST = "[INST]", E_INST = "[/INST]";
4
+ const B_SYS = "<<SYS>>\n", E_SYS = "\n<</SYS>>\n\n";
5
+ const BOS = "<s>", EOS = "</s>";
6
+ const DEFAULT_SYSTEM_PROMPT = "You are a helpful, respectful and honest assistant. Always answer as helpfully as possible, while being safe. Please ensure that your responses are socially unbiased and positive in nature. If a question does not make any sense, or is not factually coherent, explain why instead of answering something not correct. If you don't know the answer to a question, please don't share false information.";
7
+
8
+ if (messages[0].role != "system"){
9
+ messages = [
10
+ {role: "system", content: DEFAULT_SYSTEM_PROMPT}
11
+ ].concat(messages);
12
+ }
13
+ messages = [{role: messages[1].role, content: B_SYS + messages[0].content + E_SYS + messages[1].content}].concat(messages.slice(2));
14
+
15
+ let messages_list = messages.map((value, index, array) => {
16
+ if (index % 2 == 0 && index + 1 < array.length){
17
+ return `${BOS}${B_INST} ${array[index].content.trim()} ${E_INST} ${array[index+1].content.trim()} ${EOS}`
18
+ }
19
+ return '';
20
+ })
21
+
22
+ messages_list.push(`${BOS}${B_INST} ${messages[messages.length-1].content.trim()} ${E_INST}`)
23
+
24
+ return messages_list.join('');
25
+ }
src/createSpace.mts ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { v4 as uuidv4 } from "uuid"
2
+ import { createRepo, uploadFiles, whoAmI } from "@huggingface/hub"
3
+ import type { RepoDesignation, Credentials } from "@huggingface/hub"
4
+
5
+ import { RepoFile } from "./types.mts"
6
+
7
+ export const createSpace = async (files: RepoFile[]) => {
8
+
9
+ const repoId = `space-factory-${uuidv4().slice(0, 4)}`
10
+ const repoName = `jbilcke-hf/${repoId}`
11
+
12
+ const repo: RepoDesignation = { type: "space", name: repoName }
13
+ const credentials: Credentials = { accessToken: process.env.HF_API_TOKEN }
14
+
15
+ const { name: username } = await whoAmI({ credentials })
16
+ console.log("me: ", username)
17
+
18
+ console.log("repo:", JSON.stringify(repo, null, 2))
19
+
20
+ await createRepo({
21
+ repo,
22
+ credentials,
23
+ license: "mit",
24
+ sdk:
25
+ files.some(file => file.path.includes("app.py"))
26
+ ? "streamlit"
27
+ : "static" // "streamlit" | "gradio" | "docker" | "static";
28
+ });
29
+
30
+ console.log("uploading files..")
31
+ await uploadFiles({
32
+ repo,
33
+ credentials,
34
+ files: files.map(file => ({
35
+ path: file.path,
36
+ content: new Blob([ file.content ])
37
+ })),
38
+ });
39
+
40
+ console.log("upload done!")
41
+
42
+ // TODO we should keep track of the repo and delete it after 30 min
43
+ // or delete it if we reached 20 repos
44
+ // await deleteRepo({ repo, credentials })
45
+ }
src/daisy.mts ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ export const daisy = `# DaisyUI docs
2
+ ## To create a nice layout, wrap each article in:
3
+ <article class="prose"></article>
4
+ ## Use appropriate CSS classes
5
+ <button class="btn ..">
6
+ <table class="table ..">
7
+ <footer class="footer ..">`
src/generateFiles.mts ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { HfInference } from '@huggingface/inference'
2
+ import { RepoFile } from './types.mts'
3
+ import { createLlamaPrompt } from './createLlamaPrompt.mts'
4
+ import { streamlitDoc } from './streamlitDoc.mts'
5
+ import { parseTutorial } from './parseTutorial.mts'
6
+
7
+ const hf = new HfInference(process.env.HF_API_TOKEN)
8
+
9
+ export const generateFiles = async (prompt: string) => {
10
+ if (`${prompt}`.length < 2) {
11
+ throw new Error(`prompt too short, please enter at least ${prompt} characters`)
12
+ }
13
+
14
+ const prefix = "# In app.py:\n```"
15
+
16
+ const inputs = createLlamaPrompt([
17
+ {
18
+ role: "system",
19
+ content: [
20
+ `You are a Python developer, expert at crafting Streamlit applications to deploy to Hugging Face.`,
21
+ `Here is an extract from the Streamlit documentation:`,
22
+ streamlitDoc
23
+ ].filter(item => item).join("\n")
24
+ },
25
+ {
26
+ role: "user",
27
+ content: `Please write, file by file, the source code for a Streamlit app.
28
+
29
+ Please limit yourself to the following Python modules:
30
+ - numpy
31
+ - streamlit
32
+ - matplotlib
33
+
34
+ Don't forget to write a README.md with the following header:
35
+ \`\`\`
36
+ ---
37
+ license: apache-2.0
38
+ title: <app name>
39
+ sdk: streamlit
40
+ emoji: πŸ‘€
41
+ colorFrom: green
42
+ colorTo: blue
43
+ ---
44
+ \`\`\`
45
+
46
+ The Streamlit app is about: ${prompt}`,
47
+ }
48
+ ]) + "\nSure! Here are the source files:\n" + prefix
49
+
50
+ let tutorial = prefix
51
+
52
+ try {
53
+ for await (const output of hf.textGenerationStream({
54
+ model: "codellama/CodeLlama-34b-Instruct-hf",
55
+ inputs,
56
+ parameters: {
57
+ do_sample: true,
58
+
59
+ // for "codellama/CodeLlama-34b-Instruct-hf":
60
+ // `inputs` tokens + `max_new_tokens` must be <= 8192
61
+ // error: `inputs` must have less than 4096 tokens.
62
+ max_new_tokens: 1150,
63
+ return_full_text: false,
64
+ }
65
+ })) {
66
+
67
+ tutorial += output.token.text
68
+ process.stdout.write(output.token.text)
69
+ // res.write(output.token.text)
70
+ if (tutorial.includes('<|end|>') || tutorial.includes('<|assistant|>')) {
71
+ break
72
+ }
73
+ }
74
+
75
+ } catch (e) {
76
+ console.log("failed:")
77
+ console.log(e)
78
+ }
79
+
80
+ console.log("analyzing the generated instructions..")
81
+ const files = parseTutorial(tutorial).map(({ filename, content }) => ({
82
+ path: `${filename || ""}`.trim(),
83
+ content: `${content || ""}`
84
+ } as RepoFile))
85
+ .filter(res => res.path.length && res.content.length)
86
+
87
+ return files
88
+ }
src/index.mts ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import express from 'express'
2
+ import { HfInference } from '@huggingface/inference'
3
+ import { createSpace } from './createSpace.mts'
4
+ import { RepoFile } from './types.mts'
5
+ import { generateFiles } from './generateFiles.mts'
6
+
7
+ const hfi = new HfInference(process.env.HF_API_TOKEN)
8
+ const hf = hfi.endpoint(process.env.HF_ENDPOINT_URL)
9
+
10
+ const app = express()
11
+ const port = 7860
12
+
13
+ const minPromptSize = 16 // if you change this, you will need to also change in public/index.html
14
+ const timeoutInSec = 15 * 60
15
+
16
+ console.log('timeout set to 30 minutes')
17
+
18
+ app.use(express.static('public'))
19
+
20
+ const pending: {
21
+ total: number;
22
+ queue: string[];
23
+ } = {
24
+ total: 0,
25
+ queue: [],
26
+ }
27
+
28
+ const endRequest = (id: string, reason: string) => {
29
+ if (!id || !pending.queue.includes(id)) {
30
+ return
31
+ }
32
+
33
+ pending.queue = pending.queue.filter(i => i !== id)
34
+ console.log(`request ${id} ended (${reason})`)
35
+ }
36
+
37
+ app.get('/debug', (req, res) => {
38
+ res.write(JSON.stringify({
39
+ nbTotal: pending.total,
40
+ nbPending: pending.queue.length,
41
+ queue: pending.queue,
42
+ }))
43
+ res.end()
44
+ })
45
+
46
+ app.get('/app', async (req, res) => {
47
+ if (`${req.query.prompt}`.length < minPromptSize) {
48
+ res.write(`prompt too short, please enter at least ${minPromptSize} characters`)
49
+ res.end()
50
+ return
51
+ }
52
+
53
+ const id = `${pending.total++}`
54
+ console.log(`new request ${id}`)
55
+
56
+ pending.queue.push(id)
57
+
58
+
59
+ req.on('close', function() {
60
+ endRequest(id, 'browser asked to end the connection')
61
+ })
62
+
63
+ setTimeout(() => {
64
+ endRequest(id, `timed out after ${timeoutInSec}s`)
65
+ }, timeoutInSec * 1000)
66
+
67
+ let nbAttempts = 3
68
+
69
+ let files = []
70
+
71
+ while (nbAttempts-- > 0) {
72
+ files = await generateFiles(`${req.query.prompt ||Β ""}`)
73
+ if (files.length) {
74
+ console.log(`seems like we have ${files.length} files`)
75
+ break
76
+ }
77
+ }
78
+
79
+ console.log("files:", JSON.stringify(files, null, 2))
80
+
81
+ await createSpace(files)
82
+
83
+ res.write(JSON.stringify(files, null, 2))
84
+ res.end()
85
+ })
86
+
87
+
88
+ app.listen(port, () => { console.log(`Open http://localhost:${port}`) })
89
+
src/parseTutorial.mts ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ export function parseTutorial(text: string): Array<{ filename: string; content: string }> {
2
+ const result: { filename: string; content: string; }[] = [];
3
+ const regex = /# In (?:the )?(.*):\n```(?:\w+\n)?([\s\S]*?)```/g;
4
+ let match: RegExpExecArray | null;
5
+ while ((match = regex.exec(text)) !== null) {
6
+ result.push({
7
+ filename: match[1],
8
+ content: match[2].trim(),
9
+ });
10
+ }
11
+ return result;
12
+ }
src/streamlitDoc.mts ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ export const streamlitDoc = `
2
+ # Streamlit Documentation
3
+ ## st.number_input(label, min_value=None, max_value=None, value=, step=None, format=None, key=None, help=None, on_change=None, args=None, kwargs=None, *, disabled=False, label_visibility="visible")
4
+ Display a numeric input widget.
5
+ Parameters
6
+ ----------
7
+ label : str
8
+ A short label explaining to the user what this input is for.
9
+ The label can optionally contain Markdown and supports the following
10
+ elements: Bold, Italics, Strikethroughs, Inline Code, Emojis, and Links.
11
+ This also supports:
12
+ * Emoji shortcodes, such as \`:+1:\` and \`:sunglasses:\`.
13
+ For a list of all supported codes,
14
+ see https://share.streamlit.io/streamlit/emoji-shortcodes.
15
+ * LaTeX expressions, by wrapping them in "$" or "$$" (the "$$"
16
+ must be on their own lines). Supported LaTeX functions are listed
17
+ at https://katex.org/docs/supported.html.
18
+ * Colored text, using the syntax \`:color[text to be colored]\`,
19
+ where \`color\` needs to be replaced with any of the following
20
+ supported colors: blue, green, orange, red, violet, gray/grey, rainbow.
21
+ Unsupported elements are unwrapped so only their children (text contents) render.
22
+ Display unsupported elements as literal characters by
23
+ backslash-escaping them. E.g. \`1\. Not an ordered list\`.
24
+ For accessibility reasons, you should never set an empty label (label="")
25
+ but hide it with label_visibility if needed. In the future, we may disallow
26
+ empty labels by raising an exception.
27
+ min_value : int, float, or None
28
+ The minimum permitted value.
29
+ If None, there will be no minimum.
30
+ max_value : int, float, or None
31
+ The maximum permitted value.
32
+ If None, there will be no maximum.
33
+ value : int, float, or None
34
+ The value of this widget when it first renders.
35
+ Defaults to min_value, or 0.0 if min_value is None
36
+ step : int, float, or None
37
+ The stepping interval.
38
+ Defaults to 1 if the value is an int, 0.01 otherwise.
39
+ If the value is not specified, the format parameter will be used.
40
+ format : str or None
41
+ A printf-style format string controlling how the interface should
42
+ display numbers. Output must be purely numeric. This does not impact
43
+ the return value. Valid formatters: %d %e %f %g %i %u
44
+ key : str or int
45
+ An optional string or integer to use as the unique key for the widget.
46
+ If this is omitted, a key will be generated for the widget
47
+ based on its content. Multiple widgets of the same type may
48
+ not share the same key.
49
+ help : str
50
+ An optional tooltip that gets displayed next to the input.
51
+ on_change : callable
52
+ An optional callback invoked when this number_input's value changes.
53
+ args : tuple
54
+ An optional tuple of args to pass to the callback.
55
+ kwargs : dict
56
+ An optional dict of kwargs to pass to the callback.
57
+ disabled : bool
58
+ An optional boolean, which disables the number input if set to
59
+ True. The default is False. This argument can only be supplied by
60
+ keyword.
61
+ label_visibility : "visible", "hidden", or "collapsed"
62
+ The visibility of the label. If "hidden", the label doesn't show but there
63
+ is still empty space for it above the widget (equivalent to label="").
64
+ If "collapsed", both the label and the space are removed. Default is
65
+ "visible". This argument can only be supplied by keyword.
66
+ Returns
67
+ -------
68
+ int or float
69
+ The current value of the numeric input widget. The return type
70
+ will match the data type of the value parameter.
71
+ Example
72
+ -------
73
+ >>> import streamlit as st
74
+ >>>
75
+ >>> number = st.number_input('Insert a number')
76
+ >>> st.write('The current number is ', number)
77
+ `
src/types.mts ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ export interface RepoFile {
2
+ path: string
3
+ content: string
4
+ }
tsconfig.json ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "compilerOptions": {
3
+ "allowJs": true,
4
+ "esModuleInterop": true,
5
+ "allowSyntheticDefaultImports": true,
6
+ "module": "nodenext",
7
+ "noEmit": true,
8
+ "allowImportingTsExtensions": true,
9
+ "target": "es2017"
10
+ },
11
+ "include": ["**/*.ts", "**/*.mts"],
12
+ }