vumichien commited on
Commit
2728346
1 Parent(s): b2e6f3b

Upload folder using huggingface_hub

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .idea/.gitignore +8 -0
  2. .idea/ai-comic-generation.iml +8 -0
  3. .idea/inspectionProfiles/Project_Default.xml +41 -0
  4. .idea/inspectionProfiles/profiles_settings.xml +6 -0
  5. .idea/misc.xml +4 -0
  6. .idea/modules.xml +8 -0
  7. .idea/vcs.xml +6 -0
  8. .idea/workspace.xml +46 -0
  9. CONTRIBUTORS.md +9 -0
  10. Dockerfile +65 -0
  11. LICENCE.md +170 -0
  12. README.md +149 -6
  13. components.json +16 -0
  14. next.config.js +11 -0
  15. package-lock.json +0 -0
  16. package.json +74 -0
  17. postcss.config.js +6 -0
  18. public/bubble.jpg +0 -0
  19. public/favicon.ico +0 -0
  20. public/favicon/Icon/r +0 -0
  21. public/favicon/favicon-114-precomposed.png +0 -0
  22. public/favicon/favicon-120-precomposed.png +0 -0
  23. public/favicon/favicon-144-precomposed.png +0 -0
  24. public/favicon/favicon-152-precomposed.png +0 -0
  25. public/favicon/favicon-180-precomposed.png +0 -0
  26. public/favicon/favicon-192.png +0 -0
  27. public/favicon/favicon-32.png +0 -0
  28. public/favicon/favicon-36.png +0 -0
  29. public/favicon/favicon-48.png +0 -0
  30. public/favicon/favicon-57.png +0 -0
  31. public/favicon/favicon-60.png +0 -0
  32. public/favicon/favicon-72-precomposed.png +0 -0
  33. public/favicon/favicon-72.png +0 -0
  34. public/favicon/favicon-76.png +0 -0
  35. public/favicon/favicon-96.png +0 -0
  36. public/favicon/favicon.ico +0 -0
  37. public/favicon/index.html +133 -0
  38. public/favicon/manifest.json +41 -0
  39. public/icon.png +0 -0
  40. public/layouts/layout0.jpg +0 -0
  41. public/layouts/layout0_hd.jpg +0 -0
  42. public/layouts/layout1.jpg +0 -0
  43. public/layouts/layout1_hd.jpg +0 -0
  44. public/layouts/layout2.jpg +0 -0
  45. public/layouts/layout2_hd.jpg +0 -0
  46. public/layouts/layout3 hd.jpg +0 -0
  47. public/layouts/layout3.jpg +0 -0
  48. public/mask.png +0 -0
  49. public/next.svg +1 -0
  50. public/vercel.svg +1 -0
