Spaces:
Sleeping
Sleeping
Upload folder using huggingface_hub
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- .gitattributes +4 -0
- .gradio/certificate.pem +31 -0
- LICENSE +437 -0
- NATURE_texture.png +3 -0
- README.md +161 -7
- TOKEN +1 -0
- app.py +29 -0
- code/__pycache__/bezier.cpython-38.pyc +0 -0
- code/__pycache__/config.cpython-38.pyc +0 -0
- code/__pycache__/losses.cpython-38.pyc +0 -0
- code/__pycache__/save_svg.cpython-38.pyc +0 -0
- code/__pycache__/ttf.cpython-38.pyc +0 -0
- code/__pycache__/utils.cpython-38.pyc +0 -0
- code/bezier.py +122 -0
- code/config.py +104 -0
- code/config/base.yaml +46 -0
- code/data/fonts/Bell MT.ttf +0 -0
- code/data/fonts/DeliusUnicase-Regular.ttf +0 -0
- code/data/fonts/HobeauxRococeaux-Sherman.ttf +0 -0
- code/data/fonts/IndieFlower-Regular.ttf +0 -0
- code/data/fonts/JosefinSans-Light.ttf +0 -0
- code/data/fonts/KaushanScript-Regular.ttf +0 -0
- code/data/fonts/LuckiestGuy-Regular.ttf +0 -0
- code/data/fonts/Noteworthy-Bold.ttf +0 -0
- code/data/fonts/Quicksand.ttf +0 -0
- code/data/fonts/Saira-Regular.ttf +0 -0
- code/data/init/HobeauxRococeaux-Sherman_A.svg +5 -0
- code/data/init/HobeauxRococeaux-Sherman_A_scaled.svg +7 -0
- code/data/init/HobeauxRococeaux-Sherman_E.svg +5 -0
- code/data/init/HobeauxRococeaux-Sherman_E_scaled.svg +7 -0
- code/data/init/HobeauxRococeaux-Sherman_N.svg +5 -0
- code/data/init/HobeauxRococeaux-Sherman_NATURE.svg +16 -0
- code/data/init/HobeauxRococeaux-Sherman_NATURE_scaled.svg +12 -0
- code/data/init/HobeauxRococeaux-Sherman_N_scaled.svg +7 -0
- code/data/init/HobeauxRococeaux-Sherman_R.svg +5 -0
- code/data/init/HobeauxRococeaux-Sherman_R_scaled.svg +7 -0
- code/data/init/HobeauxRococeaux-Sherman_T.svg +5 -0
- code/data/init/HobeauxRococeaux-Sherman_T_scaled.svg +7 -0
- code/data/init/HobeauxRococeaux-Sherman_U.svg +5 -0
- code/data/init/HobeauxRococeaux-Sherman_U_scaled.svg +7 -0
- code/data/init/KaushanScript-Regular_B.svg +5 -0
- code/data/init/KaushanScript-Regular_BUNNY.svg +14 -0
- code/data/init/KaushanScript-Regular_BUNNY_scaled.svg +11 -0
- code/data/init/KaushanScript-Regular_B_scaled.svg +7 -0
- code/data/init/KaushanScript-Regular_N.svg +5 -0
- code/data/init/KaushanScript-Regular_N_scaled.svg +7 -0
- code/data/init/KaushanScript-Regular_U.svg +5 -0
- code/data/init/KaushanScript-Regular_U_scaled.svg +7 -0
- code/data/init/KaushanScript-Regular_Y.svg +5 -0
- code/data/init/KaushanScript-Regular_Y_scaled.svg +7 -0
.gitattributes
CHANGED
@@ -33,3 +33,7 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
36 |
+
NATURE_texture.png filter=lfs diff=lfs merge=lfs -text
|
37 |
+
diffvg/build/lib.linux-x86_64-cpython-38/diffvg.so filter=lfs diff=lfs merge=lfs -text
|
38 |
+
diffvg/build/temp.linux-x86_64-cpython-38/CMakeFiles/diffvg.dir/diffvg_generated_diffvg.cpp.o filter=lfs diff=lfs merge=lfs -text
|
39 |
+
diffvg/dist/diffvg-0.0.1-py3.8-linux-x86_64.egg filter=lfs diff=lfs merge=lfs -text
|
.gradio/certificate.pem
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Attribution-NonCommercial-ShareAlike 4.0 International
|
2 |
+
|
3 |
+
=======================================================================
|
4 |
+
|
5 |
+
Creative Commons Corporation ("Creative Commons") is not a law firm and
|
6 |
+
does not provide legal services or legal advice. Distribution of
|
7 |
+
Creative Commons public licenses does not create a lawyer-client or
|
8 |
+
other relationship. Creative Commons makes its licenses and related
|
9 |
+
information available on an "as-is" basis. Creative Commons gives no
|
10 |
+
warranties regarding its licenses, any material licensed under their
|
11 |
+
terms and conditions, or any related information. Creative Commons
|
12 |
+
disclaims all liability for damages resulting from their use to the
|
13 |
+
fullest extent possible.
|
14 |
+
|
15 |
+
Using Creative Commons Public Licenses
|
16 |
+
|
17 |
+
Creative Commons public licenses provide a standard set of terms and
|
18 |
+
conditions that creators and other rights holders may use to share
|
19 |
+
original works of authorship and other material subject to copyright
|
20 |
+
and certain other rights specified in the public license below. The
|
21 |
+
following considerations are for informational purposes only, are not
|
22 |
+
exhaustive, and do not form part of our licenses.
|
23 |
+
|
24 |
+
Considerations for licensors: Our public licenses are
|
25 |
+
intended for use by those authorized to give the public
|
26 |
+
permission to use material in ways otherwise restricted by
|
27 |
+
copyright and certain other rights. Our licenses are
|
28 |
+
irrevocable. Licensors should read and understand the terms
|
29 |
+
and conditions of the license they choose before applying it.
|
30 |
+
Licensors should also secure all rights necessary before
|
31 |
+
applying our licenses so that the public can reuse the
|
32 |
+
material as expected. Licensors should clearly mark any
|
33 |
+
material not subject to the license. This includes other CC-
|
34 |
+
licensed material, or material used under an exception or
|
35 |
+
limitation to copyright. More considerations for licensors:
|
36 |
+
wiki.creativecommons.org/Considerations_for_licensors
|
37 |
+
|
38 |
+
Considerations for the public: By using one of our public
|
39 |
+
licenses, a licensor grants the public permission to use the
|
40 |
+
licensed material under specified terms and conditions. If
|
41 |
+
the licensor's permission is not necessary for any reason--for
|
42 |
+
example, because of any applicable exception or limitation to
|
43 |
+
copyright--then that use is not regulated by the license. Our
|
44 |
+
licenses grant only permissions under copyright and certain
|
45 |
+
other rights that a licensor has authority to grant. Use of
|
46 |
+
the licensed material may still be restricted for other
|
47 |
+
reasons, including because others have copyright or other
|
48 |
+
rights in the material. A licensor may make special requests,
|
49 |
+
such as asking that all changes be marked or described.
|
50 |
+
Although not required by our licenses, you are encouraged to
|
51 |
+
respect those requests where reasonable. More considerations
|
52 |
+
for the public:
|
53 |
+
wiki.creativecommons.org/Considerations_for_licensees
|
54 |
+
|
55 |
+
=======================================================================
|
56 |
+
|
57 |
+
Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International
|
58 |
+
Public License
|
59 |
+
|
60 |
+
By exercising the Licensed Rights (defined below), You accept and agree
|
61 |
+
to be bound by the terms and conditions of this Creative Commons
|
62 |
+
Attribution-NonCommercial-ShareAlike 4.0 International Public License
|
63 |
+
("Public License"). To the extent this Public License may be
|
64 |
+
interpreted as a contract, You are granted the Licensed Rights in
|
65 |
+
consideration of Your acceptance of these terms and conditions, and the
|
66 |
+
Licensor grants You such rights in consideration of benefits the
|
67 |
+
Licensor receives from making the Licensed Material available under
|
68 |
+
these terms and conditions.
|
69 |
+
|
70 |
+
|
71 |
+
Section 1 -- Definitions.
|
72 |
+
|
73 |
+
a. Adapted Material means material subject to Copyright and Similar
|
74 |
+
Rights that is derived from or based upon the Licensed Material
|
75 |
+
and in which the Licensed Material is translated, altered,
|
76 |
+
arranged, transformed, or otherwise modified in a manner requiring
|
77 |
+
permission under the Copyright and Similar Rights held by the
|
78 |
+
Licensor. For purposes of this Public License, where the Licensed
|
79 |
+
Material is a musical work, performance, or sound recording,
|
80 |
+
Adapted Material is always produced where the Licensed Material is
|
81 |
+
synched in timed relation with a moving image.
|
82 |
+
|
83 |
+
b. Adapter's License means the license You apply to Your Copyright
|
84 |
+
and Similar Rights in Your contributions to Adapted Material in
|
85 |
+
accordance with the terms and conditions of this Public License.
|
86 |
+
|
87 |
+
c. BY-NC-SA Compatible License means a license listed at
|
88 |
+
creativecommons.org/compatiblelicenses, approved by Creative
|
89 |
+
Commons as essentially the equivalent of this Public License.
|
90 |
+
|
91 |
+
d. Copyright and Similar Rights means copyright and/or similar rights
|
92 |
+
closely related to copyright including, without limitation,
|
93 |
+
performance, broadcast, sound recording, and Sui Generis Database
|
94 |
+
Rights, without regard to how the rights are labeled or
|
95 |
+
categorized. For purposes of this Public License, the rights
|
96 |
+
specified in Section 2(b)(1)-(2) are not Copyright and Similar
|
97 |
+
Rights.
|
98 |
+
|
99 |
+
e. Effective Technological Measures means those measures that, in the
|
100 |
+
absence of proper authority, may not be circumvented under laws
|
101 |
+
fulfilling obligations under Article 11 of the WIPO Copyright
|
102 |
+
Treaty adopted on December 20, 1996, and/or similar international
|
103 |
+
agreements.
|
104 |
+
|
105 |
+
f. Exceptions and Limitations means fair use, fair dealing, and/or
|
106 |
+
any other exception or limitation to Copyright and Similar Rights
|
107 |
+
that applies to Your use of the Licensed Material.
|
108 |
+
|
109 |
+
g. License Elements means the license attributes listed in the name
|
110 |
+
of a Creative Commons Public License. The License Elements of this
|
111 |
+
Public License are Attribution, NonCommercial, and ShareAlike.
|
112 |
+
|
113 |
+
h. Licensed Material means the artistic or literary work, database,
|
114 |
+
or other material to which the Licensor applied this Public
|
115 |
+
License.
|
116 |
+
|
117 |
+
i. Licensed Rights means the rights granted to You subject to the
|
118 |
+
terms and conditions of this Public License, which are limited to
|
119 |
+
all Copyright and Similar Rights that apply to Your use of the
|
120 |
+
Licensed Material and that the Licensor has authority to license.
|
121 |
+
|
122 |
+
j. Licensor means the individual(s) or entity(ies) granting rights
|
123 |
+
under this Public License.
|
124 |
+
|
125 |
+
k. NonCommercial means not primarily intended for or directed towards
|
126 |
+
commercial advantage or monetary compensation. For purposes of
|
127 |
+
this Public License, the exchange of the Licensed Material for
|
128 |
+
other material subject to Copyright and Similar Rights by digital
|
129 |
+
file-sharing or similar means is NonCommercial provided there is
|
130 |
+
no payment of monetary compensation in connection with the
|
131 |
+
exchange.
|
132 |
+
|
133 |
+
l. Share means to provide material to the public by any means or
|
134 |
+
process that requires permission under the Licensed Rights, such
|
135 |
+
as reproduction, public display, public performance, distribution,
|
136 |
+
dissemination, communication, or importation, and to make material
|
137 |
+
available to the public including in ways that members of the
|
138 |
+
public may access the material from a place and at a time
|
139 |
+
individually chosen by them.
|
140 |
+
|
141 |
+
m. Sui Generis Database Rights means rights other than copyright
|
142 |
+
resulting from Directive 96/9/EC of the European Parliament and of
|
143 |
+
the Council of 11 March 1996 on the legal protection of databases,
|
144 |
+
as amended and/or succeeded, as well as other essentially
|
145 |
+
equivalent rights anywhere in the world.
|
146 |
+
|
147 |
+
n. You means the individual or entity exercising the Licensed Rights
|
148 |
+
under this Public License. Your has a corresponding meaning.
|
149 |
+
|
150 |
+
|
151 |
+
Section 2 -- Scope.
|
152 |
+
|
153 |
+
a. License grant.
|
154 |
+
|
155 |
+
1. Subject to the terms and conditions of this Public License,
|
156 |
+
the Licensor hereby grants You a worldwide, royalty-free,
|
157 |
+
non-sublicensable, non-exclusive, irrevocable license to
|
158 |
+
exercise the Licensed Rights in the Licensed Material to:
|
159 |
+
|
160 |
+
a. reproduce and Share the Licensed Material, in whole or
|
161 |
+
in part, for NonCommercial purposes only; and
|
162 |
+
|
163 |
+
b. produce, reproduce, and Share Adapted Material for
|
164 |
+
NonCommercial purposes only.
|
165 |
+
|
166 |
+
2. Exceptions and Limitations. For the avoidance of doubt, where
|
167 |
+
Exceptions and Limitations apply to Your use, this Public
|
168 |
+
License does not apply, and You do not need to comply with
|
169 |
+
its terms and conditions.
|
170 |
+
|
171 |
+
3. Term. The term of this Public License is specified in Section
|
172 |
+
6(a).
|
173 |
+
|
174 |
+
4. Media and formats; technical modifications allowed. The
|
175 |
+
Licensor authorizes You to exercise the Licensed Rights in
|
176 |
+
all media and formats whether now known or hereafter created,
|
177 |
+
and to make technical modifications necessary to do so. The
|
178 |
+
Licensor waives and/or agrees not to assert any right or
|
179 |
+
authority to forbid You from making technical modifications
|
180 |
+
necessary to exercise the Licensed Rights, including
|
181 |
+
technical modifications necessary to circumvent Effective
|
182 |
+
Technological Measures. For purposes of this Public License,
|
183 |
+
simply making modifications authorized by this Section 2(a)
|
184 |
+
(4) never produces Adapted Material.
|
185 |
+
|
186 |
+
5. Downstream recipients.
|
187 |
+
|
188 |
+
a. Offer from the Licensor -- Licensed Material. Every
|
189 |
+
recipient of the Licensed Material automatically
|
190 |
+
receives an offer from the Licensor to exercise the
|
191 |
+
Licensed Rights under the terms and conditions of this
|
192 |
+
Public License.
|
193 |
+
|
194 |
+
b. Additional offer from the Licensor -- Adapted Material.
|
195 |
+
Every recipient of Adapted Material from You
|
196 |
+
automatically receives an offer from the Licensor to
|
197 |
+
exercise the Licensed Rights in the Adapted Material
|
198 |
+
under the conditions of the Adapter's License You apply.
|
199 |
+
|
200 |
+
c. No downstream restrictions. You may not offer or impose
|
201 |
+
any additional or different terms or conditions on, or
|
202 |
+
apply any Effective Technological Measures to, the
|
203 |
+
Licensed Material if doing so restricts exercise of the
|
204 |
+
Licensed Rights by any recipient of the Licensed
|
205 |
+
Material.
|
206 |
+
|
207 |
+
6. No endorsement. Nothing in this Public License constitutes or
|
208 |
+
may be construed as permission to assert or imply that You
|
209 |
+
are, or that Your use of the Licensed Material is, connected
|
210 |
+
with, or sponsored, endorsed, or granted official status by,
|
211 |
+
the Licensor or others designated to receive attribution as
|
212 |
+
provided in Section 3(a)(1)(A)(i).
|
213 |
+
|
214 |
+
b. Other rights.
|
215 |
+
|
216 |
+
1. Moral rights, such as the right of integrity, are not
|
217 |
+
licensed under this Public License, nor are publicity,
|
218 |
+
privacy, and/or other similar personality rights; however, to
|
219 |
+
the extent possible, the Licensor waives and/or agrees not to
|
220 |
+
assert any such rights held by the Licensor to the limited
|
221 |
+
extent necessary to allow You to exercise the Licensed
|
222 |
+
Rights, but not otherwise.
|
223 |
+
|
224 |
+
2. Patent and trademark rights are not licensed under this
|
225 |
+
Public License.
|
226 |
+
|
227 |
+
3. To the extent possible, the Licensor waives any right to
|
228 |
+
collect royalties from You for the exercise of the Licensed
|
229 |
+
Rights, whether directly or through a collecting society
|
230 |
+
under any voluntary or waivable statutory or compulsory
|
231 |
+
licensing scheme. In all other cases the Licensor expressly
|
232 |
+
reserves any right to collect such royalties, including when
|
233 |
+
the Licensed Material is used other than for NonCommercial
|
234 |
+
purposes.
|
235 |
+
|
236 |
+
|
237 |
+
Section 3 -- License Conditions.
|
238 |
+
|
239 |
+
Your exercise of the Licensed Rights is expressly made subject to the
|
240 |
+
following conditions.
|
241 |
+
|
242 |
+
a. Attribution.
|
243 |
+
|
244 |
+
1. If You Share the Licensed Material (including in modified
|
245 |
+
form), You must:
|
246 |
+
|
247 |
+
a. retain the following if it is supplied by the Licensor
|
248 |
+
with the Licensed Material:
|
249 |
+
|
250 |
+
i. identification of the creator(s) of the Licensed
|
251 |
+
Material and any others designated to receive
|
252 |
+
attribution, in any reasonable manner requested by
|
253 |
+
the Licensor (including by pseudonym if
|
254 |
+
designated);
|
255 |
+
|
256 |
+
ii. a copyright notice;
|
257 |
+
|
258 |
+
iii. a notice that refers to this Public License;
|
259 |
+
|
260 |
+
iv. a notice that refers to the disclaimer of
|
261 |
+
warranties;
|
262 |
+
|
263 |
+
v. a URI or hyperlink to the Licensed Material to the
|
264 |
+
extent reasonably practicable;
|
265 |
+
|
266 |
+
b. indicate if You modified the Licensed Material and
|
267 |
+
retain an indication of any previous modifications; and
|
268 |
+
|
269 |
+
c. indicate the Licensed Material is licensed under this
|
270 |
+
Public License, and include the text of, or the URI or
|
271 |
+
hyperlink to, this Public License.
|
272 |
+
|
273 |
+
2. You may satisfy the conditions in Section 3(a)(1) in any
|
274 |
+
reasonable manner based on the medium, means, and context in
|
275 |
+
which You Share the Licensed Material. For example, it may be
|
276 |
+
reasonable to satisfy the conditions by providing a URI or
|
277 |
+
hyperlink to a resource that includes the required
|
278 |
+
information.
|
279 |
+
3. If requested by the Licensor, You must remove any of the
|
280 |
+
information required by Section 3(a)(1)(A) to the extent
|
281 |
+
reasonably practicable.
|
282 |
+
|
283 |
+
b. ShareAlike.
|
284 |
+
|
285 |
+
In addition to the conditions in Section 3(a), if You Share
|
286 |
+
Adapted Material You produce, the following conditions also apply.
|
287 |
+
|
288 |
+
1. The Adapter's License You apply must be a Creative Commons
|
289 |
+
license with the same License Elements, this version or
|
290 |
+
later, or a BY-NC-SA Compatible License.
|
291 |
+
|
292 |
+
2. You must include the text of, or the URI or hyperlink to, the
|
293 |
+
Adapter's License You apply. You may satisfy this condition
|
294 |
+
in any reasonable manner based on the medium, means, and
|
295 |
+
context in which You Share Adapted Material.
|
296 |
+
|
297 |
+
3. You may not offer or impose any additional or different terms
|
298 |
+
or conditions on, or apply any Effective Technological
|
299 |
+
Measures to, Adapted Material that restrict exercise of the
|
300 |
+
rights granted under the Adapter's License You apply.
|
301 |
+
|
302 |
+
|
303 |
+
Section 4 -- Sui Generis Database Rights.
|
304 |
+
|
305 |
+
Where the Licensed Rights include Sui Generis Database Rights that
|
306 |
+
apply to Your use of the Licensed Material:
|
307 |
+
|
308 |
+
a. for the avoidance of doubt, Section 2(a)(1) grants You the right
|
309 |
+
to extract, reuse, reproduce, and Share all or a substantial
|
310 |
+
portion of the contents of the database for NonCommercial purposes
|
311 |
+
only;
|
312 |
+
|
313 |
+
b. if You include all or a substantial portion of the database
|
314 |
+
contents in a database in which You have Sui Generis Database
|
315 |
+
Rights, then the database in which You have Sui Generis Database
|
316 |
+
Rights (but not its individual contents) is Adapted Material,
|
317 |
+
including for purposes of Section 3(b); and
|
318 |
+
|
319 |
+
c. You must comply with the conditions in Section 3(a) if You Share
|
320 |
+
all or a substantial portion of the contents of the database.
|
321 |
+
|
322 |
+
For the avoidance of doubt, this Section 4 supplements and does not
|
323 |
+
replace Your obligations under this Public License where the Licensed
|
324 |
+
Rights include other Copyright and Similar Rights.
|
325 |
+
|
326 |
+
|
327 |
+
Section 5 -- Disclaimer of Warranties and Limitation of Liability.
|
328 |
+
|
329 |
+
a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE
|
330 |
+
EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS
|
331 |
+
AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF
|
332 |
+
ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS,
|
333 |
+
IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION,
|
334 |
+
WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
335 |
+
PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS,
|
336 |
+
ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT
|
337 |
+
KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT
|
338 |
+
ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU.
|
339 |
+
|
340 |
+
b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE
|
341 |
+
TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION,
|
342 |
+
NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT,
|
343 |
+
INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES,
|
344 |
+
COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR
|
345 |
+
USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN
|
346 |
+
ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR
|
347 |
+
DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR
|
348 |
+
IN PART, THIS LIMITATION MAY NOT APPLY TO YOU.
|
349 |
+
|
350 |
+
c. The disclaimer of warranties and limitation of liability provided
|
351 |
+
above shall be interpreted in a manner that, to the extent
|
352 |
+
possible, most closely approximates an absolute disclaimer and
|
353 |
+
waiver of all liability.
|
354 |
+
|
355 |
+
|
356 |
+
Section 6 -- Term and Termination.
|
357 |
+
|
358 |
+
a. This Public License applies for the term of the Copyright and
|
359 |
+
Similar Rights licensed here. However, if You fail to comply with
|
360 |
+
this Public License, then Your rights under this Public License
|
361 |
+
terminate automatically.
|
362 |
+
|
363 |
+
b. Where Your right to use the Licensed Material has terminated under
|
364 |
+
Section 6(a), it reinstates:
|
365 |
+
|
366 |
+
1. automatically as of the date the violation is cured, provided
|
367 |
+
it is cured within 30 days of Your discovery of the
|
368 |
+
violation; or
|
369 |
+
|
370 |
+
2. upon express reinstatement by the Licensor.
|
371 |
+
|
372 |
+
For the avoidance of doubt, this Section 6(b) does not affect any
|
373 |
+
right the Licensor may have to seek remedies for Your violations
|
374 |
+
of this Public License.
|
375 |
+
|
376 |
+
c. For the avoidance of doubt, the Licensor may also offer the
|
377 |
+
Licensed Material under separate terms or conditions or stop
|
378 |
+
distributing the Licensed Material at any time; however, doing so
|
379 |
+
will not terminate this Public License.
|
380 |
+
|
381 |
+
d. Sections 1, 5, 6, 7, and 8 survive termination of this Public
|
382 |
+
License.
|
383 |
+
|
384 |
+
|
385 |
+
Section 7 -- Other Terms and Conditions.
|
386 |
+
|
387 |
+
a. The Licensor shall not be bound by any additional or different
|
388 |
+
terms or conditions communicated by You unless expressly agreed.
|
389 |
+
|
390 |
+
b. Any arrangements, understandings, or agreements regarding the
|
391 |
+
Licensed Material not stated herein are separate from and
|
392 |
+
independent of the terms and conditions of this Public License.
|
393 |
+
|
394 |
+
|
395 |
+
Section 8 -- Interpretation.
|
396 |
+
|
397 |
+
a. For the avoidance of doubt, this Public License does not, and
|
398 |
+
shall not be interpreted to, reduce, limit, restrict, or impose
|
399 |
+
conditions on any use of the Licensed Material that could lawfully
|
400 |
+
be made without permission under this Public License.
|
401 |
+
|
402 |
+
b. To the extent possible, if any provision of this Public License is
|
403 |
+
deemed unenforceable, it shall be automatically reformed to the
|
404 |
+
minimum extent necessary to make it enforceable. If the provision
|
405 |
+
cannot be reformed, it shall be severed from this Public License
|
406 |
+
without affecting the enforceability of the remaining terms and
|
407 |
+
conditions.
|
408 |
+
|
409 |
+
c. No term or condition of this Public License will be waived and no
|
410 |
+
failure to comply consented to unless expressly agreed to by the
|
411 |
+
Licensor.
|
412 |
+
|
413 |
+
d. Nothing in this Public License constitutes or may be interpreted
|
414 |
+
as a limitation upon, or waiver of, any privileges and immunities
|
415 |
+
that apply to the Licensor or You, including from the legal
|
416 |
+
processes of any jurisdiction or authority.
|
417 |
+
|
418 |
+
=======================================================================
|
419 |
+
|
420 |
+
Creative Commons is not a party to its public
|
421 |
+
licenses. Notwithstanding, Creative Commons may elect to apply one of
|
422 |
+
its public licenses to material it publishes and in those instances
|
423 |
+
will be considered the “Licensor.” The text of the Creative Commons
|
424 |
+
public licenses is dedicated to the public domain under the CC0 Public
|
425 |
+
Domain Dedication. Except for the limited purpose of indicating that
|
426 |
+
material is shared under a Creative Commons public license or as
|
427 |
+
otherwise permitted by the Creative Commons policies published at
|
428 |
+
creativecommons.org/policies, Creative Commons does not authorize the
|
429 |
+
use of the trademark "Creative Commons" or any other trademark or logo
|
430 |
+
of Creative Commons without its prior written consent including,
|
431 |
+
without limitation, in connection with any unauthorized modifications
|
432 |
+
to any of its public licenses or any other arrangements,
|
433 |
+
understandings, or agreements concerning use of licensed material. For
|
434 |
+
the avoidance of doubt, this paragraph does not form part of the
|
435 |
+
public licenses.
|
436 |
+
|
437 |
+
Creative Commons may be contacted at creativecommons.org.
|
NATURE_texture.png
ADDED
![]() |
Git LFS Details
|
README.md
CHANGED
@@ -1,12 +1,166 @@
|
|
1 |
---
|
2 |
-
title:
|
3 |
-
|
4 |
-
colorFrom: gray
|
5 |
-
colorTo: red
|
6 |
sdk: gradio
|
7 |
sdk_version: 5.9.0
|
8 |
-
app_file: app.py
|
9 |
-
pinned: false
|
10 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
|
12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
+
title: Textured_Word_Illustration
|
3 |
+
app_file: app.py
|
|
|
|
|
4 |
sdk: gradio
|
5 |
sdk_version: 5.9.0
|
|
|
|
|
6 |
---
|
7 |
+
# Word-As-Image for Semantic Typography (SIGGRAPH 2023 - Honorable Mention Award)
|
8 |
+
|
9 |
+
|
10 |
+
|
11 |
+
[![arXiv](https://img.shields.io/badge/📃-arXiv%20-red.svg)](https://arxiv.org/abs/2303.01818)
|
12 |
+
[![webpage](https://img.shields.io/badge/🌐-Website%20-blue.svg)](https://wordasimage.github.io/Word-As-Image-Page/)
|
13 |
+
[![Huggingface space](https://img.shields.io/badge/🤗-Demo%20-yellow.svg)](https://huggingface.co/spaces/SemanticTypography/Word-As-Image)
|
14 |
+
[![Youtube](https://img.shields.io/badge/📽️-Video%20-orchid.svg)](https://www.youtube.com/watch?v=9D12a6RCQaw)
|
15 |
+
|
16 |
+
<br>
|
17 |
+
<div align="center">
|
18 |
+
<img src="images/teaser.png" width="100%">
|
19 |
+
</div>
|
20 |
+
<br><br>
|
21 |
+
A few examples of our <b>W</b>ord-<b>A</b>s-<b>I</b>mage illustrations in various fonts and for different textual concept. The semantically adjusted letters are created
|
22 |
+
completely automatically using our method, and can then be used for further creative design as we illustrate here.<br><br>
|
23 |
+
|
24 |
+
> Shir Iluz*, Yael Vinker*, Amir Hertz, Daniel Berio, Daniel Cohen-Or, Ariel Shamir
|
25 |
+
> \* Denotes equal contribution
|
26 |
+
>
|
27 |
+
>A word-as-image is a semantic typography technique where a word illustration
|
28 |
+
presents a visualization of the meaning of the word, while also
|
29 |
+
preserving its readability. We present a method to create word-as-image
|
30 |
+
illustrations automatically. This task is highly challenging as it requires
|
31 |
+
semantic understanding of the word and a creative idea of where and how to
|
32 |
+
depict these semantics in a visually pleasing and legible manner. We rely on
|
33 |
+
the remarkable ability of recent large pretrained language-vision models to
|
34 |
+
distill textual concepts visually. We target simple, concise, black-and-white
|
35 |
+
designs that convey the semantics clearly.We deliberately do not change the
|
36 |
+
color or texture of the letters and do not use embellishments. Our method
|
37 |
+
optimizes the outline of each letter to convey the desired concept, guided by
|
38 |
+
a pretrained Stable Diffusion model. We incorporate additional loss terms
|
39 |
+
to ensure the legibility of the text and the preservation of the style of the
|
40 |
+
font. We show high quality and engaging results on numerous examples
|
41 |
+
and compare to alternative techniques.
|
42 |
+
|
43 |
+
|
44 |
+
## Description
|
45 |
+
Official implementation of Word-As-Image for Semantic Typography paper.
|
46 |
+
<br>
|
47 |
+
|
48 |
+
## Setup
|
49 |
+
|
50 |
+
1. Clone the repo:
|
51 |
+
```bash
|
52 |
+
git clone https://github.com/WordAsImage/Word-As-Image.git
|
53 |
+
cd Word-As-Image
|
54 |
+
```
|
55 |
+
2. Create a new conda environment and install the libraries:
|
56 |
+
```bash
|
57 |
+
conda create --name word python=3.8.15
|
58 |
+
conda activate word
|
59 |
+
pip install torch==1.12.1+cu113 torchvision==0.13.1+cu113 --extra-index-url https://download.pytorch.org/whl/cu113
|
60 |
+
conda install -y numpy scikit-image
|
61 |
+
conda install -y -c anaconda cmake
|
62 |
+
conda install -y -c conda-forge ffmpeg
|
63 |
+
pip install svgwrite svgpathtools cssutils numba torch-tools scikit-fmm easydict visdom freetype-py shapely
|
64 |
+
pip install opencv-python==4.5.4.60
|
65 |
+
pip install kornia==0.6.8
|
66 |
+
pip install wandb
|
67 |
+
pip install shapely
|
68 |
+
```
|
69 |
+
|
70 |
+
3. Install diffusers:
|
71 |
+
```bash
|
72 |
+
pip install diffusers==0.8
|
73 |
+
pip install transformers scipy ftfy accelerate
|
74 |
+
```
|
75 |
+
4. Install diffvg:
|
76 |
+
```bash
|
77 |
+
git clone https://github.com/BachiLi/diffvg.git
|
78 |
+
cd diffvg
|
79 |
+
git submodule update --init --recursive
|
80 |
+
python setup.py install
|
81 |
+
```
|
82 |
+
|
83 |
+
5. Paste your HuggingFace [access token](https://huggingface.co/settings/tokens) for StableDiffusion in the TOKEN file.
|
84 |
+
## Run Experiments
|
85 |
+
```bash
|
86 |
+
conda activate word
|
87 |
+
cd Word-As-Image
|
88 |
+
|
89 |
+
# Please modify the parameters accordingly in the file and run:
|
90 |
+
bash run_word_as_image.sh
|
91 |
+
|
92 |
+
# Or run :
|
93 |
+
python code/main.py --experiment <experiment> --semantic_concept <concept> --optimized_letter <letter> --seed <seed> --font <font_name> --use_wandb <0/1> --wandb_user <user name>
|
94 |
+
```
|
95 |
+
* ```--semantic_concept``` : the semantic concept to insert
|
96 |
+
* ```--optimized_letter``` : one letter in the word to optimize
|
97 |
+
* ```--font``` : font name, the <font name>.ttf file should be located in code/data/fonts/
|
98 |
+
|
99 |
+
Optional arguments:
|
100 |
+
* ```--word``` : The text to work on, default: the semantic concept
|
101 |
+
* ```--config``` : Path to config file, default: code/config/base.yaml
|
102 |
+
* ```--experiment``` : You can specify any experiment in the config file, default: conformal_0.5_dist_pixel_100_kernel201
|
103 |
+
* ```--log_dir``` : Default: output folder
|
104 |
+
* ```--prompt_suffix``` : Default: "minimal flat 2d vector. lineal color. trending on artstation"
|
105 |
+
|
106 |
+
### Examples
|
107 |
+
```bash
|
108 |
+
python code/main.py --semantic_concept "BUNNY" --optimized_letter "Y" --font "KaushanScript-Regular" --seed 0
|
109 |
+
```
|
110 |
+
<br>
|
111 |
+
<div align="center">
|
112 |
+
<img src="images/KaushanScript-Regular_BUNNY_Y.svg" width="22%">
|
113 |
+
</div>
|
114 |
+
|
115 |
+
|
116 |
+
```bash
|
117 |
+
python code/main.py --semantic_concept "LEAVES" --word "NATURE" --optimized_letter "T" --font "HobeauxRococeaux-Sherman" --seed 0
|
118 |
+
```
|
119 |
+
<br>
|
120 |
+
<div align="center">
|
121 |
+
<img src="images/HobeauxRococeaux-Sherman_NATURE_T.svg" width="25%">
|
122 |
+
</div>
|
123 |
+
|
124 |
+
* Pay attention, as the arguments are case-sensitive, but it can handle both upper and lowercase letters depending on the input letters.
|
125 |
+
|
126 |
+
|
127 |
+
## Tips
|
128 |
+
If the outcome does not meet your quality expectations, you could try the following options:
|
129 |
+
|
130 |
+
1. Adjusting the weight 𝛼 of the L𝑎𝑐𝑎𝑝 loss, which preserves the letter's structure after deformation.
|
131 |
+
2. Modifying the 𝜎 parameter of the low-pass filter used in the L𝑡𝑜𝑛𝑒 loss, which limits the degree of deviation from the original letter.
|
132 |
+
3. Changing the number of control points, as this can influence the outputs.
|
133 |
+
4. Experimenting with different seeds, as each may produce slightly different results.
|
134 |
+
5. Changing the font type, as this can also result in various outputs.
|
135 |
+
|
136 |
+
|
137 |
+
|
138 |
|
139 |
+
## Acknowledgement
|
140 |
+
Our implementation is based ob Stable Diffusion text-to-image model from Hugging Face's [Diffusers](https://github.com/huggingface/diffusers) library, combined with [Diffvg](https://github.com/BachiLi/diffvg). The framework is built on [Live](https://github.com/Picsart-AI-Research/LIVE-Layerwise-Image-Vectorization).
|
141 |
+
|
142 |
+
## Citation
|
143 |
+
If you use this code for your research, please cite the following work:
|
144 |
+
```
|
145 |
+
@article{IluzVinker2023,
|
146 |
+
author = {Iluz, Shir and Vinker, Yael and Hertz, Amir and Berio, Daniel and Cohen-Or, Daniel and Shamir, Ariel},
|
147 |
+
title = {Word-As-Image for Semantic Typography},
|
148 |
+
year = {2023},
|
149 |
+
issue_date = {August 2023},
|
150 |
+
publisher = {Association for Computing Machinery},
|
151 |
+
address = {New York, NY, USA},
|
152 |
+
volume = {42},
|
153 |
+
number = {4},
|
154 |
+
issn = {0730-0301},
|
155 |
+
url = {https://doi.org/10.1145/3592123},
|
156 |
+
doi = {10.1145/3592123},
|
157 |
+
journal = {ACM Trans. Graph.},
|
158 |
+
month = {jul},
|
159 |
+
articleno = {151},
|
160 |
+
numpages = {11},
|
161 |
+
keywords = {semantic typography, SVG, stable diffusion, fonts}
|
162 |
+
}
|
163 |
+
```
|
164 |
+
|
165 |
+
## Licence
|
166 |
+
This work is licensed under a [Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License](http://creativecommons.org/licenses/by-nc-sa/4.0/).
|
TOKEN
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
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
|
app.py
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
import gradio as gr
|
3 |
+
|
4 |
+
# Define the function to run the command
|
5 |
+
def run_command(concept, word, letter):
|
6 |
+
# Add your logic here for generating the image and saving the filename
|
7 |
+
# Example placeholders:
|
8 |
+
generated_image_path = "generated_image.png" # Path to the generated image
|
9 |
+
saved_filename = f"{concept}_{word}_{letter}.png" # Example saved filename
|
10 |
+
return generated_image_path, saved_filename
|
11 |
+
|
12 |
+
# Create the Gradio interface
|
13 |
+
ui = gr.Interface(
|
14 |
+
fn=run_command,
|
15 |
+
inputs=[
|
16 |
+
gr.Textbox(label="Prompt Semantic Concept", placeholder="Enter a semantic concept, e.g., FLOWER"),
|
17 |
+
gr.Textbox(label="Prompt Word", placeholder="Enter a word, e.g., FLOWER"),
|
18 |
+
gr.Textbox(label="Prompt Letter", placeholder="Enter a letter, e.g., O")
|
19 |
+
],
|
20 |
+
outputs=[
|
21 |
+
gr.Image(label="Generated Image"),
|
22 |
+
gr.Textbox(label="Saved Filename")
|
23 |
+
],
|
24 |
+
title="Stable Diffusion Texture Generator",
|
25 |
+
description="Enter a semantic concept, word, and letter to generate a texture image."
|
26 |
+
)
|
27 |
+
|
28 |
+
# Launch the UI
|
29 |
+
ui.launch(debug=True)
|
code/__pycache__/bezier.cpython-38.pyc
ADDED
Binary file (4.65 kB). View file
|
|
code/__pycache__/config.cpython-38.pyc
ADDED
Binary file (3.02 kB). View file
|
|
code/__pycache__/losses.cpython-38.pyc
ADDED
Binary file (7.32 kB). View file
|
|
code/__pycache__/save_svg.cpython-38.pyc
ADDED
Binary file (4.64 kB). View file
|
|
code/__pycache__/ttf.cpython-38.pyc
ADDED
Binary file (9.41 kB). View file
|
|
code/__pycache__/utils.cpython-38.pyc
ADDED
Binary file (7.95 kB). View file
|
|
code/bezier.py
ADDED
@@ -0,0 +1,122 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import numpy as np
|
2 |
+
import matplotlib.pyplot as plt
|
3 |
+
from scipy.special import binom
|
4 |
+
from numpy.linalg import norm
|
5 |
+
|
6 |
+
def num_bezier(n_ctrl, degree=3):
|
7 |
+
if type(n_ctrl) == np.ndarray:
|
8 |
+
n_ctrl = len(n_ctrl)
|
9 |
+
return int((n_ctrl - 1) / degree)
|
10 |
+
|
11 |
+
def bernstein(n, i):
|
12 |
+
bi = binom(n, i)
|
13 |
+
return lambda t, bi=bi, n=n, i=i: bi * t**i * (1 - t)**(n - i)
|
14 |
+
|
15 |
+
def bezier(P, t, d=0):
|
16 |
+
'''Bezier curve of degree len(P)-1. d is the derivative order (0 gives positions)'''
|
17 |
+
n = P.shape[0] - 1
|
18 |
+
if d > 0:
|
19 |
+
Q = np.diff(P, axis=0)*n
|
20 |
+
return bezier(Q, t, d-1)
|
21 |
+
B = np.vstack([bernstein(n, i)(t) for i, p in enumerate(P)])
|
22 |
+
return (P.T @ B).T
|
23 |
+
|
24 |
+
def cubic_bezier(P, t):
|
25 |
+
return (1.0-t)**3*P[0] + 3*(1.0-t)**2*t*P[1] + 3*(1.0-t)*t**2*P[2] + t**3*P[3]
|
26 |
+
|
27 |
+
def bezier_piecewise(Cp, subd=100, degree=3, d=0):
|
28 |
+
''' sample a piecewise Bezier curve given a sequence of control points'''
|
29 |
+
num = num_bezier(Cp.shape[0], degree)
|
30 |
+
X = []
|
31 |
+
for i in range(num):
|
32 |
+
P = Cp[i*degree:i*degree+degree+1, :]
|
33 |
+
t = np.linspace(0, 1., subd)[:-1]
|
34 |
+
Y = bezier(P, t, d)
|
35 |
+
X += [Y]
|
36 |
+
X.append(Cp[-1])
|
37 |
+
X = np.vstack(X)
|
38 |
+
return X
|
39 |
+
|
40 |
+
def compute_beziers(beziers, subd=100, degree=3):
|
41 |
+
chain = beziers_to_chain(beziers)
|
42 |
+
return bezier_piecewise(chain, subd, degree)
|
43 |
+
|
44 |
+
def plot_control_polygon(Cp, degree=3, lw=0.5, linecolor=np.ones(3)*0.1):
|
45 |
+
n_bezier = num_bezier(len(Cp), degree)
|
46 |
+
for i in range(n_bezier):
|
47 |
+
cp = Cp[i*degree:i*degree+degree+1, :]
|
48 |
+
if degree==3:
|
49 |
+
plt.plot(cp[0:2,0], cp[0:2, 1], ':', color=linecolor, linewidth=lw)
|
50 |
+
plt.plot(cp[2:,0], cp[2:,1], ':', color=linecolor, linewidth=lw)
|
51 |
+
plt.plot(cp[:,0], cp[:,1], 'o', color=[0, 0.5, 1.], markersize=4)
|
52 |
+
else:
|
53 |
+
plt.plot(cp[:,0], cp[:,1], ':', color=linecolor, linewidth=lw)
|
54 |
+
plt.plot(cp[:,0], cp[:,1], 'o', color=[0, 0.5, 1.])
|
55 |
+
|
56 |
+
|
57 |
+
def chain_to_beziers(chain, degree=3):
|
58 |
+
''' Convert Bezier chain to list of curve segments (4 control points each)'''
|
59 |
+
num = num_bezier(chain.shape[0], degree)
|
60 |
+
beziers = []
|
61 |
+
for i in range(num):
|
62 |
+
beziers.append(chain[i*degree:i*degree+degree+1,:])
|
63 |
+
return beziers
|
64 |
+
|
65 |
+
|
66 |
+
def beziers_to_chain(beziers):
|
67 |
+
''' Convert list of Bezier curve segments to a piecewise bezier chain (shares vertices)'''
|
68 |
+
n = len(beziers)
|
69 |
+
chain = []
|
70 |
+
for i in range(n):
|
71 |
+
chain.append(list(beziers[i][:-1]))
|
72 |
+
chain.append([beziers[-1][-1]])
|
73 |
+
return np.array(sum(chain, []))
|
74 |
+
|
75 |
+
|
76 |
+
def split_cubic(bez, t):
|
77 |
+
p1, p2, p3, p4 = bez
|
78 |
+
|
79 |
+
p12 = (p2 - p1) * t + p1
|
80 |
+
p23 = (p3 - p2) * t + p2
|
81 |
+
p34 = (p4 - p3) * t + p3
|
82 |
+
|
83 |
+
p123 = (p23 - p12) * t + p12
|
84 |
+
p234 = (p34 - p23) * t + p23
|
85 |
+
|
86 |
+
p1234 = (p234 - p123) * t + p123
|
87 |
+
|
88 |
+
return np.array([p1, p12, p123, p1234]), np.array([p1234, p234, p34, p4])
|
89 |
+
|
90 |
+
|
91 |
+
def approx_arc_length(bez):
|
92 |
+
c0, c1, c2, c3 = bez
|
93 |
+
v0 = norm(c1-c0)*0.15
|
94 |
+
v1 = norm(-0.558983582205757*c0 + 0.325650248872424*c1 + 0.208983582205757*c2 + 0.024349751127576*c3)
|
95 |
+
v2 = norm(c3-c0+c2-c1)*0.26666666666666666
|
96 |
+
v3 = norm(-0.024349751127576*c0 - 0.208983582205757*c1 - 0.325650248872424*c2 + 0.558983582205757*c3)
|
97 |
+
v4 = norm(c3-c2)*.15
|
98 |
+
return v0 + v1 + v2 + v3 + v4
|
99 |
+
|
100 |
+
|
101 |
+
def subdivide_bezier(bez, thresh):
|
102 |
+
stack = [bez]
|
103 |
+
res = []
|
104 |
+
while stack:
|
105 |
+
bez = stack.pop()
|
106 |
+
l = approx_arc_length(bez)
|
107 |
+
if l < thresh:
|
108 |
+
res.append(bez)
|
109 |
+
else:
|
110 |
+
b1, b2 = split_cubic(bez, 0.5)
|
111 |
+
stack += [b2, b1]
|
112 |
+
return res
|
113 |
+
|
114 |
+
def subdivide_bezier_chain(C, thresh):
|
115 |
+
beziers = chain_to_beziers(C)
|
116 |
+
res = []
|
117 |
+
for bez in beziers:
|
118 |
+
res += subdivide_bezier(bez, thresh)
|
119 |
+
return beziers_to_chain(res)
|
120 |
+
|
121 |
+
|
122 |
+
|
code/config.py
ADDED
@@ -0,0 +1,104 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import argparse
|
2 |
+
import os.path as osp
|
3 |
+
import yaml
|
4 |
+
import random
|
5 |
+
from easydict import EasyDict as edict
|
6 |
+
import numpy.random as npr
|
7 |
+
import torch
|
8 |
+
from utils import (
|
9 |
+
edict_2_dict,
|
10 |
+
check_and_create_dir,
|
11 |
+
update)
|
12 |
+
import wandb
|
13 |
+
import warnings
|
14 |
+
warnings.filterwarnings("ignore")
|
15 |
+
|
16 |
+
|
17 |
+
def parse_args():
|
18 |
+
parser = argparse.ArgumentParser()
|
19 |
+
parser.add_argument("--config", type=str, default="code/config/base.yaml")
|
20 |
+
parser.add_argument("--experiment", type=str, default="conformal_0.5_dist_pixel_100_kernel201")
|
21 |
+
parser.add_argument("--seed", type=int, default=0)
|
22 |
+
parser.add_argument('--log_dir', metavar='DIR', default="output")
|
23 |
+
parser.add_argument('--font', type=str, default="none", help="font name")
|
24 |
+
parser.add_argument('--semantic_concept', type=str, help="the semantic concept to insert")
|
25 |
+
parser.add_argument('--word', type=str, default="none", help="the text to work on")
|
26 |
+
parser.add_argument('--prompt_suffix', type=str, default="minimal flat 2d vector. lineal color."
|
27 |
+
" trending on artstation")
|
28 |
+
parser.add_argument('--optimized_letter', type=str, default="none", help="the letter in the word to optimize")
|
29 |
+
parser.add_argument('--batch_size', type=int, default=1)
|
30 |
+
parser.add_argument('--use_wandb', type=int, default=0)
|
31 |
+
parser.add_argument('--wandb_user', type=str, default="none")
|
32 |
+
|
33 |
+
cfg = edict()
|
34 |
+
args = parser.parse_args()
|
35 |
+
with open('TOKEN', 'r') as f:
|
36 |
+
setattr(args, 'token', f.read().replace('\n', ''))
|
37 |
+
cfg.config = args.config
|
38 |
+
cfg.experiment = args.experiment
|
39 |
+
cfg.seed = args.seed
|
40 |
+
cfg.font = args.font
|
41 |
+
cfg.semantic_concept = args.semantic_concept
|
42 |
+
cfg.word = cfg.semantic_concept if args.word == "none" else args.word
|
43 |
+
if " " in cfg.word:
|
44 |
+
raise ValueError(f'no spaces are allowed')
|
45 |
+
cfg.caption = f"a {args.semantic_concept}. {args.prompt_suffix}"
|
46 |
+
cfg.log_dir = f"{args.log_dir}/{args.experiment}_{cfg.word}"
|
47 |
+
if args.optimized_letter in cfg.word:
|
48 |
+
cfg.optimized_letter = args.optimized_letter
|
49 |
+
else:
|
50 |
+
raise ValueError(f'letter should be in word')
|
51 |
+
cfg.batch_size = args.batch_size
|
52 |
+
cfg.token = args.token
|
53 |
+
cfg.use_wandb = args.use_wandb
|
54 |
+
cfg.wandb_user = args.wandb_user
|
55 |
+
cfg.letter = f"{args.font}_{args.optimized_letter}_scaled"
|
56 |
+
cfg.target = f"code/data/init/{cfg.letter}"
|
57 |
+
|
58 |
+
return cfg
|
59 |
+
|
60 |
+
|
61 |
+
def set_config():
|
62 |
+
|
63 |
+
cfg_arg = parse_args()
|
64 |
+
with open(cfg_arg.config, 'r') as f:
|
65 |
+
cfg_full = yaml.load(f, Loader=yaml.FullLoader)
|
66 |
+
|
67 |
+
# recursively traverse parent_config pointers in the config dicts
|
68 |
+
cfg_key = cfg_arg.experiment
|
69 |
+
cfgs = [cfg_arg]
|
70 |
+
while cfg_key:
|
71 |
+
cfgs.append(cfg_full[cfg_key])
|
72 |
+
cfg_key = cfgs[-1].get('parent_config', 'baseline')
|
73 |
+
|
74 |
+
# allowing children configs to override their parents
|
75 |
+
cfg = edict()
|
76 |
+
for options in reversed(cfgs):
|
77 |
+
update(cfg, options)
|
78 |
+
del cfgs
|
79 |
+
|
80 |
+
# set experiment dir
|
81 |
+
signature = f"{cfg.letter}_concept_{cfg.semantic_concept}_seed_{cfg.seed}"
|
82 |
+
cfg.experiment_dir = \
|
83 |
+
osp.join(cfg.log_dir, cfg.font, signature)
|
84 |
+
configfile = osp.join(cfg.experiment_dir, 'config.yaml')
|
85 |
+
print('Config:', cfg)
|
86 |
+
|
87 |
+
# create experiment dir and save config
|
88 |
+
check_and_create_dir(configfile)
|
89 |
+
with open(osp.join(configfile), 'w') as f:
|
90 |
+
yaml.dump(edict_2_dict(cfg), f)
|
91 |
+
|
92 |
+
if cfg.use_wandb:
|
93 |
+
wandb.init(project="Word-As-Image", entity=cfg.wandb_user,
|
94 |
+
config=cfg, name=f"{signature}", id=wandb.util.generate_id())
|
95 |
+
|
96 |
+
if cfg.seed is not None:
|
97 |
+
random.seed(cfg.seed)
|
98 |
+
npr.seed(cfg.seed)
|
99 |
+
torch.manual_seed(cfg.seed)
|
100 |
+
torch.backends.cudnn.benchmark = False
|
101 |
+
else:
|
102 |
+
assert False
|
103 |
+
|
104 |
+
return cfg
|
code/config/base.yaml
ADDED
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
baseline:
|
2 |
+
parent_config: ''
|
3 |
+
save:
|
4 |
+
init: true
|
5 |
+
image: true
|
6 |
+
video: true
|
7 |
+
video_frame_freq: 1
|
8 |
+
trainable:
|
9 |
+
point: true
|
10 |
+
lr_base:
|
11 |
+
point: 1
|
12 |
+
lr:
|
13 |
+
lr_init: 0.002
|
14 |
+
lr_final: 0.0008
|
15 |
+
lr_delay_mult: 0.1
|
16 |
+
lr_delay_steps: 100
|
17 |
+
num_iter: 2
|
18 |
+
render_size: 600
|
19 |
+
cut_size: 512
|
20 |
+
level_of_cc: 0 # 0 - original number of cc / 1 - recommended / 2 - more control points
|
21 |
+
seed: 0
|
22 |
+
diffusion:
|
23 |
+
model: "runwayml/stable-diffusion-v1-5"
|
24 |
+
timesteps: 1000
|
25 |
+
guidance_scale: 100
|
26 |
+
loss:
|
27 |
+
use_sds_loss: true
|
28 |
+
tone:
|
29 |
+
use_tone_loss: false
|
30 |
+
conformal:
|
31 |
+
use_conformal_loss: false
|
32 |
+
|
33 |
+
conformal_0.5_dist_pixel_100_kernel201:
|
34 |
+
parent_config: baseline
|
35 |
+
level_of_cc: 1
|
36 |
+
loss:
|
37 |
+
tone:
|
38 |
+
use_tone_loss: true
|
39 |
+
dist_loss_weight: 100
|
40 |
+
pixel_dist_kernel_blur: 201
|
41 |
+
pixel_dist_sigma: 30
|
42 |
+
conformal:
|
43 |
+
use_conformal_loss: true
|
44 |
+
angeles_w: 0.5
|
45 |
+
|
46 |
+
|
code/data/fonts/Bell MT.ttf
ADDED
Binary file (84.8 kB). View file
|
|
code/data/fonts/DeliusUnicase-Regular.ttf
ADDED
Binary file (31.5 kB). View file
|
|
code/data/fonts/HobeauxRococeaux-Sherman.ttf
ADDED
Binary file (117 kB). View file
|
|
code/data/fonts/IndieFlower-Regular.ttf
ADDED
Binary file (55.4 kB). View file
|
|
code/data/fonts/JosefinSans-Light.ttf
ADDED
Binary file (59.3 kB). View file
|
|
code/data/fonts/KaushanScript-Regular.ttf
ADDED
Binary file (184 kB). View file
|
|
code/data/fonts/LuckiestGuy-Regular.ttf
ADDED
Binary file (58.3 kB). View file
|
|
code/data/fonts/Noteworthy-Bold.ttf
ADDED
Binary file (248 kB). View file
|
|
code/data/fonts/Quicksand.ttf
ADDED
Binary file (124 kB). View file
|
|
code/data/fonts/Saira-Regular.ttf
ADDED
Binary file (82.8 kB). View file
|
|
code/data/init/HobeauxRococeaux-Sherman_A.svg
ADDED
|
code/data/init/HobeauxRococeaux-Sherman_A_scaled.svg
ADDED
|
code/data/init/HobeauxRococeaux-Sherman_E.svg
ADDED
|
code/data/init/HobeauxRococeaux-Sherman_E_scaled.svg
ADDED
|
code/data/init/HobeauxRococeaux-Sherman_N.svg
ADDED
|
code/data/init/HobeauxRococeaux-Sherman_NATURE.svg
ADDED
|
code/data/init/HobeauxRococeaux-Sherman_NATURE_scaled.svg
ADDED
|
code/data/init/HobeauxRococeaux-Sherman_N_scaled.svg
ADDED
|
code/data/init/HobeauxRococeaux-Sherman_R.svg
ADDED
|
code/data/init/HobeauxRococeaux-Sherman_R_scaled.svg
ADDED
|
code/data/init/HobeauxRococeaux-Sherman_T.svg
ADDED
|
code/data/init/HobeauxRococeaux-Sherman_T_scaled.svg
ADDED
|
code/data/init/HobeauxRococeaux-Sherman_U.svg
ADDED
|
code/data/init/HobeauxRococeaux-Sherman_U_scaled.svg
ADDED
|
code/data/init/KaushanScript-Regular_B.svg
ADDED
|
code/data/init/KaushanScript-Regular_BUNNY.svg
ADDED
|
code/data/init/KaushanScript-Regular_BUNNY_scaled.svg
ADDED
|
code/data/init/KaushanScript-Regular_B_scaled.svg
ADDED
|
code/data/init/KaushanScript-Regular_N.svg
ADDED
|
code/data/init/KaushanScript-Regular_N_scaled.svg
ADDED
|
code/data/init/KaushanScript-Regular_U.svg
ADDED
|
code/data/init/KaushanScript-Regular_U_scaled.svg
ADDED
|
code/data/init/KaushanScript-Regular_Y.svg
ADDED
|
code/data/init/KaushanScript-Regular_Y_scaled.svg
ADDED
|