.idea/.gitignore ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ # Default ignored files
2
+ /shelf/
3
+ /workspace.xml
4
+ # Datasource local storage ignored files
5
+ /dataSources/
6
+ /dataSources.local.xml
7
+ # Editor-based HTTP Client requests
8
+ /httpRequests/
.idea/ai-comic-generation.iml ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <module type="PYTHON_MODULE" version="4">
3
+ <component name="NewModuleRootManager">
4
+ <content url="file://$MODULE_DIR$" />
5
+ <orderEntry type="jdk" jdkName="Python 3.9 (ai-comic-generation)" jdkType="Python SDK" />
6
+ <orderEntry type="sourceFolder" forTests="false" />
7
+ </component>
8
+ </module>
.idea/inspectionProfiles/Project_Default.xml ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <component name="InspectionProjectProfileManager">
2
+ <profile version="1.0">
3
+ <option name="myName" value="Project Default" />
4
+ <inspection_tool class="Eslint" enabled="true" level="WARNING" enabled_by_default="true" />
5
+ <inspection_tool class="PyPackageRequirementsInspection" enabled="true" level="WARNING" enabled_by_default="true">
6
+ <option name="ignoredPackages">
7
+ <value>
8
+ <list size="27">
9
+ <item index="0" class="java.lang.String" itemvalue="scipy" />
10
+ <item index="1" class="java.lang.String" itemvalue="pydantic" />
11
+ <item index="2" class="java.lang.String" itemvalue="transformers" />
12
+ <item index="3" class="java.lang.String" itemvalue="gradio" />
13
+ <item index="4" class="java.lang.String" itemvalue="joblib" />
14
+ <item index="5" class="java.lang.String" itemvalue="wheel" />
15
+ <item index="6" class="java.lang.String" itemvalue="kenlm" />
16
+ <item index="7" class="java.lang.String" itemvalue="python-dotenv" />
17
+ <item index="8" class="java.lang.String" itemvalue="torch" />
18
+ <item index="9" class="java.lang.String" itemvalue="numpy" />
19
+ <item index="10" class="java.lang.String" itemvalue="requests" />
20
+ <item index="11" class="java.lang.String" itemvalue="python-multipart" />
21
+ <item index="12" class="java.lang.String" itemvalue="pandas" />
22
+ <item index="13" class="java.lang.String" itemvalue="onnxruntime" />
23
+ <item index="14" class="java.lang.String" itemvalue="fastapi" />
24
+ <item index="15" class="java.lang.String" itemvalue="librosa" />
25
+ <item index="16" class="java.lang.String" itemvalue="pyctcdecode" />
26
+ <item index="17" class="java.lang.String" itemvalue="uvicorn" />
27
+ <item index="18" class="java.lang.String" itemvalue="sox" />
28
+ <item index="19" class="java.lang.String" itemvalue="torchaudio" />
29
+ <item index="20" class="java.lang.String" itemvalue="onnx" />
30
+ <item index="21" class="java.lang.String" itemvalue="fuzzywuzzy" />
31
+ <item index="22" class="java.lang.String" itemvalue="tqdm" />
32
+ <item index="23" class="java.lang.String" itemvalue="httpx" />
33
+ <item index="24" class="java.lang.String" itemvalue="pytest" />
34
+ <item index="25" class="java.lang.String" itemvalue="faker" />
35
+ <item index="26" class="java.lang.String" itemvalue="sqlalchemy" />
36
+ </list>
37
+ </value>
38
+ </option>
39
+ </inspection_tool>
40
+ </profile>
41
+ </component>
.idea/inspectionProfiles/profiles_settings.xml ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ <component name="InspectionProjectProfileManager">
2
+ <settings>
3
+ <option name="USE_PROJECT_PROFILE" value="false" />
4
+ <version value="1.0" />
5
+ </settings>
6
+ </component>
.idea/misc.xml ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectRootManager" version="2" project-jdk-name="Python 3.9 (ai-comic-generation)" project-jdk-type="Python SDK" />
4
+ </project>
.idea/modules.xml ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectModuleManager">
4
+ <modules>
5
+ <module fileurl="file://$PROJECT_DIR$/.idea/ai-comic-generation.iml" filepath="$PROJECT_DIR$/.idea/ai-comic-generation.iml" />
6
+ </modules>
7
+ </component>
8
+ </project>
.idea/vcs.xml ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="VcsDirectoryMappings">
4
+ <mapping directory="$PROJECT_DIR$" vcs="Git" />
5
+ </component>
6
+ </project>
.idea/workspace.xml ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ChangeListManager">
4
+ <list default="true" id="5fee7704-f1ec-4a7d-bd58-5f026a6a92ef" name="Default Changelist" comment="">
5
+ <change beforePath="$PROJECT_DIR$/README.md" beforeDir="false" afterPath="$PROJECT_DIR$/README.md" afterDir="false" />
6
+ </list>
7
+ <option name="SHOW_DIALOG" value="false" />
8
+ <option name="HIGHLIGHT_CONFLICTS" value="true" />
9
+ <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
10
+ <option name="LAST_RESOLUTION" value="IGNORE" />
11
+ </component>
12
+ <component name="Git.Settings">
13
+ <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
14
+ </component>
15
+ <component name="ProjectId" id="2WIkGCnmcJe3qdFc4FCv1PZN5ZQ" />
16
+ <component name="ProjectViewState">
17
+ <option name="hideEmptyMiddlePackages" value="true" />
18
+ <option name="showLibraryContents" value="true" />
19
+ </component>
20
+ <component name="PropertiesComponent">
21
+ <property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
22
+ <property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
23
+ <property name="WebServerToolWindowFactoryState" value="false" />
24
+ <property name="last_opened_file_path" value="$PROJECT_DIR$" />
25
+ <property name="node.js.detected.package.eslint" value="true" />
26
+ <property name="node.js.selected.package.eslint" value="(autodetect)" />
27
+ <property name="nodejs_package_manager_path" value="npm" />
28
+ <property name="settings.editor.selected.configurable" value="com.jetbrains.python.configuration.PyActiveSdkModuleConfigurable" />
29
+ <property name="ts.external.directory.path" value="$APPLICATION_HOME_DIR$/plugins/JavaScriptLanguage/jsLanguageServicesImpl/external" />
30
+ </component>
31
+ <component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
32
+ <component name="TaskManager">
33
+ <task active="true" id="Default" summary="Default task">
34
+ <changelist id="5fee7704-f1ec-4a7d-bd58-5f026a6a92ef" name="Default Changelist" comment="" />
35
+ <created>1696427383475</created>
36
+ <option name="number" value="Default" />
37
+ <option name="presentableId" value="Default" />
38
+ <updated>1696427383475</updated>
39
+ <workItem from="1696427385135" duration="333000" />
40
+ </task>
41
+ <servers />
42
+ </component>
43
+ <component name="TypeScriptGeneratedFilesManager">
44
+ <option name="version" value="3" />
45
+ </component>
46
+ </project>
CONTRIBUTORS.md ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ This project was developed by Julian Bilcke (@jbilcke-hf), as part of his work at Hugging Face.
2
+
3
+ ------------------------------------------
4
+
5
+ A huge thanks to external developers for their contributions!
6
+
7
+ 艾逗笔 (@idoubi):
8
+ - Added support for OpenAI: https://github.com/jbilcke-hf/ai-comic-factory/pull/6
9
+
Dockerfile ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM node:18-alpine AS base
2
+
3
+ # Install dependencies only when needed
4
+ FROM base AS deps
5
+ # Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
6
+ RUN apk add --no-cache libc6-compat
7
+ WORKDIR /app
8
+
9
+ # Install dependencies based on the preferred package manager
10
+ COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* ./
11
+ RUN \
12
+ if [ -f yarn.lock ]; then yarn --frozen-lockfile; \
13
+ elif [ -f package-lock.json ]; then npm ci; \
14
+ elif [ -f pnpm-lock.yaml ]; then yarn global add pnpm && pnpm i --frozen-lockfile; \
15
+ else echo "Lockfile not found." && exit 1; \
16
+ fi
17
+
18
+ # Uncomment the following lines if you want to use a secret at buildtime,
19
+ # for example to access your private npm packages
20
+ # RUN --mount=type=secret,id=HF_EXAMPLE_SECRET,mode=0444,required=true \
21
+ # $(cat /run/secrets/HF_EXAMPLE_SECRET)
22
+
23
+ # Rebuild the source code only when needed
24
+ FROM base AS builder
25
+ WORKDIR /app
26
+ COPY --from=deps /app/node_modules ./node_modules
27
+ COPY . .
28
+
29
+ # Next.js collects completely anonymous telemetry data about general usage.
30
+ # Learn more here: https://nextjs.org/telemetry
31
+ # Uncomment the following line in case you want to disable telemetry during the build.
32
+ # ENV NEXT_TELEMETRY_DISABLED 1
33
+
34
+ # RUN yarn build
35
+
36
+ # If you use yarn, comment out this line and use the line above
37
+ RUN npm run build
38
+
39
+ # Production image, copy all the files and run next
40
+ FROM base AS runner
41
+ WORKDIR /app
42
+
43
+ ENV NODE_ENV production
44
+ # Uncomment the following line in case you want to disable telemetry during runtime.
45
+ # ENV NEXT_TELEMETRY_DISABLED 1
46
+
47
+ RUN addgroup --system --gid 1001 nodejs
48
+ RUN adduser --system --uid 1001 nextjs
49
+
50
+ COPY --from=builder /app/public ./public
51
+
52
+ # Automatically leverage output traces to reduce image size
53
+ # https://nextjs.org/docs/advanced-features/output-file-tracing
54
+ COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
55
+ COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
56
+ COPY --from=builder --chown=nextjs:nodejs /app/.next/cache ./.next/cache
57
+ # COPY --from=builder --chown=nextjs:nodejs /app/.next/cache/fetch-cache ./.next/cache/fetch-cache
58
+
59
+ USER nextjs
60
+
61
+ EXPOSE 3000
62
+
63
+ ENV PORT 3000
64
+
65
+ CMD ["node", "server.js"]
LICENCE.md ADDED
@@ -0,0 +1,170 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Apache License
2
+ ==============
3
+
4
+ _Version 2.0, January 2004_
5
+ _&lt;<http://www.apache.org/licenses/>&gt;_
6
+
7
+ ### Terms and Conditions for use, reproduction, and distribution
8
+
9
+ #### 1. Definitions
10
+
11
+ “License” shall mean the terms and conditions for use, reproduction, and
12
+ distribution as defined by Sections 1 through 9 of this document.
13
+
14
+ “Licensor” shall mean the copyright owner or entity authorized by the copyright
15
+ owner that is granting the License.
16
+
17
+ “Legal Entity” shall mean the union of the acting entity and all other entities
18
+ that control, are controlled by, or are under common control with that entity.
19
+ For the purposes of this definition, “control” means **(i)** the power, direct or
20
+ indirect, to cause the direction or management of such entity, whether by
21
+ contract or otherwise, or **(ii)** ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or **(iii)** beneficial ownership of such entity.
23
+
24
+ “You” (or “Your”) shall mean an individual or Legal Entity exercising
25
+ permissions granted by this License.
26
+
27
+ “Source” form shall mean the preferred form for making modifications, including
28
+ but not limited to software source code, documentation source, and configuration
29
+ files.
30
+
31
+ “Object” form shall mean any form resulting from mechanical transformation or
32
+ translation of a Source form, including but not limited to compiled object code,
33
+ generated documentation, and conversions to other media types.
34
+
35
+ “Work” shall mean the work of authorship, whether in Source or Object form, made
36
+ available under the License, as indicated by a copyright notice that is included
37
+ in or attached to the work (an example is provided in the Appendix below).
38
+
39
+ “Derivative Works” shall mean any work, whether in Source or Object form, that
40
+ is based on (or derived from) the Work and for which the editorial revisions,
41
+ annotations, elaborations, or other modifications represent, as a whole, an
42
+ original work of authorship. For the purposes of this License, Derivative Works
43
+ shall not include works that remain separable from, or merely link (or bind by
44
+ name) to the interfaces of, the Work and Derivative Works thereof.
45
+
46
+ “Contribution” shall mean any work of authorship, including the original version
47
+ of the Work and any modifications or additions to that Work or Derivative Works
48
+ thereof, that is intentionally submitted to Licensor for inclusion in the Work
49
+ by the copyright owner or by an individual or Legal Entity authorized to submit
50
+ on behalf of the copyright owner. For the purposes of this definition,
51
+ “submitted” means any form of electronic, verbal, or written communication sent
52
+ to the Licensor or its representatives, including but not limited to
53
+ communication on electronic mailing lists, source code control systems, and
54
+ issue tracking systems that are managed by, or on behalf of, the Licensor for
55
+ the purpose of discussing and improving the Work, but excluding communication
56
+ that is conspicuously marked or otherwise designated in writing by the copyright
57
+ owner as “Not a Contribution.”
58
+
59
+ “Contributor” shall mean Licensor and any individual or Legal Entity on behalf
60
+ of whom a Contribution has been received by Licensor and subsequently
61
+ incorporated within the Work.
62
+
63
+ #### 2. Grant of Copyright License
64
+
65
+ Subject to the terms and conditions of this License, each Contributor hereby
66
+ grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
67
+ irrevocable copyright license to reproduce, prepare Derivative Works of,
68
+ publicly display, publicly perform, sublicense, and distribute the Work and such
69
+ Derivative Works in Source or Object form.
70
+
71
+ #### 3. Grant of Patent License
72
+
73
+ Subject to the terms and conditions of this License, each Contributor hereby
74
+ grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
75
+ irrevocable (except as stated in this section) patent license to make, have
76
+ made, use, offer to sell, sell, import, and otherwise transfer the Work, where
77
+ such license applies only to those patent claims licensable by such Contributor
78
+ that are necessarily infringed by their Contribution(s) alone or by combination
79
+ of their Contribution(s) with the Work to which such Contribution(s) was
80
+ submitted. If You institute patent litigation against any entity (including a
81
+ cross-claim or counterclaim in a lawsuit) alleging that the Work or a
82
+ Contribution incorporated within the Work constitutes direct or contributory
83
+ patent infringement, then any patent licenses granted to You under this License
84
+ for that Work shall terminate as of the date such litigation is filed.
85
+
86
+ #### 4. Redistribution
87
+
88
+ You may reproduce and distribute copies of the Work or Derivative Works thereof
89
+ in any medium, with or without modifications, and in Source or Object form,
90
+ provided that You meet the following conditions:
91
+
92
+ * **(a)** You must give any other recipients of the Work or Derivative Works a copy of
93
+ this License; and
94
+ * **(b)** You must cause any modified files to carry prominent notices stating that You
95
+ changed the files; and
96
+ * **(c)** You must retain, in the Source form of any Derivative Works that You distribute,
97
+ all copyright, patent, trademark, and attribution notices from the Source form
98
+ of the Work, excluding those notices that do not pertain to any part of the
99
+ Derivative Works; and
100
+ * **(d)** If the Work includes a “NOTICE” text file as part of its distribution, then any
101
+ Derivative Works that You distribute must include a readable copy of the
102
+ attribution notices contained within such NOTICE file, excluding those notices
103
+ that do not pertain to any part of the Derivative Works, in at least one of the
104
+ following places: within a NOTICE text file distributed as part of the
105
+ Derivative Works; within the Source form or documentation, if provided along
106
+ with the Derivative Works; or, within a display generated by the Derivative
107
+ Works, if and wherever such third-party notices normally appear. The contents of
108
+ the NOTICE file are for informational purposes only and do not modify the
109
+ License. You may add Your own attribution notices within Derivative Works that
110
+ You distribute, alongside or as an addendum to the NOTICE text from the Work,
111
+ provided that such additional attribution notices cannot be construed as
112
+ modifying the License.
113
+
114
+ You may add Your own copyright statement to Your modifications and may provide
115
+ additional or different license terms and conditions for use, reproduction, or
116
+ distribution of Your modifications, or for any such Derivative Works as a whole,
117
+ provided Your use, reproduction, and distribution of the Work otherwise complies
118
+ with the conditions stated in this License.
119
+
120
+ #### 5. Submission of Contributions
121
+
122
+ Unless You explicitly state otherwise, any Contribution intentionally submitted
123
+ for inclusion in the Work by You to the Licensor shall be under the terms and
124
+ conditions of this License, without any additional terms or conditions.
125
+ Notwithstanding the above, nothing herein shall supersede or modify the terms of
126
+ any separate license agreement you may have executed with Licensor regarding
127
+ such Contributions.
128
+
129
+ #### 6. Trademarks
130
+
131
+ This License does not grant permission to use the trade names, trademarks,
132
+ service marks, or product names of the Licensor, except as required for
133
+ reasonable and customary use in describing the origin of the Work and
134
+ reproducing the content of the NOTICE file.
135
+
136
+ #### 7. Disclaimer of Warranty
137
+
138
+ Unless required by applicable law or agreed to in writing, Licensor provides the
139
+ Work (and each Contributor provides its Contributions) on an “AS IS” BASIS,
140
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
141
+ including, without limitation, any warranties or conditions of TITLE,
142
+ NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are
143
+ solely responsible for determining the appropriateness of using or
144
+ redistributing the Work and assume any risks associated with Your exercise of
145
+ permissions under this License.
146
+
147
+ #### 8. Limitation of Liability
148
+
149
+ In no event and under no legal theory, whether in tort (including negligence),
150
+ contract, or otherwise, unless required by applicable law (such as deliberate
151
+ and grossly negligent acts) or agreed to in writing, shall any Contributor be
152
+ liable to You for damages, including any direct, indirect, special, incidental,
153
+ or consequential damages of any character arising as a result of this License or
154
+ out of the use or inability to use the Work (including but not limited to
155
+ damages for loss of goodwill, work stoppage, computer failure or malfunction, or
156
+ any and all other commercial damages or losses), even if such Contributor has
157
+ been advised of the possibility of such damages.
158
+
159
+ #### 9. Accepting Warranty or Additional Liability
160
+
161
+ While redistributing the Work or Derivative Works thereof, You may choose to
162
+ offer, and charge a fee for, acceptance of support, warranty, indemnity, or
163
+ other liability obligations and/or rights consistent with this License. However,
164
+ in accepting such obligations, You may act only on Your own behalf and on Your
165
+ sole responsibility, not on behalf of any other Contributor, and only if You
166
+ agree to indemnify, defend, and hold each Contributor harmless for any liability
167
+ incurred by, or claims asserted against, such Contributor by reason of your
168
+ accepting any such warranty or additional liability.
169
+
170
+ _END OF TERMS AND CONDITIONS_
README.md CHANGED
@@ -1,10 +1,153 @@
1
  ---
2
- title: Ai Comic Generation
3
- emoji:
4
- colorFrom: purple
5
- colorTo: pink
6
  sdk: docker
7
- pinned: false
 
 
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ title: AI Comic Generation
3
+ emoji: 👩‍🎨
4
+ colorFrom: red
5
+ colorTo: yellow
6
  sdk: docker
7
+ pinned: true
8
+ app_port: 3000
9
+ disable_embedding: true
10
  ---
11
 
12
+ # AI Comic Factory
13
+
14
+ ## Running the project at home
15
+
16
+
17
+ However the project isn't a monolithic Space that can be duplicated and ran immediately:
18
+ it requires various components to run for the frontend, backend, LLM, SDXL etc.
19
+
20
+ If you try to duplicate the project, open the `.env` you will see it requires some variables.
21
+
22
+ Provider config:
23
+ - `LLM_ENGINE`: can be one of: "INFERENCE_API", "INFERENCE_ENDPOINT", "OPENAI"
24
+ - `RENDERING_ENGINE`: can be one of: "INFERENCE_API", "INFERENCE_ENDPOINT", "REPLICATE", "VIDEOCHAIN" for now, unless you code your custom solution
25
+
26
+ Auth config:
27
+ - `AUTH_HF_API_TOKEN`: only if you decide to use OpenAI for the LLM engine necessary if you decide to use an inference api model or a custom inference endpoint
28
+ - `AUTH_OPENAI_TOKEN`: only if you decide to use OpenAI for the LLM engine
29
+ - `AITH_VIDEOCHAIN_API_TOKEN`: secret token to access the VideoChain API server
30
+ - `AUTH_REPLICATE_API_TOKEN`: in case you want to use Replicate.com
31
+
32
+ Rendering config:
33
+ - `RENDERING_HF_INFERENCE_ENDPOINT_URL`: necessary if you decide to use a custom inference endpoint
34
+ - `RENDERING_REPLICATE_API_MODEL_VERSION`: url to the VideoChain API server
35
+ - `RENDERING_HF_INFERENCE_ENDPOINT_URL`: optional, default to nothing
36
+ - `RENDERING_HF_INFERENCE_API_MODEL`: optional, defaults to "stabilityai/stable-diffusion-xl-base-1.0"
37
+ - `RENDERING_REPLICATE_API_MODEL`: optional, defaults to "stabilityai/sdxl"
38
+ - `RENDERING_REPLICATE_API_MODEL_VERSION`: optional, in case you want to change the version
39
+
40
+ Language model config:
41
+ - `LLM_HF_INFERENCE_ENDPOINT_URL`: "https://llama-v2-70b-chat.ngrok.io"
42
+ - `LLM_HF_INFERENCE_API_MODEL`: "codellama/CodeLlama-7b-hf"
43
+
44
+ In addition, there are some community sharing variables that you can just ignore.
45
+ Those variables are not required to run the AI Comic Factory on your own website or computer
46
+ (they are meant to create a connection with the Hugging Face community,
47
+ and thus only make sense for official Hugging Face apps):
48
+ - `NEXT_PUBLIC_ENABLE_COMMUNITY_SHARING`: you don't need this
49
+ - `COMMUNITY_API_URL`: you don't need this
50
+ - `COMMUNITY_API_TOKEN`: you don't need this
51
+ - `COMMUNITY_API_ID`: you don't need this
52
+
53
+ Please read the `.env` default config file for more informations.
54
+ To customise a variable locally, you should create a `.env.local`
55
+ (do not commit this file as it will contain your secrets).
56
+
57
+ -> If you intend to run it with local, cloud-hosted and/or proprietary models **you are going to need to code 👨‍💻**.
58
+
59
+ ## The LLM API (Large Language Model)
60
+
61
+ Currently the AI Comic Factory uses [Llama-2 70b](https://huggingface.co/blog/llama2) through an [Inference Endpoint](https://huggingface.co/docs/inference-endpoints/index).
62
+
63
+ You have three options:
64
+
65
+ ### Option 1: Use an Inference API model
66
+
67
+ This is a new option added recently, where you can use one of the models from the Hugging Face Hub. By default we suggest to use CodeLlama 34b as it will provide better results than the 7b model.
68
+
69
+ To activate it, create a `.env.local` configuration file:
70
+
71
+ ```bash
72
+ LLM_ENGINE="INFERENCE_API"
73
+
74
+ HF_API_TOKEN="Your Hugging Face token"
75
+
76
+ # codellama/CodeLlama-7b-hf" is used by default, but you can change this
77
+ # note: You should use a model able to generate JSON responses,
78
+ # so it is storngly suggested to use at least the 34b model
79
+ HF_INFERENCE_API_MODEL="codellama/CodeLlama-7b-hf"
80
+ ```
81
+
82
+ ### Option 2: Use an Inference Endpoint URL
83
+
84
+ If you would like to run the AI Comic Factory on a private LLM running on the Hugging Face Inference Endpoint service, create a `.env.local` configuration file:
85
+
86
+ ```bash
87
+ LLM_ENGINE="INFERENCE_ENDPOINT"
88
+
89
+ HF_API_TOKEN="Your Hugging Face token"
90
+
91
+ HF_INFERENCE_ENDPOINT_URL="path to your inference endpoint url"
92
+ ```
93
+
94
+ To run this kind of LLM locally, you can use [TGI](https://github.com/huggingface/text-generation-inference) (Please read [this post](https://github.com/huggingface/text-generation-inference/issues/726) for more information about the licensing).
95
+
96
+ ### Option 3: Use an OpenAI API Key
97
+
98
+ This is a new option added recently, where you can use OpenAI API with an OpenAI API Key.
99
+
100
+ To activate it, create a `.env.local` configuration file:
101
+
102
+ ```bash
103
+ LLM_ENGINE="OPENAI"
104
+ # default openai api base url is: https://api.openai.com/v1
105
+ OPENAI_API_BASE_URL="Your OpenAI API Base URL"
106
+ OPENAI_API_KEY="Your OpenAI API Key"
107
+ OPENAI_API_MODEL="gpt-3.5-turbo"
108
+ ```
109
+
110
+ ### Option 4: Fork and modify the code to use a different LLM system
111
+
112
+ Another option could be to disable the LLM completely and replace it with another LLM protocol and/or provider (eg. Claude, Replicate), or a human-generated story instead (by returning mock or static data).
113
+
114
+ ### Notes
115
+
116
+ It is possible that I modify the AI Comic Factory to make it easier in the future (eg. add support for Claude or Replicate)
117
+
118
+ ## The Rendering API
119
+
120
+ This API is used to generate the panel images. This is an API I created for my various projects at Hugging Face.
121
+
122
+ I haven't written documentation for it yet, but basically it is "just a wrapper ™" around other existing APIs:
123
+
124
+ - The [hysts/SD-XL](https://huggingface.co/spaces/hysts/SD-XL?duplicate=true) Space by [@hysts](https://huggingface.co/hysts)
125
+ - And other APIs for making videos, adding audio etc.. but you won't need them for the AI Comic Factory
126
+
127
+ ### Option 1: Deploy VideoChain yourself
128
+
129
+ You will have to [clone](https://huggingface.co/spaces/jbilcke-hf/VideoChain-API?duplicate=true) the [source-code](https://huggingface.co/spaces/jbilcke-hf/VideoChain-API/tree/main)
130
+
131
+ Unfortunately, I haven't had the time to write the documentation for VideoChain yet.
132
+ (When I do I will update this document to point to the VideoChain's README)
133
+
134
+
135
+ ### Option 2: Use Replicate
136
+
137
+ To use Replicate, create a `.env.local` configuration file:
138
+
139
+ ```bash
140
+ RENDERING_ENGINE="REPLICATE"
141
+
142
+ REPLICATE_API_TOKEN="Your Replicate token"
143
+
144
+ REPLICATE_API_MODEL="stabilityai/sdxl"
145
+
146
+ REPLICATE_API_MODEL_VERSION="da77bc59ee60423279fd632efb4795ab731d9e3ca9705ef3341091fb989b7eaf"
147
+ ```
148
+
149
+ ### Option 3: Use another SDXL API
150
+
151
+ If you fork the project you will be able to modify the code to use the Stable Diffusion technology of your choice (local, open-source, proprietary, your custom HF Space etc).
152
+
153
+ It would even be something else, such as Dall-E.
components.json ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "$schema": "https://ui.shadcn.com/schema.json",
3
+ "style": "default",
4
+ "rsc": true,
5
+ "tsx": true,
6
+ "tailwind": {
7
+ "config": "tailwind.config.js",
8
+ "css": "app/globals.css",
9
+ "baseColor": "stone",
10
+ "cssVariables": false
11
+ },
12
+ "aliases": {
13
+ "components": "@/components",
14
+ "utils": "@/lib/utils"
15
+ }
16
+ }
next.config.js ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /** @type {import('next').NextConfig} */
2
+ const nextConfig = {
3
+ output: 'standalone',
4
+
5
+ experimental: {
6
+ serverActions: true,
7
+ serverActionsBodySizeLimit: '8mb',
8
+ },
9
+ }
10
+
11
+ module.exports = nextConfig
package-lock.json ADDED
The diff for this file is too large to render. See raw diff
 
package.json ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "@jbilcke/comic-factory",
3
+ "version": "0.0.0",
4
+ "private": true,
5
+ "scripts": {
6
+ "dev": "next dev",
7
+ "build": "next build",
8
+ "start": "next start",
9
+ "lint": "next lint"
10
+ },
11
+ "dependencies": {
12
+ "@huggingface/inference": "^2.6.1",
13
+ "@radix-ui/react-accordion": "^1.1.2",
14
+ "@radix-ui/react-avatar": "^1.0.3",
15
+ "@radix-ui/react-checkbox": "^1.0.4",
16
+ "@radix-ui/react-collapsible": "^1.0.3",
17
+ "@radix-ui/react-dialog": "^1.0.4",
18
+ "@radix-ui/react-dropdown-menu": "^2.0.5",
19
+ "@radix-ui/react-icons": "^1.3.0",
20
+ "@radix-ui/react-label": "^2.0.2",
21
+ "@radix-ui/react-menubar": "^1.0.3",
22
+ "@radix-ui/react-popover": "^1.0.6",
23
+ "@radix-ui/react-select": "^1.2.2",
24
+ "@radix-ui/react-separator": "^1.0.3",
25
+ "@radix-ui/react-slider": "^1.1.2",
26
+ "@radix-ui/react-slot": "^1.0.2",
27
+ "@radix-ui/react-switch": "^1.0.3",
28
+ "@radix-ui/react-toast": "^1.1.4",
29
+ "@radix-ui/react-tooltip": "^1.0.6",
30
+ "@react-pdf/renderer": "^3.1.12",
31
+ "@types/node": "20.4.2",
32
+ "@types/react": "18.2.15",
33
+ "@types/react-dom": "18.2.7",
34
+ "@types/uuid": "^9.0.2",
35
+ "autoprefixer": "10.4.14",
36
+ "class-variance-authority": "^0.6.1",
37
+ "clsx": "^2.0.0",
38
+ "cmdk": "^0.2.0",
39
+ "cookies-next": "^2.1.2",
40
+ "date-fns": "^2.30.0",
41
+ "encoding": "^0.1.13",
42
+ "eslint": "8.45.0",
43
+ "eslint-config-next": "13.4.10",
44
+ "html2canvas": "^1.4.1",
45
+ "lucide-react": "^0.260.0",
46
+ "next": "13.4.10",
47
+ "openai": "^4.10.0",
48
+ "pick": "^0.0.1",
49
+ "postcss": "8.4.26",
50
+ "react": "18.2.0",
51
+ "react-circular-progressbar": "^2.1.0",
52
+ "react-dom": "18.2.0",
53
+ "react-icons": "^4.11.0",
54
+ "react-virtualized-auto-sizer": "^1.0.20",
55
+ "replicate": "^0.17.0",
56
+ "sbd": "^1.0.19",
57
+ "sharp": "^0.32.5",
58
+ "styled-components": "^6.0.7",
59
+ "tailwind-merge": "^1.13.2",
60
+ "tailwindcss": "3.3.3",
61
+ "tailwindcss-animate": "^1.0.6",
62
+ "tesseract.js": "^4.1.2",
63
+ "ts-node": "^10.9.1",
64
+ "typescript": "5.1.6",
65
+ "usehooks-ts": "^2.9.1",
66
+ "uuid": "^9.0.0",
67
+ "zustand": "^4.4.1"
68
+ },
69
+ "devDependencies": {
70
+ "@types/qs": "^6.9.7",
71
+ "@types/react-virtualized": "^9.21.22",
72
+ "@types/sbd": "^1.0.3"
73
+ }
74
+ }
postcss.config.js ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ module.exports = {
2
+ plugins: {
3
+ tailwindcss: {},
4
+ autoprefixer: {},
5
+ },
6
+ }
public/bubble.jpg ADDED
public/favicon.ico ADDED
public/favicon/Icon/r ADDED
File without changes
public/favicon/favicon-114-precomposed.png ADDED
public/favicon/favicon-120-precomposed.png ADDED
public/favicon/favicon-144-precomposed.png ADDED
public/favicon/favicon-152-precomposed.png ADDED
public/favicon/favicon-180-precomposed.png ADDED
public/favicon/favicon-192.png ADDED
public/favicon/favicon-32.png ADDED
public/favicon/favicon-36.png ADDED
public/favicon/favicon-48.png ADDED
public/favicon/favicon-57.png ADDED
public/favicon/favicon-60.png ADDED
public/favicon/favicon-72-precomposed.png ADDED
public/favicon/favicon-72.png ADDED
public/favicon/favicon-76.png ADDED
public/favicon/favicon-96.png ADDED
public/favicon/favicon.ico ADDED
public/favicon/index.html ADDED
@@ -0,0 +1,133 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <head>
3
+ <title>
4
+ Favicons
5
+ </title>
6
+ <meta charset="utf-8" />
7
+
8
+ <!-- For old IEs -->
9
+ <link rel="shortcut icon" href="favicon.ico" />
10
+
11
+ <!-- For new browsers multisize ico -->
12
+ <link rel="icon" type="image/x-icon" sizes="16x16 32x32" href="favicon.ico">
13
+
14
+ <!-- Chrome for Android -->
15
+ <link rel="icon" sizes="192x192" href="favicon-192.png">
16
+
17
+ <!-- For iPhone 6+ downscaled for other devices -->
18
+ <link rel="apple-touch-icon" sizes="180x180" href="favicon-180-precomposed.png">
19
+
20
+ <!-- For IE10 Metro -->
21
+ <meta name="msapplication-TileColor" content="#FFFFFF">
22
+ <meta name="msapplication-TileImage" content="favicon-114-precomposed.png">
23
+
24
+ <style>
25
+
26
+ body {
27
+ background-color: #f5f5f5;
28
+ border: 0px;
29
+ margin: 0px;
30
+ padding: 0px;
31
+ font-family: Consolas,Menlo,Monaco,Lucida Console,Liberation Mono,DejaVu Sans Mono,Bitstream Vera Sans Mono,Courier New,monospace,serif;
32
+ color: black;
33
+ }
34
+
35
+ pre {
36
+ margin: 0px;
37
+ color: black;
38
+ padding: 0px 5%;
39
+ }
40
+
41
+ code {
42
+
43
+ }
44
+
45
+ .container {
46
+ background-color: white;
47
+ max-width: 800px;
48
+ width: 100%;
49
+ margin: 0 auto;
50
+ padding: 1% 0;
51
+ height: 100%;
52
+ }
53
+
54
+ .comment {
55
+ color: gray;
56
+ padding: 0px;
57
+ margin: 0px;
58
+ }
59
+
60
+ hr {
61
+ width: 80%;
62
+ padding: 0 5%;
63
+ border-color: #f5f5f5;
64
+ background-color: #D1D1D1;
65
+ }
66
+
67
+ p {
68
+ padding: 1% 5%;
69
+ }
70
+
71
+ </style>
72
+
73
+ </head>
74
+ <body class="">
75
+
76
+ <div class="container">
77
+ <p>
78
+ To use the favicons insert into your head section some of these tags accordly to your needs.
79
+ </p>
80
+ <hr>
81
+ <pre>
82
+ <code>
83
+ <span class="comment">&lt;!-- For old IEs --&gt;</span>
84
+ &lt;link rel=&quot;shortcut icon&quot; href=&quot;favicon.ico&quot; /&gt;
85
+
86
+ <span class="comment">&lt;!-- For new browsers - multisize ico --&gt;</span>
87
+ &lt;link rel=&quot;icon&quot; type=&quot;image/x-icon&quot; sizes=&quot;16x16 32x32&quot; href=&quot;favicon.ico&quot;&gt;
88
+
89
+ <span class="comment">&lt;!-- For iPad with high-resolution Retina display running iOS &ge; 7: --&gt;</span>
90
+ &lt;link rel=&quot;apple-touch-icon&quot; sizes=&quot;152x152&quot; href=&quot;favicon-152-precomposed.png&quot;&gt;
91
+
92
+ <span class="comment">&lt;!-- For iPad with high-resolution Retina display running iOS &le; 6: --&gt;</span>
93
+ &lt;link rel=&quot;apple-touch-icon&quot; sizes=&quot;144x144&quot; href=&quot;favicon-144-precomposed.png&quot;&gt;
94
+
95
+ <span class="comment">&lt;!-- For iPhone with high-resolution Retina display running iOS &ge; 7: --&gt;</span>
96
+ &lt;link rel=&quot;apple-touch-icon&quot; sizes=&quot;120x120&quot; href=&quot;favicon-120-precomposed.png&quot;&gt;
97
+
98
+ <span class="comment">&lt;!-- For iPhone with high-resolution Retina display running iOS &le; 6: --&gt;</span>
99
+ &lt;link rel=&quot;apple-touch-icon&quot; sizes=&quot;114x114&quot; href=&quot;favicon-114-precomposed.png&quot;&gt;
100
+
101
+ <span class="comment">&lt;!-- For iPhone 6+ --&gt;</span>
102
+ &lt;link rel=&quot;apple-touch-icon&quot; sizes=&quot;180x180&quot; href=&quot;favicon-180-precomposed.png&quot;&gt;
103
+
104
+ <span class="comment">&lt;!-- For first- and second-generation iPad: --&gt;</span>
105
+ &lt;link rel=&quot;apple-touch-icon&quot; sizes=&quot;72x72&quot; href=&quot;favicon-72-precomposed.png&quot;&gt;
106
+
107
+ <span class="comment">&lt;!-- For non-Retina iPhone, iPod Touch, and Android 2.1+ devices: --&gt;</span>
108
+ &lt;link rel=&quot;apple-touch-icon&quot; sizes=&quot;57x57&quot; href=&quot;favicon-57.png&quot;&gt;
109
+
110
+ <span class="comment">&lt;!-- For Old Chrome --&gt;</span>
111
+ &lt;link rel=&quot;icon&quot; sizes=&quot;32x32&quot; href=&quot;favicon-32.png&quot; &gt;
112
+
113
+ <span class="comment">&lt;!-- For IE10 Metro --&gt;</span>
114
+ &lt;meta name=&quot;msapplication-TileColor&quot; content=&quot;#FFFFFF&quot;&gt;
115
+ &lt;meta name=&quot;msapplication-TileImage&quot; content=&quot;favicon-144.png&quot;&gt;
116
+ &lt;meta name=&quot;theme-color&quot; content=&quot;#ffffff&quot;&gt;
117
+
118
+ <span class="comment">&lt;!-- Chrome for Android --&gt;</span>
119
+ &lt;link rel=&quot;manifest&quot; href=&quot;manifest.json&quot;&gt;
120
+ &lt;link rel=&quot;icon&quot; sizes=&quot;192x192&quot; href=&quot;favicon-192.png&quot;&gt;
121
+
122
+ </code>
123
+ </pre>
124
+
125
+ <hr>
126
+
127
+ <p>
128
+ For more informations about favicons consult <a href="https://github.com/audreyr/favicon-cheat-sheet">The Favicon Cheat Sheet</a> by Audrey Roy.
129
+ </p>
130
+
131
+ </div>
132
+
133
+ </body>
public/favicon/manifest.json ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "pollo",
3
+ "icons": [
4
+ {
5
+ "src": "\/favicon-36.png",
6
+ "sizes": "36x36",
7
+ "type": "image\/png",
8
+ "density": 0.75
9
+ },
10
+ {
11
+ "src": "\/favicon-48.png",
12
+ "sizes": "48x48",
13
+ "type": "image\/png",
14
+ "density": 1
15
+ },
16
+ {
17
+ "src": "\/favicon-72.png",
18
+ "sizes": "72x72",
19
+ "type": "image\/png",
20
+ "density": 1.5
21
+ },
22
+ {
23
+ "src": "\/favicon-96.png",
24
+ "sizes": "96x96",
25
+ "type": "image\/png",
26
+ "density": 2
27
+ },
28
+ {
29
+ "src": "\/favicon-144.png",
30
+ "sizes": "144x144",
31
+ "type": "image\/png",
32
+ "density": 3
33
+ },
34
+ {
35
+ "src": "\/favicon-192.png",
36
+ "sizes": "192x192",
37
+ "type": "image\/png",
38
+ "density": 4
39
+ }
40
+ ]
41
+ }
public/icon.png ADDED
public/layouts/layout0.jpg ADDED
public/layouts/layout0_hd.jpg ADDED
public/layouts/layout1.jpg ADDED
public/layouts/layout1_hd.jpg ADDED
public/layouts/layout2.jpg ADDED
public/layouts/layout2_hd.jpg ADDED
public/layouts/layout3 hd.jpg ADDED
public/layouts/layout3.jpg ADDED
public/mask.png ADDED
public/next.svg ADDED
public/vercel.svg ADDED