{"id":405572,"date":"2024-06-29T18:24:17","date_gmt":"2024-06-29T18:24:17","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=405572"},"modified":"-0001-11-30T00:00:00","modified_gmt":"2024-06-29T18:24:17","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=405572","title":{"rendered":"<span>\u041a\u0430\u043a \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u0430\u0441 \u043f\u043e\u043d\u0438\u043c\u0430\u0435\u0442<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/e50\/ece\/e02\/e50ecee023d0fc0e65f2526f438b032c.jpg\" width=\"780\" height=\"440\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/e50\/ece\/e02\/e50ecee023d0fc0e65f2526f438b032c.jpg\" data-blurred=\"true\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0410\u0432\u0442\u043e\u0440 \u0441\u0442\u0430\u0442\u044c\u0438 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442, \u043a\u0430\u043a \u0437\u0430 \u043d\u0435\u0434\u0435\u043b\u044e \u0441\u043e\u0437\u0434\u0430\u043b Text2Art.com \u2014 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 VQGAN+CLIP, \u0441\u043f\u043e\u0441\u043e\u0431\u043d\u044b\u0439 \u0440\u0438\u0441\u043e\u0432\u0430\u0442\u044c \u043f\u0438\u043a\u0441\u0435\u043b\u044c-\u0430\u0440\u0442 \u0438 \u0436\u0438\u0432\u043e\u043f\u0438\u0441\u044c, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0430\u0442\u044c \u0442\u043e, \u0447\u0442\u043e \u0432\u044b \u043d\u0430\u043f\u0438\u0448\u0435\u0442\u0435 \u0432 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u043e\u043c \u043f\u043e\u043b\u0435. <\/p>\n<p>\u0414\u043b\u044f \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f Gradio, \u043c\u043e\u0434\u0435\u043b\u044c \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435 FastAPI, \u0430 \u0441\u0438\u0441\u0442\u0435\u043c\u043e\u0439 \u043e\u0447\u0435\u0440\u0435\u0434\u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u0441\u043b\u0443\u0436\u0438\u0442 Firebase. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u044f\u043c\u0438 \u0434\u0435\u043b\u0438\u043c\u0441\u044f \u043a \u0441\u0442\u0430\u0440\u0442\u0443 <a href=\"https:\/\/skillfactory.ru\/machine-learning-i-deep-learning?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=data-science_mldl_071021&amp;utm_term=lead\">\u043a\u0443\u0440\u0441\u0430 \u043f\u043e ML \u0438 DL<\/a>.<\/p>\n<hr\/>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/2d6\/c01\/1c4\/2d6c011c4b6a62824d546e3615d4742e.gif\" alt=\"\u0413\u0430\u043b\u0435\u0440\u0435\u044f Text2Art\" title=\"\u0413\u0430\u043b\u0435\u0440\u0435\u044f Text2Art\" width=\"505\" height=\"313\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/2d6\/c01\/1c4\/2d6c011c4b6a62824d546e3615d4742e.gif\"\/><figcaption>\u0413\u0430\u043b\u0435\u0440\u0435\u044f Text2Art<\/figcaption><\/figure>\n<p>\u0415\u0441\u043b\u0438 \u0432\u0430\u043c \u043f\u043e\u043d\u0440\u0430\u0432\u0438\u043b\u0441\u044f \u043f\u0440\u043e\u0435\u043a\u0442, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0440\u043e\u0433\u043e\u043b\u043e\u0441\u043e\u0432\u0430\u0442\u044c \u0437\u0430 \u043d\u0435\u0433\u043e <a href=\"https:\/\/devpost.com\/software\/gancreate\">\u0437\u0434\u0435\u0441\u044c<\/a>.<\/p>\n<div class=\"tm-iframe_temp\" data-src=\"https:\/\/embedd.srv.habr.com\/iframe\/615cab744615593b75e24676\" data-style=\"\" id=\"615cab744615593b75e24676\" width=\"\"><\/div>\n<h2>\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/h2>\n<p>\u041d\u0435 \u0442\u0430\u043a \u0434\u0430\u0432\u043d\u043e \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u044b\u0435 \u043a\u0430\u0440\u0442\u0438\u043d\u044b \u0438 NFT \u0448\u0442\u0443\u0440\u043c\u043e\u043c \u0437\u0430\u0445\u0432\u0430\u0442\u0438\u043b\u0438 \u043c\u0438\u0440. \u042d\u0442\u043e \u0441\u0442\u0430\u043b\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u043c \u043f\u043e\u0441\u043b\u0435 \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0433\u0440\u0435\u0441\u0441\u0430 OpenAI \u0432 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0438\u0437 \u0442\u0435\u043a\u0441\u0442\u0430. \u0420\u0430\u043d\u0435\u0435 \u0432 \u044d\u0442\u043e\u043c \u0433\u043e\u0434\u0443 OpenAI \u0430\u043d\u043e\u043d\u0441\u0438\u0440\u043e\u0432\u0430\u043b DALL-E, \u043c\u043e\u0449\u043d\u044b\u0439 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439 \u0438\u0437 \u0442\u0435\u043a\u0441\u0442\u043e\u0432. <\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0438\u043b\u043b\u044e\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0445\u043e\u0440\u043e\u0448\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 DALL-E, \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u0440\u0438\u0441\u0443\u043d\u043a\u0438, \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 DALL-E \u043f\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0443 &#171;a professional high quality illustration of a giraffe dragon chimera, &#171;a giraffe imitating a dragon&#187;, &#171;a giraffe made of dragon&#187;.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/a44\/704\/034\/a4470403409fc60ab0f714a3af85e8a6.png\" alt=\"\u0418\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043f\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0443 &quot;a professional high quality illustration of a giraffe dragon chimera, &quot;a giraffe imitating a dragon&quot;, &quot;a giraffe made of dragon&quot;.\" title=\"\u0418\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043f\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0443 &quot;a professional high quality illustration of a giraffe dragon chimera, &quot;a giraffe imitating a dragon&quot;, &quot;a giraffe made of dragon&quot;.\" width=\"725\" height=\"871\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/a44\/704\/034\/a4470403409fc60ab0f714a3af85e8a6.png\"\/><figcaption>\u0418\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043f\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0443 &#171;a professional high quality illustration of a giraffe dragon chimera, &#171;a giraffe imitating a dragon&#187;, &#171;a giraffe made of dragon&#187;.<\/figcaption><\/figure>\n<p>\u041a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, DALL-E \u043d\u0435 \u0431\u044b\u043b \u0432\u044b\u043f\u0443\u0449\u0435\u043d \u0432 \u043c\u0430\u0441\u0441\u044b. \u0412\u043c\u0435\u0441\u0442\u043e \u043d\u0435\u0433\u043e \u0431\u044b\u043b\u0430 \u043e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u043d\u0430 \u043c\u043e\u0434\u0435\u043b\u044c, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0442\u0432\u043e\u0440\u0438\u0442 \u043c\u0430\u0433\u0438\u044e DALL-E, \u2014 CLIP. CLIP \u0438\u043b\u0438 Contrastive Image-Language Pretraining \u2014 \u044d\u0442\u043e \u043c\u0443\u043b\u044c\u0442\u0438\u043c\u043e\u0434\u0430\u043b\u044c\u043d\u0430\u044f \u0441\u0435\u0442\u044c, \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u044f\u044e\u0449\u0430\u044f \u0442\u0435\u043a\u0441\u0442 \u0438 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f. <\/p>\n<blockquote>\n<p>\u041e\u0434\u043d\u0438\u043c \u0441\u043b\u043e\u0432\u043e\u043c, CLIP \u0441\u043f\u043e\u0441\u043e\u0431\u0435\u043d \u043e\u0446\u0435\u043d\u0438\u0442\u044c, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0445\u043e\u0440\u043e\u0448\u043e \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043d\u0430\u0434\u043f\u0438\u0441\u0438 \u0438\u043b\u0438 \u043d\u0430\u043e\u0431\u043e\u0440\u043e\u0442. <\/p>\n<\/blockquote>\n<p>\u042d\u0442\u043e \u043a\u0440\u0430\u0439\u043d\u0435 \u043f\u043e\u043b\u0435\u0437\u043d\u043e \u0432 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0438 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435, \u0442\u043e\u0447\u043d\u043e \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0435 \u0432\u0432\u0435\u0434\u0451\u043d\u043d\u043e\u043c\u0443 \u0442\u0435\u043a\u0441\u0442\u0443. \u0412 \u0444\u0438\u043b\u044c\u043c\u0435 &#171;DALL-E&#187;\u00a0 CLIP \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f, \u0447\u0442\u043e\u0431\u044b \u0440\u0430\u043d\u0436\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0438 \u0432\u0445\u043e\u0434\u043d\u044b\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0441 \u043d\u0430\u0438\u0432\u044b\u0441\u0448\u0438\u043c \u0431\u0430\u043b\u043b\u043e\u043c (\u0441\u0430\u043c\u044b\u0435 \u043f\u043e\u0445\u043e\u0436\u0438\u0435 \u043d\u0430 \u0442\u0435\u043a\u0442\u043e\u0432\u044b\u0439 \u0437\u0430\u043f\u0440\u043e\u0441).<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/793\/83c\/14a\/79383c14a586d70b37771580c849e0b3.png\" width=\"590\" height=\"396\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/793\/83c\/14a\/79383c14a586d70b37771580c849e0b3.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0427\u0435\u0440\u0435\u0437 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043c\u0435\u0441\u044f\u0446\u0435\u0432 \u043f\u043e\u0441\u043b\u0435 \u0430\u043d\u043e\u043d\u0441\u0430 \u0444\u0438\u043b\u044c\u043c\u0430 DALL-E \u0431\u044b\u043b \u043e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u043d \u043d\u043e\u0432\u044b\u0439 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439-\u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0435\u0440\u043e\u0432 \u043f\u043e\u0434 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c VQGAN (Vector Quantized GAN). \u0421\u043e\u0447\u0435\u0442\u0430\u043d\u0438\u0435 VQGAN \u0441 CLIP \u0434\u0430\u0451\u0442 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u043e, \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e\u0435 DALL-E. \u0421 \u043c\u043e\u043c\u0435\u043d\u0442\u0430 \u043e\u0431\u043d\u0430\u0440\u043e\u0434\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043e\u0431\u0443\u0447\u0435\u043d\u043d\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 VQGAN \u0441\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432\u043e \u0441\u043e\u0437\u0434\u0430\u043b\u043e \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0443\u0434\u0438\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u043a\u0430\u0440\u0442\u0438\u043d.<\/p>\n<p>\u0412\u043e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440\u044b:<\/p>\n<figure class=\"bordered\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/488\/ff1\/fb8\/488ff1fb884211de07658b24f28b38d7.png\" alt=\"\" title=\"\" width=\"400\" height=\"224\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/488\/ff1\/fb8\/488ff1fb884211de07658b24f28b38d7.png\"\/><figcaption><\/figcaption><\/figure>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/599\/411\/ece\/599411ece96236163a842ecce2241625.png\" alt=\"\" title=\"\" width=\"496\" height=\"272\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/599\/411\/ece\/599411ece96236163a842ecce2241625.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u042f \u0431\u044b\u043b \u043f\u043e\u0440\u0430\u0436\u0451\u043d \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u043c\u0438 \u0438 \u0437\u0430\u0445\u043e\u0442\u0435\u043b \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u0438\u043c\u0438 \u0441\u043e \u0441\u0432\u043e\u0438\u043c\u0438 \u0434\u0440\u0443\u0437\u044c\u044f\u043c\u0438. \u041d\u043e, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043d\u0435 \u0442\u0430\u043a \u043c\u043d\u043e\u0433\u043e \u043b\u044e\u0434\u0435\u0439 \u0433\u043e\u0442\u043e\u0432\u044b \u043f\u043e\u0433\u0440\u0443\u0437\u0438\u0442\u044c\u0441\u044f \u0432 \u043a\u043e\u0434 \u0440\u0430\u0434\u0438 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043a\u0430\u0440\u0442\u0438\u043d, \u044f \u0440\u0435\u0448\u0438\u043b \u0441\u0434\u0435\u043b\u0430\u0442\u044c Text2Art.com \u2014 \u0441\u0430\u0439\u0442, \u0433\u0434\u0435 \u043b\u044e\u0431\u043e\u0439 \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u0432\u0435\u0441\u0442\u0438 \u043f\u043e\u0434\u0441\u043a\u0430\u0437\u043a\u0443 \u0438 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0443\u0436\u043d\u043e\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435, \u043d\u0435 \u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u044f\u0441\u044c \u0441 \u043a\u043e\u0434\u043e\u043c \u0432\u043e\u043e\u0447\u0438\u044e.<\/p>\n<h2>\u041a\u0430\u043a \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442<\/h2>\n<p>\u0418\u0442\u0430\u043a, \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 VQGAN+CLIP? VQGAN \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435, \u0430 CLIP \u0438\u0437\u043c\u0435\u0440\u044f\u0435\u0442, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043e\u043d\u043e \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0437\u0430\u043f\u0440\u043e\u0441\u0443. \u0417\u0430\u0442\u0435\u043c \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u043e\u0431\u0440\u0430\u0442\u043d\u0443\u044e \u0441\u0432\u044f\u0437\u044c \u043e\u0442 \u043c\u043e\u0434\u0435\u043b\u0438 CLIP, \u0447\u0442\u043e\u0431\u044b \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u0442\u043e\u0447\u043d\u044b\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f. \u041f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0430 \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u0435\u0442\u0441\u044f, \u043f\u043e\u043a\u0430 \u043e\u0446\u0435\u043d\u043a\u0430 CLIP \u043d\u0435 \u0441\u0442\u0430\u043d\u0435\u0442 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0432\u044b\u0441\u043e\u043a\u043e\u0439.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/a7d\/c2a\/e02\/a7dc2ae02ea7b767111a1041bc8287c8.png\" alt=\"VQGAN \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f, \u043f\u043e\u043a\u0430 CLIP \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441. \u0427\u0435\u043c \u0431\u043e\u043b\u044c\u0448\u0435 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439, \u0442\u0435\u043c \u0442\u043e\u0447\u043d\u0435\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 [\u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a: \u0438\u043b\u043b\u044e\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 VQGAN \u043e\u0442 LJ Miranda]\" title=\"VQGAN \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f, \u043f\u043e\u043a\u0430 CLIP \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441. \u0427\u0435\u043c \u0431\u043e\u043b\u044c\u0448\u0435 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439, \u0442\u0435\u043c \u0442\u043e\u0447\u043d\u0435\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 [\u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a: \u0438\u043b\u043b\u044e\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 VQGAN \u043e\u0442 LJ Miranda]\" width=\"1400\" height=\"1485\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/a7d\/c2a\/e02\/a7dc2ae02ea7b767111a1041bc8287c8.png\"\/><figcaption>VQGAN \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f, \u043f\u043e\u043a\u0430 CLIP \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441. \u0427\u0435\u043c \u0431\u043e\u043b\u044c\u0448\u0435 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439, \u0442\u0435\u043c \u0442\u043e\u0447\u043d\u0435\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 [\u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a: \u0438\u043b\u043b\u044e\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 VQGAN \u043e\u0442 LJ Miranda]<\/figcaption><\/figure>\n<p>\u042f \u043d\u0435 \u0431\u0443\u0434\u0443 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043e \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u0439 \u0440\u0430\u0431\u043e\u0442\u0435 VQGAN \u0438\u043b\u0438 CLIP. \u041d\u043e, \u0435\u0441\u043b\u0438 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u0433\u043b\u0443\u0431\u043e\u043a\u0438\u0435 \u043e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u044f VQGAN, CLIP \u0438\u043b\u0438 DALL-E, \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u0435\u0441\u044c \u043a \u044d\u0442\u0438\u043c \u0443\u0434\u0438\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c \u0440\u0435\u0441\u0443\u0440\u0441\u0430\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u044f \u043d\u0430\u0448\u0451\u043b:<\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/ljvmiranda921.github.io\/notebook\/2021\/08\/08\/clip-vqgan\/\">\u0418\u043b\u043b\u044e\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 VQGAN<\/a>;<\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/ml.berkeley.edu\/blog\/posts\/vq-vae\/\">\u041e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0435 DALL-E<\/a>;<\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/youtu.be\/T9XSU0pKX2E\">\u041e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0435 \u043d\u0430\u0443\u0447\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u043e CLIP \u043d\u0430 \u0432\u0438\u0434\u0435\u043e<\/a>.<\/p>\n<\/li>\n<\/ul>\n<h3>X + CLIP<\/h3>\n<p>VQGAN+CLIP \u2014 \u044d\u0442\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0438\u043c\u0435\u0440 \u0442\u043e\u0433\u043e, \u043d\u0430 \u0447\u0442\u043e \u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439 \u0441 CLIP. \u041e\u0434\u043d\u0430\u043a\u043e \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c VQGAN \u043d\u0430 \u043b\u044e\u0431\u043e\u0439 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440. \u041f\u043e\u044f\u0432\u0438\u043b\u043e\u0441\u044c \u043c\u043d\u043e\u0433\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 X + CLIP, \u0442\u0430\u043a\u0438\u0445 \u043a\u0430\u043a <a href=\"https:\/\/github.com\/orpatashnik\/StyleCLIP\">StyleCLIP<\/a> (StyleGAN + CLIP), <a href=\"https:\/\/arxiv.org\/abs\/2106.14843\">CLIPDraw<\/a> (\u0432\u0435\u043a\u0442\u043e\u0440\u043d\u044b\u0439 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440), BigGAN + CLIP \u0438 \u043c\u043d\u043e\u0433\u0438\u0435 \u0434\u0440\u0443\u0433\u0438\u0435, \u0434\u0430\u0436\u0435 <a href=\"https:\/\/github.com\/AndreyGuzhov\/AudioCLIP\">AudioCLIP<\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441\u043e \u0437\u0432\u0443\u043a\u043e\u043c, \u0430 \u043d\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f\u043c\u0438.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/f47\/b0b\/94b\/f47b0b94b1a6139791f2f08bdc3e1664.png\" alt=\"\u0420\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439 \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 StyleCLIP [\u0440\u0430\u0431\u043e\u0442\u0430 \u043e StyleCLIP]\" title=\"\u0420\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439 \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 StyleCLIP [\u0440\u0430\u0431\u043e\u0442\u0430 \u043e StyleCLIP]\" width=\"1400\" height=\"507\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/f47\/b0b\/94b\/f47b0b94b1a6139791f2f08bdc3e1664.png\"\/><figcaption>\u0420\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439 \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 StyleCLIP [\u0440\u0430\u0431\u043e\u0442\u0430 \u043e StyleCLIP]<\/figcaption><\/figure>\n<h2>\u041a\u043e\u0434<\/h2>\n<p>\u042f \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0441\u044c \u043a\u043e\u0434\u043e\u043c \u0438\u0437 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u044f <a href=\"https:\/\/github.com\/dribnet\/clipit\">clipit<\/a> \u043e\u0442 dribnet, \u044d\u0442\u043e\u0442 \u043a\u043e\u0434 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 VQGAN+CLIP \u0432 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u0441\u0442\u0440\u043e\u043a (\u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435: <a href=\"https:\/\/github.com\/dribnet\/clipit\">clipit<\/a> \u043c\u0438\u0433\u0440\u0438\u0440\u043e\u0432\u0430\u043b \u043d\u0430 <a href=\"https:\/\/github.com\/dribnet\/pixray\">pixray<\/a>). \u0415\u0433\u043e \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u0442\u0441\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u043d\u0430 Google Colab: VQGAN+CLIP \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u043c\u043d\u043e\u0433\u043e \u043f\u0430\u043c\u044f\u0442\u0438 GPU. \u0412\u043e\u0442 \u0431\u043b\u043e\u043a\u043d\u043e\u0442 <a href=\"https:\/\/colab.research.google.com\/github\/mfrashad\/text2art\/blob\/main\/text2art.ipynb\">Colab<\/a>. <\/p>\n<p>\u041f\u0440\u0435\u0436\u0434\u0435 \u0432\u0441\u0435\u0433\u043e, \u0435\u0441\u043b\u0438 \u0432\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442\u0435 \u043d\u0430 Colab, \u0443\u0431\u0435\u0434\u0438\u0442\u0435\u0441\u044c, \u0447\u0442\u043e \u0432\u044b \u0438\u0437\u043c\u0435\u043d\u0438\u043b\u0438 \u0442\u0438\u043f \u0440\u0430\u043d\u0442\u0430\u0439\u043c\u0430 \u043d\u0430 GPU, \u0432\u043e\u0442 \u0442\u0430\u043a:<\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/aae\/0df\/ca8\/aae0dfca84a68efa1eb3c65fd4ea5f20.png\" width=\"511\" height=\"385\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/aae\/0df\/ca8\/aae0dfca84a68efa1eb3c65fd4ea5f20.png\"\/><figcaption><\/figcaption><\/figure>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/39f\/231\/441\/39f231441510f9b03da12206df44437d.png\" alt=\" \" title=\" \" width=\"398\" height=\"290\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/39f\/231\/441\/39f231441510f9b03da12206df44437d.png\"\/><figcaption> <\/figcaption><\/figure>\n<p>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c \u043a\u043e\u0434\u043e\u0432\u0443\u044e \u0431\u0430\u0437\u0443 \u0438 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438:<\/p>\n<pre><code class=\"python\">from IPython.utils import io with io.capture_output() as captured:   !git clone https:\/\/github.com\/openai\/CLIP   # !pip install taming-transformers   !git clone https:\/\/github.com\/CompVis\/taming-transformers.git   !rm -Rf clipit   !git clone https:\/\/github.com\/mfrashad\/clipit.git   !pip install ftfy regex tqdm omegaconf pytorch-lightning   !pip install kornia   !pip install imageio-ffmpeg      !pip install einops   !pip install torch-optimizer   !pip install easydict   !pip install braceexpand   !pip install git+https:\/\/github.com\/pvigier\/perlin-numpy    # ClipDraw deps   !pip install svgwrite   !pip install svgpathtools   !pip install cssutils   !pip install numba   !pip install torch-tools   !pip install visdom    !pip install gradio    !git clone https:\/\/github.com\/BachiLi\/diffvg   %cd diffvg   # !ls   !git submodule update --init --recursive   !python setup.py install   %cd ..      !mkdir -p steps   !mkdir -p models<\/code><\/pre>\n<blockquote>\n<p>&#171;!&#187; \u2014 \u044d\u0442\u043e \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u0430\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u0432 Google Colab, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u0430 \u0432 bash, \u0430 \u043d\u0435 \u0432 python.<\/p>\n<\/blockquote>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u043e \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c clipit \u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u044d\u0442\u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0442\u0440\u043e\u043a \u043a\u043e\u0434\u0430 \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043a\u0430\u0440\u0442\u0438\u043d\u044b \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e VQGAN+CLIP. <\/p>\n<p>\u041f\u0440\u043e\u0441\u0442\u043e \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u0435 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u0443\u044e \u043f\u043e\u0434\u0441\u043a\u0430\u0437\u043a\u0443 \u043d\u0430 \u043b\u044e\u0431\u0443\u044e \u0434\u0440\u0443\u0433\u0443\u044e. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0437\u0430\u0434\u0430\u0442\u044c clipit \u0442\u0430\u043a\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b, \u043a\u0430\u043a \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439, \u0448\u0438\u0440\u0438\u043d\u0430, \u0432\u044b\u0441\u043e\u0442\u0430, \u043c\u043e\u0434\u0435\u043b\u044c \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430, \u0445\u043e\u0442\u0438\u0442\u0435 \u043b\u0438 \u0432\u044b \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u0438\u0434\u0435\u043e \u0438\u043b\u0438 \u043d\u0435\u0442, \u0438 \u043c\u043d\u043e\u0433\u0438\u0435 \u0434\u0440\u0443\u0433\u0438\u0435. \u0427\u0442\u043e\u0431\u044b \u0431\u043e\u043b\u044c\u0448\u0435 \u0443\u0437\u043d\u0430\u0442\u044c \u043e\u0431 \u043e\u043f\u0446\u0438\u044f\u0445, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 <a href=\"https:\/\/github.com\/mfrashad\/clipit\/blob\/master\/clipit.py\">\u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c <\/a>\u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434.<\/p>\n<p>\u0412\u043e\u0442 \u043a\u043e\u0434 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438:<\/p>\n<pre><code class=\"python\">import sys sys.path.append(\"clipit\") import clipit  # To reset settings to default clipit.reset_settings()  # You can use \"|\" to separate multiple prompts prompts = \"underwater city\"  # You can trade off speed for quality: draft, normal, better, best quality = \"normal\"  # Aspect ratio: widescreen, square aspect = \"widescreen\"  # Add settings clipit.add_settings(prompts=prompts, quality=quality, aspect=aspect)  # Apply these settings and run settings = clipit.apply_settings() clipit.do_init(settings) cliptit.do_run(settings)<\/code><\/pre>\n<p>\u041a\u043e\u0433\u0434\u0430 \u0432\u044b \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u0435 \u043a\u043e\u0434, \u043e\u043d \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435. \u041d\u0430 \u043a\u0430\u0436\u0434\u043e\u0439 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438\u0431\u043b\u0438\u0436\u0430\u0442\u044c\u0441\u044f \u043a \u0442\u0435\u043a\u0441\u0442\u0443, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b \u0432\u0432\u0435\u043b\u0438.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/175\/d56\/f21\/175d56f21f0ae9f5f89834decc07f356.png\" alt=\"\u0418\u0442\u0435\u0440\u0430\u0446\u0438\u0438 \u043f\u043e \u0437\u0430\u0440\u043e\u0441\u0443 \u201cunderwater city\u201d\" title=\"\u0418\u0442\u0435\u0440\u0430\u0446\u0438\u0438 \u043f\u043e \u0437\u0430\u0440\u043e\u0441\u0443 \u201cunderwater city\u201d\" width=\"714\" height=\"304\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/175\/d56\/f21\/175d56f21f0ae9f5f89834decc07f356.png\"\/><figcaption>\u0418\u0442\u0435\u0440\u0430\u0446\u0438\u0438 \u043f\u043e \u0437\u0430\u0440\u043e\u0441\u0443 \u201cunderwater city\u201d<\/figcaption><\/figure>\n<h3>\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439<\/h3>\n<p>\u0412\u043e\u0442 \u0442\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439, \u0438\u043c \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 <code>iterations<\/code>:<\/p>\n<pre><code class=\"python\">clipit.add_settings(iterations=500)<\/code><\/pre>\n<h3>\u0413\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u0432\u0438\u0434\u0435\u043e<\/h3>\n<p>\u0412 \u043b\u044e\u0431\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0443\u0436\u043d\u043e \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u044d\u0442\u0438 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0438 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u044e \u0441\u0430\u043c\u043e\u0439 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0434\u043e\u0431\u0430\u0432\u044c\u0442\u0435 <code>make_video=True<\/code> \u043f\u0435\u0440\u0435\u0434 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435\u043c \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a.<\/p>\n<pre><code class=\"python\">clipit.add_settings(make_video=True)<\/code><\/pre>\n<p>\u041f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f \u044d\u0442\u043e\u0442 \u0440\u043e\u043b\u0438\u043a:<\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/fd5\/e9f\/ed1\/fd5e9fed1f52a259d2a67252c5850ce4.gif\" alt=\"\u0421\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043f\u043e\u0434\u0432\u043e\u0434\u043d\u044b\u0439 \u0433\u043e\u0440\u043e\u0434, \u0437\u0430\u043f\u0440\u043e\u0441 \u201cUnderwater City\u201d\" title=\"\u0421\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043f\u043e\u0434\u0432\u043e\u0434\u043d\u044b\u0439 \u0433\u043e\u0440\u043e\u0434, \u0437\u0430\u043f\u0440\u043e\u0441 \u201cUnderwater City\u201d\" width=\"400\" height=\"224\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/fd5\/e9f\/ed1\/fd5e9fed1f52a259d2a67252c5850ce4.gif\"\/><figcaption>\u0421\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043f\u043e\u0434\u0432\u043e\u0434\u043d\u044b\u0439 \u0433\u043e\u0440\u043e\u0434, \u0437\u0430\u043f\u0440\u043e\u0441 \u201cUnderwater City\u201d<\/figcaption><\/figure>\n<h3>\u0423\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439<\/h3>\n<p>\u0420\u0430\u0437\u043c\u0435\u0440 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043e\u043f\u0446\u0438\u0435\u0439\u00a0<code>size=(width, height)<\/code>. \u0421\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c \u0431\u0430\u043d\u043d\u0435\u0440\u043d\u043e\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0441 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0435\u043c 800&#215;200. \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u0431\u043e\u043b\u0435\u0435 \u0432\u044b\u0441\u043e\u043a\u043e\u0435 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u0431\u043e\u043b\u044c\u0448\u0435\u0433\u043e \u043e\u0431\u044a\u0451\u043c\u0430 \u043f\u0430\u043c\u044f\u0442\u0438 GPU.<\/p>\n<pre><code class=\"python\">clipit.add_settings(size=(800, 200))<\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/122\/217\/87d\/12221787d7d7f4b0e983e72f44a909c5.png\" alt=\"\u0411\u0430\u043d\u043d\u0435\u0440 800x200 \u043f\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0443 \u201cFantasy Kingdom #artstation\u201d\" title=\"\u0411\u0430\u043d\u043d\u0435\u0440 800x200 \u043f\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0443 \u201cFantasy Kingdom #artstation\u201d\" width=\"800\" height=\"192\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/122\/217\/87d\/12221787d7d7f4b0e983e72f44a909c5.png\"\/><figcaption>\u0411\u0430\u043d\u043d\u0435\u0440 800&#215;200 \u043f\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0443 \u201cFantasy Kingdom #artstation\u201d<\/figcaption><\/figure>\n<h3>\u0413\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u043f\u0438\u043a\u0441\u0435\u043b\u044c-\u0430\u0440\u0442\u0430<\/h3>\n<p>\u041c\u043e\u0436\u043d\u043e \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438 \u043f\u0438\u043a\u0441\u0435\u043b\u044c-\u0430\u0440\u0442. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0440\u0435\u043d\u0434\u0435\u0440\u0435\u0440 CLIPDraw \u0437\u0430 \u0441\u0446\u0435\u043d\u043e\u0439 \u0441 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u0438\u043d\u0436\u0435\u043d\u0435\u0440\u043d\u044b\u043c\u0438 \u0440\u0435\u0448\u0435\u043d\u0438\u044f\u043c\u0438, \u0442\u0430\u043a\u0438\u043c\u0438 \u043a\u0430\u043a \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0435 \u0446\u0432\u0435\u0442\u043e\u0432 \u043f\u0430\u043b\u0438\u0442\u0440\u044b, \u043f\u0438\u043a\u0441\u0435\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0438 \u0442.\u0434. \u041f\u0440\u043e\u0441\u0442\u043e \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u0435 \u043e\u043f\u0446\u0438\u044e <code>use_pixeldraw=True<\/code>.<\/p>\n<pre><code class=\"python\">clipit.add_settings(use_pixeldraw=True)<\/code><\/pre>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/a93\/027\/cd7\/a93027cd76d9ac1bd1be5dba0a94a8b9.png\" alt=\"\u0418\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u043f\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0443 \u201cKnight in armor #pixelart\u201d\" title=\"\u0418\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u043f\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0443 \u201cKnight in armor #pixelart\u201d\" width=\"500\" height=\"280\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/a93\/027\/cd7\/a93027cd76d9ac1bd1be5dba0a94a8b9.png\"\/><figcaption>\u0418\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u043f\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0443 \u201cKnight in armor #pixelart\u201d<\/figcaption><\/figure>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/da9\/3ee\/a05\/da93eea05ceb55206d33649f49411f05.png\" alt=\"\u0418\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u043f\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0443 \u201cA world of chinese fantasy video game #pixelart\u201d\" title=\"\u0418\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u043f\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0443 \u201cA world of chinese fantasy video game #pixelart\u201d\" width=\"400\" height=\"225\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/da9\/3ee\/a05\/da93eea05ceb55206d33649f49411f05.png\"\/><figcaption>\u0418\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u043f\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0443 \u201cA world of chinese fantasy video game #pixelart\u201d<\/figcaption><\/figure>\n<h3>VQGAN+CLIP \u043c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0445 \u0441\u043b\u043e\u0432<\/h3>\n<p>\u0418\u0437-\u0437\u0430 \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u044f \u0432 CLIP \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0445 \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0445 \u0441\u043b\u043e\u0432 \u043a \u043f\u043e\u0434\u0441\u043a\u0430\u0437\u043a\u0435 \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u0434\u0430\u0442\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0439 \u044d\u0444\u0444\u0435\u043a\u0442 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c\u043e\u043c\u0443 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044e. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u043b\u043e\u0432\u0430 &#171;unreal engine&#187;\u00a0 \u043a \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u043e\u0439 \u043f\u043e\u0434\u0441\u043a\u0430\u0437\u043a\u0435, \u043a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u043e, \u0441\u043e\u0437\u0434\u0430\u0451\u0442 \u0440\u0435\u0430\u043b\u0438\u0441\u0442\u0438\u0447\u043d\u043e\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0438\u043b\u0438 HD \u0441\u0442\u0438\u043b\u044c. \u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0445 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0439 \u0441\u0430\u0439\u0442\u043e\u0432, \u0442\u0430\u043a\u0438\u0445 \u043a\u0430\u043a &#171;deviantart&#187;, &#171;artstation&#187;\u00a0 \u0438\u043b\u0438 &#171;flickr&#187;, \u043e\u0431\u044b\u0447\u043d\u043e \u0434\u0435\u043b\u0430\u0435\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0431\u043e\u043b\u0435\u0435 \u044d\u0441\u0442\u0435\u0442\u0438\u0447\u043d\u044b\u043c\u0438. \u041c\u043d\u0435 \u0431\u043e\u043b\u044c\u0448\u0435 \u0432\u0441\u0435\u0433\u043e \u043d\u0440\u0430\u0432\u0438\u0442\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0435 \u0441\u043b\u043e\u0432\u043e &#171;artstation\u201d, \u0442\u0430\u043a \u043a\u0430\u043a \u044f \u0441\u0447\u0438\u0442\u0430\u044e, \u0447\u0442\u043e \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043b\u0443\u0447\u0448\u0438\u0435 \u043a\u0430\u0440\u0442\u0438\u043d\u044b.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/f3a\/9f9\/bfa\/f3a9f9bfaa3e615a3bf801b17ce3599b.jpeg\" alt=\"\u0421\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0445 \u0441\u043b\u043e\u0432\" title=\"\u0421\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0445 \u0441\u043b\u043e\u0432\" width=\"744\" height=\"1111\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/f3a\/9f9\/bfa\/f3a9f9bfaa3e615a3bf801b17ce3599b.jpeg\" data-blurred=\"true\"\/><figcaption>\u0421\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0445 \u0441\u043b\u043e\u0432<\/figcaption><\/figure>\n<p>\u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0435 \u0441\u043b\u043e\u0432\u0430, \u0447\u0442\u043e\u0431\u044b \u043e\u0431\u0443\u0441\u043b\u043e\u0432\u0438\u0442\u044c \u0445\u0443\u0434\u043e\u0436\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u0441\u0442\u0438\u043b\u044c: &#171;pencil sketch\u201d, &#171;low poly&#187; \u0438\u043b\u0438 \u0434\u0430\u0436\u0435 \u0438\u043c\u044f \u0445\u0443\u0434\u043e\u0436\u043d\u0438\u043a\u0430 \u2014 &#171;Thomas Kinkade&#187; \u0438\u043b\u0438 &#171;James Gurney\u201d.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/583\/edd\/b97\/583eddb97423a0f94f8d39e5ef2a829a.jpeg\" alt=\"\u041a\u043b\u044e\u0447\u0435\u0432\u044b\u0435 \u0441\u043b\u043e\u0432\u0430 \u0441\u0442\u0438\u043b\u044f \u2014 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435\" title=\"\u041a\u043b\u044e\u0447\u0435\u0432\u044b\u0435 \u0441\u043b\u043e\u0432\u0430 \u0441\u0442\u0438\u043b\u044f \u2014 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435\" width=\"751\" height=\"1077\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/583\/edd\/b97\/583eddb97423a0f94f8d39e5ef2a829a.jpeg\" data-blurred=\"true\"\/><figcaption>\u041a\u043b\u044e\u0447\u0435\u0432\u044b\u0435 \u0441\u043b\u043e\u0432\u0430 \u0441\u0442\u0438\u043b\u044f \u2014 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435<\/figcaption><\/figure>\n<p>\u0427\u0442\u043e\u0431\u044b \u0443\u0437\u043d\u0430\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 \u043e \u0432\u043b\u0438\u044f\u043d\u0438\u0438 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0445 \u0441\u043b\u043e\u0432, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f \u0441 <a href=\"https:\/\/imgur.com\/a\/SALxbQm\">\u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435\u043c<\/a>, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u0431\u043e\u043b\u0435\u0435 200 \u0441\u043b\u043e\u0432 \u043d\u0430 4 \u0442\u0435\u043c\u044b.<\/p>\n<h2>UI \u043d\u0430 Gradio<\/h2>\n<p><a href=\"https:\/\/gradio.app\/\">Gradio<\/a> \u2014 \u044d\u0442\u043e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 Python, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0443\u043f\u0440\u043e\u0449\u0430\u0435\u0442 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u0435 \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u0439 ML \u0434\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0441\u0442\u0440\u043e\u043a \u043a\u043e\u0434\u0430. \u0414\u0435\u043c\u043e\u0432\u0435\u0440\u0441\u0438\u044f \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u043c\u0435\u043d\u044c\u0448\u0435 10 \u043c\u0438\u043d\u0443\u0442 \u0440\u0430\u0431\u043e\u0442\u044b. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c Gradio \u0432 Colab, \u0438 \u043e\u043d \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u0441\u0441\u044b\u043b\u043a\u0443 \u0434\u043b\u044f \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u043d\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043d\u0430 \u0434\u043e\u043c\u0435\u043d\u0435 Gradio. \u0421\u0441\u044b\u043b\u043a\u043e\u0439 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f.<\/p>\n<p>Gradio \u0438\u043c\u0435\u0435\u0442 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f, \u043d\u043e \u044f \u0441\u0447\u0438\u0442\u0430\u044e, \u0447\u0442\u043e \u044d\u0442\u043e \u0441\u0430\u043c\u0430\u044f \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0430\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430, \u043a\u043e\u0433\u0434\u0430 \u0432\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u0445\u043e\u0442\u0438\u0442\u0435 \u043f\u0440\u043e\u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043e\u0434\u043d\u0443 \u0444\u0443\u043d\u043a\u0446\u0438\u044e.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/ef3\/ea1\/425\/ef3ea1425477a84644272b78a798589a.gif\" width=\"783\" height=\"325\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/ef3\/ea1\/425\/ef3ea1425477a84644272b78a798589a.gif\"\/><figcaption><\/figcaption><\/figure>\n<p>\u041d\u0438\u0436\u0435 \u043a\u043e\u0434 \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u0434\u043b\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f Text2Art. \u0414\u0443\u043c\u0430\u044e, \u0447\u0442\u043e \u043e\u043d \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u043e\u043d\u044f\u0442\u0435\u043d, \u043d\u043e, \u0435\u0441\u043b\u0438 \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0431\u043e\u043b\u044c\u0448\u0435 \u043e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0439, \u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435 <a href=\"https:\/\/gradio.app\/docs\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e <\/a>Gradio.<\/p>\n<pre><code class=\"python\">import gradio as gr import torch import clipit  # Define the main function def generate(prompt, quality, style, aspect):     torch.cuda.empty_cache()     clipit.reset_settings()          use_pixeldraw = (style == 'pixel art')     use_clipdraw = (style == 'painting')     clipit.add_settings(prompts=prompt,                         aspect=aspect,                         quality=quality,                         use_pixeldraw=use_pixeldraw,                         use_clipdraw=use_clipdraw,                         make_video=True)        settings = clipit.apply_settings()     clipit.do_init(settings)     clipit.do_run(settings)      return 'output.png', 'output.mp4'  # Create the UI prompt = gr.inputs.Textbox(default=\"Underwater city\", label=\"Text Prompt\") quality = gr.inputs.Radio(choices=['draft', 'normal', 'better'], label=\"Quality\") style = gr.inputs.Radio(choices=['image', 'painting','pixel art'], label=\"Type\") aspect = gr.inputs.Radio(choices=['square', 'widescreen','portrait'], label=\"Size\")  # Launch the demo iface = gr.Interface(generate, inputs=[prompt, quality, style, aspect], outputs=['image', 'video'], enable_queue=True, live=False) iface.launch(debug=True)<\/code><\/pre>\n<p>\u041a\u0430\u043a \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u044b \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u0435 \u044d\u0442\u0443 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443 \u0432 Google Colab \u0438\u043b\u0438 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e, \u043e\u043d\u0430 \u0441\u043e\u0437\u0434\u0430\u0441\u0442 \u0441\u0441\u044b\u043b\u043a\u0443, \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f, \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u044f \u0431\u0443\u0434\u0435\u0442 \u043e\u0431\u0449\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e\u0439. \u041d\u0435 \u043d\u0443\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u0443\u043d\u043d\u0435\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 SSH \u0432\u0440\u043e\u0434\u0435 ngrok. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, Gradio \u0442\u0430\u043a\u0436\u0435 \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442 \u0445\u043e\u0441\u0442\u0438\u043d\u0433 \u0437\u0430 7 \u0434\u043e\u043b\u043b\u0430\u0440\u043e\u0432 \u0432 \u043c\u0435\u0441\u044f\u0446.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/a89\/e28\/038\/a89e280384ce65bf050b2823e29ce488.png\" alt=\"\u0421\u0441\u044b\u043b\u043a\u0430 \u0432 \u0434\u0435\u043c\u043e, \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f.\" title=\"\u0421\u0441\u044b\u043b\u043a\u0430 \u0432 \u0434\u0435\u043c\u043e, \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f.\" width=\"1083\" height=\"269\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/a89\/e28\/038\/a89e280384ce65bf050b2823e29ce488.png\"\/><figcaption>\u0421\u0441\u044b\u043b\u043a\u0430 \u0432 \u0434\u0435\u043c\u043e, \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f.<\/figcaption><\/figure>\n<p>\u041e\u0434\u043d\u0430\u043a\u043e Gradio \u0445\u043e\u0440\u043e\u0448\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u043e\u0434\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438. \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u043e\u0433\u043e \u0441\u0430\u0439\u0442\u0430 \u0441 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c\u0438, \u0442\u0430\u043a\u0438\u043c\u0438 \u043a\u0430\u043a \u0433\u0430\u043b\u0435\u0440\u0435\u044f, \u0432\u0445\u043e\u0434 \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u0438\u043b\u0438 \u0434\u0430\u0436\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439 CSS, \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u043e \u0438\u043b\u0438 \u0432\u043e\u043e\u0431\u0449\u0435 \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e.<\/p>\n<p>\u041e\u0434\u043d\u043e \u0431\u044b\u0441\u0442\u0440\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u2014 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u0441\u0430\u0439\u0442 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u043e\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 Gradio, \u0437\u0430\u0442\u0435\u043c \u2014 \u0432\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 Gradio \u0447\u0435\u0440\u0435\u0437 iframe.<\/p>\n<p>\u042f \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u043b \u044d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434, \u043d\u043e \u043e\u0441\u043e\u0437\u043d\u0430\u043b \u043e\u0434\u0438\u043d \u0432\u0430\u0436\u043d\u044b\u0439 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u043a: \u044f \u043d\u0435 \u043c\u043e\u0433\u0443 \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0447\u0430\u0441\u0442\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0434\u043e\u043b\u0436\u043d\u044b \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0441 \u0441\u0430\u043c\u0438\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435\u043c ML: \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044e \u0432\u0432\u043e\u0434\u0430, \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439 \u043f\u0440\u043e\u0433\u0440\u0435\u0441\u0441-\u0431\u0430\u0440 \u0438 \u0442. \u0434., \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b \u0441 iframe. \u0418 \u044f \u0440\u0435\u0448\u0438\u043b \u0441\u043e\u0437\u0434\u0430\u0442\u044c API.<\/p>\n<h2>FastAPI \u0434\u043b\u044f \u043c\u043e\u0434\u0435\u043b\u0438<\/h2>\n<p>\u0427\u0442\u043e\u0431\u044b \u0441\u0434\u0435\u043b\u0430\u0442\u044c API \u0431\u044b\u0441\u0442\u0440\u0435\u0435, \u0432\u043c\u0435\u0441\u0442\u043e Flask \u044f \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0441\u044f FastAPI. \u041a\u043e\u0434\u0430 \u043c\u0435\u043d\u044c\u0448\u0435, \u0430 \u0435\u0449\u0451 \u043e\u043d \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e \u0441\u043e Swagger UI, \u0447\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c API \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430. <\/p>\n<p>\u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, FastAPI \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0438, \u043a\u0430\u043a \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u0435\u0442\u0441\u044f, \u043e\u043d <a href=\"https:\/\/fastapi.tiangolo.com\/benchmarks\/\">\u0431\u044b\u0441\u0442\u0440\u0435\u0435, \u0447\u0435\u043c Flask<\/a>.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/ad1\/616\/948\/ad16169487ff6c5a37cd0d8b51deabbb.png\" alt=\"\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \/docs\/ \u0432 URL, \u0447\u0442\u043e\u0431\u044b \u0443\u0432\u0438\u0434\u0435\u0442\u044c Swagger\" title=\"\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \/docs\/ \u0432 URL, \u0447\u0442\u043e\u0431\u044b \u0443\u0432\u0438\u0434\u0435\u0442\u044c Swagger\" width=\"828\" height=\"548\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/ad1\/616\/948\/ad16169487ff6c5a37cd0d8b51deabbb.png\"\/><figcaption>\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \/docs\/ \u0432 URL, \u0447\u0442\u043e\u0431\u044b \u0443\u0432\u0438\u0434\u0435\u0442\u044c Swagger<\/figcaption><\/figure>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/358\/ea4\/b9c\/358ea4b9cfe9f658b3af3ea4fd362fda.png\" alt=\"\u0422\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u043c API \u0432 UI Swagger\" title=\"\u0422\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u043c API \u0432 UI Swagger\" width=\"488\" height=\"488\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/358\/ea4\/b9c\/358ea4b9cfe9f658b3af3ea4fd362fda.png\"\/><figcaption>\u0422\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u043c API \u0432 UI Swagger<\/figcaption><\/figure>\n<p>\u0412\u043e\u0442 \u043a\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u0434\u043b\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438 ML \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435 FastAPI:<\/p>\n<pre><code class=\"python\">import clipit import torch from fastapi import FastAPI from fastapi.middleware.cors import CORSMiddleware from fastapi import FastAPI, File, UploadFile, Form, BackgroundTasks from fastapi.responses import FileResponse  app = FastAPI()  app.add_middleware(     CORSMiddleware,     allow_origins=['*'],     allow_credentials=True,     allow_methods=['*'],     allow_headers=['*'], )  @app.get('\/') async def root():     return {'hello': 'world'}  @app.post(\"\/generate\") async def generate(         seed: int = Form(None),         iterations: int = Form(None),         prompts: str = Form(\"Underwater City\"),         quality: str = Form(\"draft\"),         aspect: str = Form(\"square\"),         scale: float = Form(2.5),         style: str = Form('image'),         make_video: bool = Form(False),           ):     torch.cuda.empty_cache()     clipit.reset_settings()      use_pixeldraw = (style == 'Pixel Art')     use_clipdraw = (style == 'Painting')     clipit.add_settings(prompts=prompts,                         seed=seed,                         iterations=iterations,                         aspect=aspect,                         quality=quality,                         scale=scale,                         use_pixeldraw=use_pixeldraw,                         use_clipdraw=use_clipdraw,                         make_video=make_video)          settings = clipit.apply_settings()     clipit.do_init(settings)     clipit.do_run(settings)      return FileResponse('output.png', media_type=\"image\/png\")<\/code><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0435\u0433\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e uvicorn. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 Google Colab \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0441\u0432\u043e\u0435\u043c\u0443 \u0441\u0435\u0440\u0432\u0435\u0440\u0443 \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0435\u0440\u0435\u0437 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 Colab, \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c Ngrok, \u0447\u0442\u043e\u0431\u044b \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441\u0435\u0440\u0432\u0435\u0440 FastAPI \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u043c. <\/p>\n<p>\u041a\u043e\u0434 \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0438 \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u0441\u0435\u0440\u0432\u0435\u0440\u0430:<\/p>\n<pre><code class=\"python\">import nest_asyncio from pyngrok import ngrok import uvicorn  ngrok_tunnel = ngrok.connect(8000) print('Public URL:', ngrok_tunnel.public_url) print('Doc URL:', ngrok_tunnel.public_url+'\/docs') nest_asyncio.apply() uvicorn.run(app, port=8000)<\/code><\/pre>\n<p>\u0417\u0430\u043f\u0443\u0441\u0442\u0438\u0432 \u0441\u0435\u0440\u0432\u0435\u0440, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043a Swagger UI (\u0434\u043e\u0431\u0430\u0432\u0438\u0432 \/docs \u0432 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 ngrok URL) \u0438 \u043f\u0440\u043e\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c API.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/535\/d00\/ed8\/535d00ed850802bb16f7077ffd522c63.png\" alt=\"\u0413\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u043f\u043e\u0434\u0432\u043e\u0434\u043d\u043e\u0433\u043e \u0437\u0430\u043c\u043a\u0430 \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 FastAPI Swagger UI\" title=\"\u0413\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u043f\u043e\u0434\u0432\u043e\u0434\u043d\u043e\u0433\u043e \u0437\u0430\u043c\u043a\u0430 \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 FastAPI Swagger UI\" width=\"675\" height=\"678\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/535\/d00\/ed8\/535d00ed850802bb16f7077ffd522c63.png\"\/><figcaption>\u0413\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u043f\u043e\u0434\u0432\u043e\u0434\u043d\u043e\u0433\u043e \u0437\u0430\u043c\u043a\u0430 \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 FastAPI Swagger UI<\/figcaption><\/figure>\n<p>\u041f\u0440\u0438 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 API \u044f \u043f\u043e\u043d\u044f\u043b, \u0447\u0442\u043e \u0432\u044b\u0432\u043e\u0434 \u043c\u043e\u0436\u0435\u0442 \u0437\u0430\u043d\u044f\u0442\u044c \u043e\u0442 3 \u0434\u043e 20 \u043c\u0438\u043d\u0443\u0442 \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0430\/\u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439. \u0422\u0440\u0438 \u043c\u0438\u043d\u0443\u0442\u044b \u0441\u0430\u043c\u043e \u043f\u043e \u0441\u0435\u0431\u0435 \u0443\u0436\u0435 \u0441\u0447\u0438\u0442\u0430\u0435\u0442\u0441\u044f \u043e\u0447\u0435\u043d\u044c \u0434\u043e\u043b\u0433\u0438\u043c \u0434\u043b\u044f HTTP-\u0437\u0430\u043f\u0440\u043e\u0441\u0430, \u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 \u043c\u043e\u0433\u0443\u0442 \u043d\u0435 \u0437\u0430\u0445\u043e\u0442\u0435\u0442\u044c \u0436\u0434\u0430\u0442\u044c \u0442\u0430\u043a \u0434\u043e\u043b\u0433\u043e. <\/p>\n<p>\u042f \u0440\u0435\u0448\u0438\u043b, \u0447\u0442\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0432\u044b\u0432\u043e\u0434\u0430 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0444\u043e\u043d\u043e\u0432\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438 \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u043e\u0433\u043e \u043f\u0438\u0441\u044c\u043c\u0430 \u043f\u043e\u0441\u043b\u0435 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430 \u043b\u0443\u0447\u0448\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0442 \u0434\u043b\u044f \u044d\u0442\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438.<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c, \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043b\u0438\u0441\u044c \u0441 \u043f\u043b\u0430\u043d\u043e\u043c, \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0434\u043b\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u043f\u0438\u0441\u044c\u043c\u0430. \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u043f\u043e\u0447\u0442\u043e\u0432\u044b\u0439 API SendGrid, \u043d\u043e \u043f\u043e\u0441\u043b\u0435 \u0438\u0441\u0447\u0435\u0440\u043f\u0430\u043d\u0438\u044f \u043a\u0432\u043e\u0442\u044b \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f (100 \u043f\u0438\u0441\u0435\u043c \u0432 \u0434\u0435\u043d\u044c) \u043f\u0435\u0440\u0435\u0448\u0451\u043b \u043d\u0430 API Mailgun, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u0445\u043e\u0434\u0438\u0442 \u0432 \u043f\u0430\u043a\u0435\u0442 GitHub Student Developer Pack, \u0440\u0430\u0437\u0440\u0435\u0448\u0430\u044f \u0441\u0442\u0443\u0434\u0435\u043d\u0442\u0430\u043c \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c 20 000 \u043f\u0438\u0441\u0435\u043c \u0432 \u043c\u0435\u0441\u044f\u0446. <\/p>\n<p>\u0412\u043e\u0442 \u043a\u043e\u0434 \u0434\u043b\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u043e\u0433\u043e \u043f\u0438\u0441\u044c\u043c\u0430 \u0441 \u0432\u043b\u043e\u0436\u0435\u043d\u0438\u0435\u043c \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e API Mailgun:<\/p>\n<pre><code class=\"python\">import requests def email_results_mailgun(email, prompt):     return requests.post(\"https:\/\/api.mailgun.net\/v3\/text2art.com\/messages\",         auth=(\"api\", \"YOUR_MAILGUN_API_KEY\"),         files=[(\"attachment\",(\"output.png\", open(\"output.png\", \"rb\").read() )),                (\"attachment\", (\"output.mp4\", open(\"output.mp4\", \"rb\").read() ))],         data={\"from\": \"Text2Art &lt;YOUR_EMAIL>\",               \"to\": email,               \"subject\": \"Your Artwork is ready!\",               \"text\": f'Your generated arts using the prompt \"{prompt}\".',               \"html\": f'Your generated arts using the prompt &lt;strong>\"{prompt}\"&lt;\/strong>.'})<\/code><\/pre>\n<p>\u0414\u0430\u043b\u0435\u0435 \u043c\u044b \u0438\u0437\u043c\u0435\u043d\u0438\u043c \u043a\u043e\u0434 \u043d\u0430\u0448\u0435\u0433\u043e \u0441\u0435\u0440\u0432\u0435\u0440\u0430, \u0447\u0442\u043e\u0431\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0444\u043e\u043d\u043e\u0432\u044b\u0435 \u0437\u0430\u0434\u0430\u0447\u0438 \u0432 FastAPI \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043f\u043e \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u043e\u0439 \u043f\u043e\u0447\u0442\u0435 \u0432 \u0444\u043e\u043d\u043e\u0432\u043e\u043c \u0440\u0435\u0436\u0438\u043c\u0435.<\/p>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434 \u0441\u0435\u0440\u0432\u0435\u0440\u0430<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"python\">#@title API Functions import clipit import torch from fastapi import FastAPI from fastapi.middleware.cors import CORSMiddleware from fastapi import FastAPI, File, UploadFile, Form, BackgroundTasks from fastapi.responses import FileResponse  app = FastAPI()  app.add_middleware(     CORSMiddleware,     allow_origins=['*'],     allow_credentials=True,     allow_methods=['*'],     allow_headers=['*'], )  # define function to be run as background tasks def generate(email, settings):     clipit.do_init(settings)     clipit.do_run(settings)      prompt = \" | \".join(settings.prompts)      email_results_mailgun(email, prompt)  @app.get('\/') async def root():     return {'hello': 'world'}  @app.post(\"\/generate\") async def add_task(         email: str,         background_tasks: BackgroundTasks,         seed: int = Form(None),         iterations: int = Form(None),         prompts: str = Form(\"Underwater City\"),         quality: str = Form(\"draft\"),         aspect: str = Form(\"square\"),         scale: float = Form(2.5),         style: str = Form('image'),         make_video: bool = Form(False),           ):     torch.cuda.empty_cache()     clipit.reset_settings()      use_pixeldraw = (style == 'Pixel Art')     use_clipdraw = (style == 'Painting')     clipit.add_settings(prompts=prompts,                         seed=seed,                         iterations=iterations,                         aspect=aspect,                         quality=quality,                         scale=scale,                         use_pixeldraw=use_pixeldraw,                         use_clipdraw=use_clipdraw,                         make_video=make_video)          settings = clipit.apply_settings()      # Run function as background task     background_tasks.add_task(generate, email, settings)      return {\"message\": \"Task is processed in the background\"}   <\/code><\/pre>\n<\/div>\n<\/details>\n<p>\u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043f\u0440\u0438\u0432\u0435\u0434\u0451\u043d\u043d\u043e\u0433\u043e \u0432\u044b\u0448\u0435 \u043a\u043e\u0434\u0430 \u0441\u0435\u0440\u0432\u0435\u0440 \u0431\u044b\u0441\u0442\u0440\u043e \u043e\u0442\u0432\u0435\u0442\u0438\u0442 \u043d\u0430 \u0437\u0430\u043f\u0440\u043e\u0441 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435\u043c &#171;Task is processed in the background&#187; \u0432\u043c\u0435\u0441\u0442\u043e \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0436\u0434\u0430\u0442\u044c \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0438 \u043e\u0442\u0432\u0435\u0442\u0430 \u0441 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435\u043c. \u041a\u043e\u0433\u0434\u0430 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u0442\u0441\u044f, \u0441\u0435\u0440\u0432\u0435\u0440 \u043f\u043e \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u043e\u0439 \u043f\u043e\u0447\u0442\u0435 \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/be8\/d8d\/f0c\/be8d8df0cf912659f654bcf4e5d262ca.png\" alt=\"\u0418\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0438 \u0432\u0438\u0434\u0435\u043e\u0437\u0430\u043f\u0438\u0441\u044c \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u043f\u043e \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u043e\u0439 \u043f\u043e\u0447\u0442\u0435\" title=\"\u0418\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0438 \u0432\u0438\u0434\u0435\u043e\u0437\u0430\u043f\u0438\u0441\u044c \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u043f\u043e \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u043e\u0439 \u043f\u043e\u0447\u0442\u0435\" width=\"611\" height=\"345\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/be8\/d8d\/f0c\/be8d8df0cf912659f654bcf4e5d262ca.png\"\/><figcaption>\u0418\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0438 \u0432\u0438\u0434\u0435\u043e\u0437\u0430\u043f\u0438\u0441\u044c \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u043f\u043e \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u043e\u0439 \u043f\u043e\u0447\u0442\u0435<\/figcaption><\/figure>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c, \u043a\u043e\u0433\u0434\u0430 \u0432\u0441\u0451 \u0432\u0440\u043e\u0434\u0435 \u0431\u044b \u0437\u0430\u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e, \u044f \u0441\u043e\u0437\u0434\u0430\u043b \u0444\u0440\u043e\u043d\u0442\u0435\u043d\u0434 \u0438 \u043f\u043e\u0434\u0435\u043b\u0438\u043b\u0441\u044f \u0441\u0430\u0439\u0442\u043e\u043c \u0441\u043e \u0441\u0432\u043e\u0438\u043c\u0438 \u0434\u0440\u0443\u0437\u044c\u044f\u043c\u0438. \u041e\u0434\u043d\u0430\u043a\u043e \u043f\u0440\u0438 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u0441 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c\u0438 \u044f \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u043b, \u0447\u0442\u043e \u0435\u0441\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u0438\u0437\u043c\u0430.<\/p>\n<p>\u041a\u043e\u0433\u0434\u0430 \u0432\u0442\u043e\u0440\u043e\u0439 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0434\u0435\u043b\u0430\u0435\u0442 \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440, \u0432 \u0442\u043e \u0432\u0440\u0435\u043c\u044f \u043a\u0430\u043a \u043f\u0435\u0440\u0432\u0430\u044f \u0437\u0430\u0434\u0430\u0447\u0430 \u0432\u0441\u0451 \u0435\u0449\u0451 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442\u0441\u044f, \u0432\u0442\u043e\u0440\u0430\u044f \u0437\u0430\u0434\u0430\u0447\u0430 \u043a\u0430\u043a\u0438\u043c-\u0442\u043e \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0437\u0430\u0432\u0435\u0440\u0448\u0430\u0435\u0442 \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u043f\u0440\u043e\u0446\u0435\u0441\u0441, \u0432\u043c\u0435\u0441\u0442\u043e \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u044b\u0439 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0438\u043b\u0438 \u043e\u0447\u0435\u0440\u0435\u0434\u044c.<\/p>\n<p>\u041d\u0435 \u0431\u044b\u043b\u043e \u0443\u0432\u0435\u0440\u0435\u043d\u043d\u043e\u0441\u0442\u0438, \u0447\u0442\u043e \u0432\u044b\u0437\u0432\u0430\u043b\u043e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u044d\u0442\u043e \u0431\u044b\u043b\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0432 \u043a\u043e\u0434\u0435 clipit, \u0430 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043d\u0435\u0442. \u042f \u0431\u044b\u0441\u0442\u0440\u043e \u043f\u043e\u043d\u044f\u043b, \u0447\u0442\u043e \u043c\u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u043e\u0447\u0435\u0440\u0435\u0434\u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439.<\/p>\n<p>\u041f\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u043c \u043f\u043e\u0438\u0441\u043a\u043e\u0432 \u0432 Google \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u0442 RabbitMQ \u0438\u043b\u0438 Redis. \u041e\u0434\u043d\u0430\u043a\u043e \u044f \u043d\u0435 \u0431\u044b\u043b \u0443\u0432\u0435\u0440\u0435\u043d, \u043c\u043e\u0436\u043d\u043e \u043b\u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c RabbitMQ \u0438\u043b\u0438 Redis \u043d\u0430 Google Colab: \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e, \u043f\u043e\u0445\u043e\u0436\u0435, \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0435 sudo. <\/p>\n<p>\u0412 \u043a\u043e\u043d\u0446\u0435 \u043a\u043e\u043d\u0446\u043e\u0432, \u044f \u0440\u0435\u0448\u0438\u043b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c Google Firebase, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0445\u043e\u0442\u0435\u043b \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u0442\u044c \u043f\u0440\u043e\u0435\u043a\u0442 \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0441\u043a\u043e\u0440\u0435\u0435, \u0430 \u0441 Firebase \u044f \u0437\u043d\u0430\u043a\u043e\u043c \u043b\u0443\u0447\u0448\u0435 \u0432\u0441\u0435\u0433\u043e.<\/p>\n<p>\u0412 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c, \u043a\u043e\u0433\u0434\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043f\u044b\u0442\u0430\u0435\u0442\u0441\u044f \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0440\u0438\u0441\u0443\u043d\u043e\u043a \u0432\u043e \u0444\u0440\u043e\u043d\u0442\u0435\u043d\u0434\u0435, \u043e\u043d \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u0437\u0430\u043f\u0438\u0441\u044c \u0432 queue, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u0437\u0430\u0434\u0430\u0447\u0443 (\u0432\u0432\u0435\u0434\u0451\u043d\u043d\u044b\u0439 \u0442\u0435\u043a\u0441\u0442, \u0442\u0438\u043f \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f, \u0440\u0430\u0437\u043c\u0435\u0440 \u0438 \u0442. \u0434.).<\/p>\n<p>\u0421 \u0434\u0440\u0443\u0433\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u044b, \u043c\u044b \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043c \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0439 \u043d\u0430 Google Colab, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e \u043f\u0440\u043e\u0441\u043b\u0443\u0448\u0438\u0432\u0430\u0442\u044c \u043d\u043e\u0432\u0443\u044e \u0437\u0430\u043f\u0438\u0441\u044c \u0432 \u043e\u0447\u0435\u0440\u0435\u0434\u0438 \u0438 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0437\u0430\u0434\u0430\u043d\u0438\u044f \u043e\u0434\u043d\u043e \u0437\u0430 \u0434\u0440\u0443\u0433\u0438\u043c. <\/p>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434 \u0431\u044d\u043a\u0435\u043d\u0434\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u0437\u0430\u0434\u0430\u043d\u0438\u0435 \u0438 \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e \u043f\u0440\u043e\u0441\u043b\u0443\u0448\u0438\u0432\u0430\u0435\u0442 \u043e\u0447\u0435\u0440\u0435\u0434\u044c<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"python\">import torch import clipit import time from datetime import datetime import firebase_admin from firebase_admin import credentials, firestore, storage  if not firebase_admin._apps:     cred = credentials.Certificate(\"YOUR_CREDENTIAL_FILE\")     firebase_admin.initialize_app(cred, {         'storageBucket': 'YOUR_BUCKET_URL'     })  db = firestore.client() bucket = storage.bucket()  def generate(doc_id, prompt, quality, style, aspect, email):     torch.cuda.empty_cache()     clipit.reset_settings()      use_pixeldraw = (style == 'pixel art')     use_clipdraw = (style == 'painting')     clipit.add_settings(prompts=prompt,                         seed=seed,                         aspect=aspect,                         quality=quality,                         use_pixeldraw=use_pixeldraw,                         use_clipdraw=use_clipdraw,                         make_video=True)          settings = clipit.apply_settings()     clipit.do_init(settings)     clipit.do_run(settings)      data = {         \"seed\": seed,         \"prompt\": prompt,         \"quality\": quality,         \"aspect\": aspect,         \"type\": style,         \"user\": email,         \"created_at\": datetime.now()     }     db.collection('generated_images').document(doc_id).set(data)     email_results_mailgun(email, prompt)  transaction = db.transaction()  @firestore.transactional def claim_task(transaction, queue_objects_ref):     # query firestore     queue_objects = queue_objects_ref.stream(transaction=transaction)      # pull the document from the iterable     next_item = None     for doc in queue_objects:         next_item = doc      # if queue is empty return status code of 2     if not next_item:         return {\"status\": 2}      # get information from the document      next_item_data = next_item.to_dict()     next_item_data[\"status\"] = 0     next_item_data['id'] = next_item.id      # delete the document and return the information     transaction.delete(next_item.reference)     return next_item_data  # initialize query queue_objects_ref = (     db.collection(\"queue\")     .order_by(\"created_at\", direction=\"ASCENDING\")     .limit(1) )  transaction_attempts = 0 while True:     try:         # apply transaction         next_item_data = claim_task(transaction, queue_objects_ref)         if next_item_data['status'] == 0:             generate(next_item_data['id'],                      next_item_data['prompt'],                      next_item_data['quality'],                      next_item_data['type'],                      next_item_data['aspect'],                      next_item_data['email'])             print(f\"Generated {next_item_data['prompt']} for {next_item_data['email']}\")      except Exception as e:         print(f\"Could not apply transaction. Error: {e}\")         time.sleep(5)         transaction_attempts += 1         if transaction_attempts > 20:             db.collection(\"errors\").add({                 \"exception\": f\"Could not apply transaction. Error: {e}\",                 \"time\": str(datetime.now())             })             exit()<\/code><\/pre>\n<\/div>\n<\/details>\n<p>\u041d\u0430 \u0444\u0440\u043e\u043d\u0442\u0435 \u043d\u0443\u0436\u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043d\u043e\u0432\u0443\u044e \u0437\u0430\u0434\u0430\u0447\u0443 \u0432 \u043e\u0447\u0435\u0440\u0435\u0434\u044c. \u0423\u0431\u0435\u0434\u0438\u0442\u0435\u0441\u044c, \u0447\u0442\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e <span>\u043d\u0430\u0441\u0442\u0440\u043e\u0438\u043b\u0438 Firebase<\/span> \u043d\u0430 \u0444\u0440\u043e\u043d\u0442\u0435\u043d\u0434\u0435:<\/p>\n<pre><code class=\"python\">db.collection(\"queue\").add({         prompt: prompt,         email: email,         quality: quality,         type: type,         aspect: aspect,         created_at: firebase.firestore.FieldValue.serverTimestamp(), })<\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/1b3\/1bc\/af3\/1b31bcaf366fab3d098e1dffc5a066f5.png\" width=\"777\" height=\"476\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/1b3\/1bc\/af3\/1b31bcaf366fab3d098e1dffc5a066f5.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u041c\u044b \u0441\u0434\u0435\u043b\u0430\u043b\u0438 \u044d\u0442\u043e! \u0422\u0435\u043f\u0435\u0440\u044c, \u043a\u043e\u0433\u0434\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043f\u043e\u043f\u044b\u0442\u0430\u0435\u0442\u0441\u044f \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0440\u0438\u0441\u0443\u043d\u043e\u043a \u043d\u0430 \u0444\u0440\u043e\u043d\u0442\u0435\u043d\u0434\u0435, \u043e\u043d \u0434\u043e\u0431\u0430\u0432\u0438\u0442 \u043d\u043e\u0432\u0443\u044e \u0437\u0430\u0434\u0430\u0447\u0443 \u0432 \u043e\u0447\u0435\u0440\u0435\u0434\u044c. \u0417\u0430\u0442\u0435\u043c \u0440\u0430\u0431\u043e\u0447\u0438\u0439 \u0441\u043a\u0440\u0438\u043f\u0442 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435 Colab \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0437\u0430\u0434\u0430\u043d\u0438\u044f \u0432 \u043e\u0447\u0435\u0440\u0435\u0434\u0438, \u043e\u0434\u043d\u043e \u0437\u0430 \u0434\u0440\u0443\u0433\u0438\u043c. \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 <a href=\"https:\/\/github.com\/mfrashad\/text2art\">\u0437\u0430\u0433\u043b\u044f\u043d\u0443\u0442\u044c<\/a> \u0432 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 GitHub, \u0447\u0442\u043e\u0431\u044b \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0432\u0435\u0441\u044c \u043a\u043e\u0434.<\/p>\n<p>\u041b\u0443\u0447\u0448\u0435 \u043f\u043e\u043d\u044f\u0442\u044c \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0438 \u0438 \u043d\u0430\u0443\u0447\u0438\u0442\u044c\u0441\u044f \u0440\u0435\u0448\u0430\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0431\u0438\u0437\u043d\u0435\u0441\u0430 \u0441 \u0438\u0445 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0432\u044b \u0441\u043c\u043e\u0436\u0435\u0442\u0435 \u043d\u0430 \u043d\u0430\u0448\u0438\u0445 \u043a\u0443\u0440\u0441\u0430\u0445:<\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/machine-learning-i-deep-learning?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=data-science_mldl_071021&amp;utm_term=conc\">\u041a\u0443\u0440\u0441 \u00abMachine Learning \u0438 Deep Learning\u00bb (6 \u043c\u0435\u0441\u044f\u0446\u0435\u0432)<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/data-scientist-pro?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=data-science_dspr_071021&amp;utm_term=conc\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f Data Scientist (24 \u043c\u0435\u0441\u044f\u0446\u0430)<\/a><\/p>\n<\/li>\n<\/ul>\n<p>\u0422\u0430\u043a\u0436\u0435 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b <a href=\"https:\/\/skillfactory.ru\/catalogue?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=sf_allcourses_071021&amp;utm_term=conc\">\u0438\u0437 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430<\/a>, \u0447\u0442\u043e\u0431\u044b \u0443\u0432\u0438\u0434\u0435\u0442\u044c, \u043a\u0430\u043a \u043c\u044b \u0433\u043e\u0442\u043e\u0432\u0438\u043c \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u0438\u0441\u0442\u043e\u0432 \u0432 \u0434\u0440\u0443\u0433\u0438\u0445 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f\u0445.<\/p>\n<details class=\"spoiler\">\n<summary>\u0421\u0441\u044b\u043b\u043a\u0438 \u0441\u0442\u0430\u0442\u044c\u0438<\/summary>\n<div class=\"spoiler__content\">\n<p><a href=\"https:\/\/openai.com\/blog\/dall-e\/\">[1]<\/a> DALL-E<\/p>\n<p><a href=\"https:\/\/openai.com\/blog\/clip\/\">[2]<\/a> CLIP<\/p>\n<p><a href=\"https:\/\/ljvmiranda921.github.io\/notebook\/2021\/08\/08\/clip-vqgan\/\">[3]<\/a> CLIP-VQGAN<\/p>\n<p><a href=\"https:\/\/github.com\/orpatashnik\/StyleCLIP\">[4]<\/a> StyleCLIP<\/p>\n<p><a href=\"https:\/\/towardsdatascience.com\/understanding-flask-vs-fastapi-web-framework-fe12bb58ee75\">[5]<\/a> Flask \u043f\u0440\u043e\u0442\u0438\u0432 FastAPI<\/p>\n<\/div>\n<\/details>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/3c2\/80b\/599\/3c280b5993e8b243c5d3f9561fc572c7.png\" width=\"1000\" height=\"200\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/3c2\/80b\/599\/3c280b5993e8b243c5d3f9561fc572c7.png\"\/><figcaption><\/figcaption><\/figure>\n<details class=\"spoiler\">\n<summary>\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u0438 \u0438 \u043a\u0443\u0440\u0441\u044b<\/summary>\n<div class=\"spoiler__content\">\n<p><strong>Data Science \u0438 Machine Learning<\/strong><\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/data-scientist-pro?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=data-science_dspr_071021&amp;utm_term=cat\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f Data Scientist<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/data-analyst-pro?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=analytics_dapr_071021&amp;utm_term=cat\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f Data Analyst<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/matematika-dlya-data-science#syllabus?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=data-science_mat_071021&amp;utm_term=cat\">\u041a\u0443\u0440\u0441 \u00ab\u041c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u043a\u0430 \u0434\u043b\u044f Data Science\u00bb<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/matematika-i-machine-learning-dlya-data-science?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=data-science_matml_071021&amp;utm_term=cat\">\u041a\u0443\u0440\u0441 \u00ab\u041c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u043a\u0430 \u0438 Machine Learning \u0434\u043b\u044f Data Science\u00bb<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/data-engineer?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=data-science_dea_071021&amp;utm_term=cat\">\u041a\u0443\u0440\u0441 \u043f\u043e Data Engineering<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/machine-learning-i-deep-learning?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=data-science_mldl_071021&amp;utm_term=cat\">\u041a\u0443\u0440\u0441 \u00abMachine Learning \u0438 Deep Learning\u00bb<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/machine-learning?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=data-science_ml_071021&amp;utm_term=cat\">\u041a\u0443\u0440\u0441 \u043f\u043e Machine Learning<\/a><\/p>\n<\/li>\n<\/ul>\n<p><strong>Python, \u0432\u0435\u0431-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0430<\/strong><\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/python-fullstack-web-developer?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=coding_fpw_071021&amp;utm_term=cat\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f Fullstack-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u043d\u0430 Python<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/python-for-web-developers?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=coding_pws_071021&amp;utm_term=cat\">\u041a\u0443\u0440\u0441 \u00abPython \u0434\u043b\u044f \u0432\u0435\u0431-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438\u00bb<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/frontend-razrabotchik?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=coding_fr_071021&amp;utm_term=cat\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f Frontend-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/webdev?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=coding_webdev_071021&amp;utm_term=cat\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f \u0412\u0435\u0431-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a<\/a><\/p>\n<\/li>\n<\/ul>\n<p><strong>\u041c\u043e\u0431\u0438\u043b\u044c\u043d\u0430\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0430<\/strong><\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/ios-razrabotchik-s-nulya?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=coding_ios_071021&amp;utm_term=cat\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f iOS-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/android-razrabotchik?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=coding_andr_071021&amp;utm_term=cat\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f Android-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a<\/a><\/p>\n<\/li>\n<\/ul>\n<p><strong>Java \u0438 C#<\/strong><\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/java-razrabotchik?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=coding_java_071021&amp;utm_term=cat\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f Java-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/java-qa-engineer-testirovshik-po?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=coding_qaja_071021&amp;utm_term=cat\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f QA-\u0438\u043d\u0436\u0435\u043d\u0435\u0440 \u043d\u0430 JAVA<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/c-sharp-razrabotchik?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=coding_cdev_071021&amp;utm_term=cat\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f C#-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/game-razrabotchik-na-unity-i-c-sharp?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=coding_gamedev_071021&amp;utm_term=cat\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f \u0420\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0438\u0433\u0440 \u043d\u0430 Unity<\/a><\/p>\n<\/li>\n<\/ul>\n<p><strong>\u041e\u0442 \u043e\u0441\u043d\u043e\u0432 \u2014 \u0432 \u0433\u043b\u0443\u0431\u0438\u043d\u0443<\/strong><\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/algoritmy-i-struktury-dannyh?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=coding_algo_071021&amp;utm_term=cat\">\u041a\u0443\u0440\u0441 \u00ab\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u044b \u0438 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0434\u0430\u043d\u043d\u044b\u0445\u00bb<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/c-plus-plus-razrabotchik?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=coding_cplus_071021&amp;utm_term=cat\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f C++ \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/cyber-security-etichnij-haker?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=coding_hacker_071021&amp;utm_term=cat\">\u041f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f \u042d\u0442\u0438\u0447\u043d\u044b\u0439 \u0445\u0430\u043a\u0435\u0440<\/a><\/p>\n<\/li>\n<\/ul>\n<p><strong>\u0410 \u0442\u0430\u043a\u0436\u0435:<\/strong><\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/skillfactory.ru\/devops-ingineer?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=coding_devops_071021&amp;utm_term=cat\">\u041a\u0443\u0440\u0441 \u043f\u043e DevOps<\/a><\/p>\n<\/li>\n<\/ul>\n<\/div>\n<\/details>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/581794\/\"> https:\/\/habr.com\/ru\/articles\/581794\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0410\u0432\u0442\u043e\u0440 \u0441\u0442\u0430\u0442\u044c\u0438 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442, \u043a\u0430\u043a \u0437\u0430 \u043d\u0435\u0434\u0435\u043b\u044e \u0441\u043e\u0437\u0434\u0430\u043b Text2Art.com \u2014 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 VQGAN+CLIP, \u0441\u043f\u043e\u0441\u043e\u0431\u043d\u044b\u0439 \u0440\u0438\u0441\u043e\u0432\u0430\u0442\u044c \u043f\u0438\u043a\u0441\u0435\u043b\u044c-\u0430\u0440\u0442 \u0438 \u0436\u0438\u0432\u043e\u043f\u0438\u0441\u044c, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0430\u0442\u044c \u0442\u043e, \u0447\u0442\u043e \u0432\u044b \u043d\u0430\u043f\u0438\u0448\u0435\u0442\u0435 \u0432 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u043e\u043c \u043f\u043e\u043b\u0435. <\/p>\n<p>\u0414\u043b\u044f \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f Gradio, \u043c\u043e\u0434\u0435\u043b\u044c \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435 FastAPI, \u0430 \u0441\u0438\u0441\u0442\u0435\u043c\u043e\u0439 \u043e\u0447\u0435\u0440\u0435\u0434\u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u0441\u043b\u0443\u0436\u0438\u0442 Firebase. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u044f\u043c\u0438 \u0434\u0435\u043b\u0438\u043c\u0441\u044f \u043a \u0441\u0442\u0430\u0440\u0442\u0443 <a href=\"https:\/\/skillfactory.ru\/machine-learning-i-deep-learning?utm_source=habr&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=data-science_mldl_071021&amp;utm_term=lead\">\u043a\u0443\u0440\u0441\u0430 \u043f\u043e ML \u0438 DL<\/a>.<\/p>\n<hr\/>\n<figure class=\"\"><figcaption>\u0413\u0430\u043b\u0435\u0440\u0435\u044f Text2Art<\/figcaption><\/figure>\n<p>\u0415\u0441\u043b\u0438 \u0432\u0430\u043c \u043f\u043e\u043d\u0440\u0430\u0432\u0438\u043b\u0441\u044f \u043f\u0440\u043e\u0435\u043a\u0442, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0440\u043e\u0433\u043e\u043b\u043e\u0441\u043e\u0432\u0430\u0442\u044c \u0437\u0430 \u043d\u0435\u0433\u043e <a href=\"https:\/\/devpost.com\/software\/gancreate\">\u0437\u0434\u0435\u0441\u044c<\/a>.<\/p>\n<div class=\"tm-iframe_temp\" data-src=\"https:\/\/embedd.srv.habr.com\/iframe\/615cab744615593b75e24676\" data-style=\"\" id=\"615cab744615593b75e24676\" width=\"\"><\/div>\n<h2>\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/h2>\n<p>\u041d\u0435 \u0442\u0430\u043a \u0434\u0430\u0432\u043d\u043e \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u044b\u0435 \u043a\u0430\u0440\u0442\u0438\u043d\u044b \u0438 NFT \u0448\u0442\u0443\u0440\u043c\u043e\u043c \u0437\u0430\u0445\u0432\u0430\u0442\u0438\u043b\u0438 \u043c\u0438\u0440. \u042d\u0442\u043e \u0441\u0442\u0430\u043b\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u043c \u043f\u043e\u0441\u043b\u0435 \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0433\u0440\u0435\u0441\u0441\u0430 OpenAI \u0432 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0438\u0437 \u0442\u0435\u043a\u0441\u0442\u0430. \u0420\u0430\u043d\u0435\u0435 \u0432 \u044d\u0442\u043e\u043c \u0433\u043e\u0434\u0443 OpenAI \u0430\u043d\u043e\u043d\u0441\u0438\u0440\u043e\u0432\u0430\u043b DALL-E, \u043c\u043e\u0449\u043d\u044b\u0439 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439 \u0438\u0437 \u0442\u0435\u043a\u0441\u0442\u043e\u0432. <\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0438\u043b\u043b\u044e\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0445\u043e\u0440\u043e\u0448\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 DALL-E, \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u0440\u0438\u0441\u0443\u043d\u043a\u0438, \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 DALL-E \u043f\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0443 &#171;a professional high quality illustration of a giraffe dragon chimera, &#171;a giraffe imitating a dragon&#187;, &#171;a giraffe made of dragon&#187;.<\/p>\n<figure class=\"full-width\"><figcaption>\u0418\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043f\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0443 &#171;a professional high quality illustration of a giraffe dragon chimera, &#171;a giraffe imitating a dragon&#187;, &#171;a giraffe made of dragon&#187;.<\/figcaption><\/figure>\n<p>\u041a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, DALL-E \u043d\u0435 \u0431\u044b\u043b \u0432\u044b\u043f\u0443\u0449\u0435\u043d \u0432 \u043c\u0430\u0441\u0441\u044b. \u0412\u043c\u0435\u0441\u0442\u043e \u043d\u0435\u0433\u043e \u0431\u044b\u043b\u0430 \u043e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u043d\u0430 \u043c\u043e\u0434\u0435\u043b\u044c, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0442\u0432\u043e\u0440\u0438\u0442 \u043c\u0430\u0433\u0438\u044e DALL-E, \u2014 CLIP. CLIP \u0438\u043b\u0438 Contrastive Image-Language Pretraining \u2014 \u044d\u0442\u043e \u043c\u0443\u043b\u044c\u0442\u0438\u043c\u043e\u0434\u0430\u043b\u044c\u043d\u0430\u044f \u0441\u0435\u0442\u044c, \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u044f\u044e\u0449\u0430\u044f \u0442\u0435\u043a\u0441\u0442 \u0438 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f. <\/p>\n<blockquote>\n<p>\u041e\u0434\u043d\u0438\u043c \u0441\u043b\u043e\u0432\u043e\u043c, CLIP \u0441\u043f\u043e\u0441\u043e\u0431\u0435\u043d \u043e\u0446\u0435\u043d\u0438\u0442\u044c, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0445\u043e\u0440\u043e\u0448\u043e \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043d\u0430\u0434\u043f\u0438\u0441\u0438 \u0438\u043b\u0438 \u043d\u0430\u043e\u0431\u043e\u0440\u043e\u0442. <\/p>\n<\/blockquote>\n<p>\u042d\u0442\u043e \u043a\u0440\u0430\u0439\u043d\u0435 \u043f\u043e\u043b\u0435\u0437\u043d\u043e \u0432 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0438 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435, \u0442\u043e\u0447\u043d\u043e \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0435 \u0432\u0432\u0435\u0434\u0451\u043d\u043d\u043e\u043c\u0443 \u0442\u0435\u043a\u0441\u0442\u0443. \u0412 \u0444\u0438\u043b\u044c\u043c\u0435 &#171;DALL-E&#187;\u00a0 CLIP \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f, \u0447\u0442\u043e\u0431\u044b \u0440\u0430\u043d\u0436\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0438 \u0432\u0445\u043e\u0434\u043d\u044b\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0441 \u043d\u0430\u0438\u0432\u044b\u0441\u0448\u0438\u043c \u0431\u0430\u043b\u043b\u043e\u043c (\u0441\u0430\u043c\u044b\u0435 \u043f\u043e\u0445\u043e\u0436\u0438\u0435 \u043d\u0430 \u0442\u0435\u043a\u0442\u043e\u0432\u044b\u0439 \u0437\u0430\u043f\u0440\u043e\u0441).<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0427\u0435\u0440\u0435\u0437 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043c\u0435\u0441\u044f\u0446\u0435\u0432 \u043f\u043e\u0441\u043b\u0435 \u0430\u043d\u043e\u043d\u0441\u0430 \u0444\u0438\u043b\u044c\u043c\u0430 DALL-E \u0431\u044b\u043b \u043e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u043d \u043d\u043e\u0432\u044b\u0439 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439-\u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0435\u0440\u043e\u0432 \u043f\u043e\u0434 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c VQGAN (Vector Quantized GAN). \u0421\u043e\u0447\u0435\u0442\u0430\u043d\u0438\u0435 VQGAN \u0441 CLIP \u0434\u0430\u0451\u0442 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u043e, \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e\u0435 DALL-E. \u0421 \u043c\u043e\u043c\u0435\u043d\u0442\u0430 \u043e\u0431\u043d\u0430\u0440\u043e\u0434\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043e\u0431\u0443\u0447\u0435\u043d\u043d\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 VQGAN \u0441\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432\u043e \u0441\u043e\u0437\u0434\u0430\u043b\u043e \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0443\u0434\u0438\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u043a\u0430\u0440\u0442\u0438\u043d.<\/p>\n<p>\u0412\u043e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440\u044b:<\/p>\n<figure class=\"bordered\"><figcaption><\/figcaption><\/figure>\n<figure class=\"\"><figcaption><\/figcaption><\/figure>\n<p>\u042f \u0431\u044b\u043b \u043f\u043e\u0440\u0430\u0436\u0451\u043d \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u043c\u0438 \u0438 \u0437\u0430\u0445\u043e\u0442\u0435\u043b \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u0438\u043c\u0438 \u0441\u043e \u0441\u0432\u043e\u0438\u043c\u0438 \u0434\u0440\u0443\u0437\u044c\u044f\u043c\u0438. \u041d\u043e, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043d\u0435 \u0442\u0430\u043a \u043c\u043d\u043e\u0433\u043e \u043b\u044e\u0434\u0435\u0439 \u0433\u043e\u0442\u043e\u0432\u044b \u043f\u043e\u0433\u0440\u0443\u0437\u0438\u0442\u044c\u0441\u044f \u0432 \u043a\u043e\u0434 \u0440\u0430\u0434\u0438 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043a\u0430\u0440\u0442\u0438\u043d, \u044f \u0440\u0435\u0448\u0438\u043b \u0441\u0434\u0435\u043b\u0430\u0442\u044c Text2Art.com \u2014 \u0441\u0430\u0439\u0442, \u0433\u0434\u0435 \u043b\u044e\u0431\u043e\u0439 \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u0432\u0435\u0441\u0442\u0438 \u043f\u043e\u0434\u0441\u043a\u0430\u0437\u043a\u0443 \u0438 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0443\u0436\u043d\u043e\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435, \u043d\u0435 \u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u044f\u0441\u044c \u0441 \u043a\u043e\u0434\u043e\u043c \u0432\u043e\u043e\u0447\u0438\u044e.<\/p>\n<h2>\u041a\u0430\u043a \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442<\/h2>\n<p>\u0418\u0442\u0430\u043a, \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 VQGAN+CLIP? VQGAN \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435, \u0430 CLIP \u0438\u0437\u043c\u0435\u0440\u044f\u0435\u0442, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043e\u043d\u043e \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0437\u0430\u043f\u0440\u043e\u0441\u0443. \u0417\u0430\u0442\u0435\u043c \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u043e\u0431\u0440\u0430\u0442\u043d\u0443\u044e \u0441\u0432\u044f\u0437\u044c \u043e\u0442 \u043c\u043e\u0434\u0435\u043b\u0438 CLIP, \u0447\u0442\u043e\u0431\u044b \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u0442\u043e\u0447\u043d\u044b\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f. \u041f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0430 \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u0435\u0442\u0441\u044f, \u043f\u043e\u043a\u0430 \u043e\u0446\u0435\u043d\u043a\u0430 CLIP \u043d\u0435 \u0441\u0442\u0430\u043d\u0435\u0442 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0432\u044b\u0441\u043e\u043a\u043e\u0439.<\/p>\n<figure class=\"full-width\"><figcaption>VQGAN \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f, \u043f\u043e\u043a\u0430 CLIP \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441. \u0427\u0435\u043c \u0431\u043e\u043b\u044c\u0448\u0435 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439, \u0442\u0435\u043c \u0442\u043e\u0447\u043d\u0435\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 [\u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a: \u0438\u043b\u043b\u044e\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 VQGAN \u043e\u0442 LJ Miranda]<\/figcaption><\/figure>\n<p>\u042f \u043d\u0435 \u0431\u0443\u0434\u0443 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043e \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u0439 \u0440\u0430\u0431\u043e\u0442\u0435 VQGAN \u0438\u043b\u0438 CLIP. \u041d\u043e, \u0435\u0441\u043b\u0438 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u0433\u043b\u0443\u0431\u043e\u043a\u0438\u0435 \u043e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u044f VQGAN, CLIP \u0438\u043b\u0438 DALL-E, \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u0435\u0441\u044c \u043a \u044d\u0442\u0438\u043c \u0443\u0434\u0438\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c \u0440\u0435\u0441\u0443\u0440\u0441\u0430\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u044f \u043d\u0430\u0448\u0451\u043b:<\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/ljvmiranda921.github.io\/notebook\/2021\/08\/08\/clip-vqgan\/\">\u0418\u043b\u043b\u044e\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 VQGAN<\/a>;<\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/ml.berkeley.edu\/blog\/posts\/vq-vae\/\">\u041e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0435 DALL-E<\/a>;<\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/youtu.be\/T9XSU0pKX2E\">\u041e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0435 \u043d\u0430\u0443\u0447\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u043e CLIP \u043d\u0430 \u0432\u0438\u0434\u0435\u043e<\/a>.<\/p>\n<\/li>\n<\/ul>\n<h3>X + CLIP<\/h3>\n<p>VQGAN+CLIP \u2014 \u044d\u0442\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0438\u043c\u0435\u0440 \u0442\u043e\u0433\u043e, \u043d\u0430 \u0447\u0442\u043e \u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439 \u0441 CLIP. \u041e\u0434\u043d\u0430\u043a\u043e \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c VQGAN \u043d\u0430 \u043b\u044e\u0431\u043e\u0439 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440. \u041f\u043e\u044f\u0432\u0438\u043b\u043e\u0441\u044c \u043c\u043d\u043e\u0433\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 X + CLIP, \u0442\u0430\u043a\u0438\u0445 \u043a\u0430\u043a <a href=\"https:\/\/github.com\/orpatashnik\/StyleCLIP\">StyleCLIP<\/a> (StyleGAN + CLIP), <a href=\"https:\/\/arxiv.org\/abs\/2106.14843\">CLIPDraw<\/a> (\u0432\u0435\u043a\u0442\u043e\u0440\u043d\u044b\u0439 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440), BigGAN + CLIP \u0438 \u043c\u043d\u043e\u0433\u0438\u0435 \u0434\u0440\u0443\u0433\u0438\u0435, \u0434\u0430\u0436\u0435 <a href=\"https:\/\/github.com\/AndreyGuzhov\/AudioCLIP\">AudioCLIP<\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441\u043e \u0437\u0432\u0443\u043a\u043e\u043c, \u0430 \u043d\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f\u043c\u0438.<\/p>\n<figure class=\"full-width\"><figcaption>\u0420\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439 \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 StyleCLIP [\u0440\u0430\u0431\u043e\u0442\u0430 \u043e StyleCLIP]<\/figcaption><\/figure>\n<h2>\u041a\u043e\u0434<\/h2>\n<p>\u042f \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0441\u044c \u043a\u043e\u0434\u043e\u043c \u0438\u0437 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u044f <a href=\"https:\/\/github.com\/dribnet\/clipit\">clipit<\/a> \u043e\u0442 dribnet, \u044d\u0442\u043e\u0442 \u043a\u043e\u0434 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 VQGAN+CLIP \u0432 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u0441\u0442\u0440\u043e\u043a (\u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435: <a href=\"https:\/\/github.com\/dribnet\/clipit\">clipit<\/a> \u043c\u0438\u0433\u0440\u0438\u0440\u043e\u0432\u0430\u043b \u043d\u0430 <a href=\"https:\/\/github.com\/dribnet\/pixray\">pixray<\/a>). \u0415\u0433\u043e \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u0442\u0441\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u043d\u0430 Google Colab: VQGAN+CLIP \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u043c\u043d\u043e\u0433\u043e \u043f\u0430\u043c\u044f\u0442\u0438 GPU. \u0412\u043e\u0442 \u0431\u043b\u043e\u043a\u043d\u043e\u0442 <a href=\"https:\/\/colab.research.google.com\/github\/mfrashad\/text2art\/blob\/main\/text2art.ipynb\">Colab<\/a>. <\/p>\n<p>\u041f\u0440\u0435\u0436\u0434\u0435 \u0432\u0441\u0435\u0433\u043e, \u0435\u0441\u043b\u0438 \u0432\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442\u0435 \u043d\u0430 Colab, \u0443\u0431\u0435\u0434\u0438\u0442\u0435\u0441\u044c, \u0447\u0442\u043e \u0432\u044b \u0438\u0437\u043c\u0435\u043d\u0438\u043b\u0438 \u0442\u0438\u043f \u0440\u0430\u043d\u0442\u0430\u0439\u043c\u0430 \u043d\u0430 GPU, \u0432\u043e\u0442 \u0442\u0430\u043a:<\/p>\n<figure class=\"\"><figcaption><\/figcaption><\/figure>\n<figure class=\"\"><figcaption> <\/figcaption><\/figure>\n<p>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c \u043a\u043e\u0434\u043e\u0432\u0443\u044e \u0431\u0430\u0437\u0443 \u0438 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438:<\/p>\n<pre><code class=\"python\">from IPython.utils import io with io.capture_output() as captured:   !git clone https:\/\/github.com\/openai\/CLIP   # !pip install taming-transformers   !git clone https:\/\/github.com\/CompVis\/taming-transformers.git   !rm -Rf clipit   !git clone https:\/\/github.com\/mfrashad\/clipit.git   !pip install ftfy regex tqdm omegaconf pytorch-lightning   !pip install kornia   !pip install imageio-ffmpeg      !pip install einops   !pip install torch-optimizer   !pip install easydict   !pip install braceexpand   !pip install git+https:\/\/github.com\/pvigier\/perlin-numpy    # ClipDraw deps   !pip install svgwrite   !pip install svgpathtools   !pip install cssutils   !pip install numba   !pip install torch-tools   !pip install visdom    !pip install gradio    !git clone https:\/\/github.com\/BachiLi\/diffvg   %cd diffvg   # !ls   !git submodule update --init --recursive   !python setup.py install   %cd ..      !mkdir -p steps   !mkdir -p models<\/code><\/pre>\n<blockquote>\n<p>&#171;!&#187; \u2014 \u044d\u0442\u043e \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u0430\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u0432 Google Colab, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u0430 \u0432 bash, \u0430 \u043d\u0435 \u0432 python.<\/p>\n<\/blockquote>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u043e \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c clipit \u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u044d\u0442\u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0442\u0440\u043e\u043a \u043a\u043e\u0434\u0430 \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043a\u0430\u0440\u0442\u0438\u043d\u044b \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e VQGAN+CLIP. <\/p>\n<p>\u041f\u0440\u043e\u0441\u0442\u043e \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u0435 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u0443\u044e \u043f\u043e\u0434\u0441\u043a\u0430\u0437\u043a\u0443 \u043d\u0430 \u043b\u044e\u0431\u0443\u044e \u0434\u0440\u0443\u0433\u0443\u044e. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0437\u0430\u0434\u0430\u0442\u044c clipit \u0442\u0430\u043a\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b, \u043a\u0430\u043a \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439, \u0448\u0438\u0440\u0438\u043d\u0430, \u0432\u044b\u0441\u043e\u0442\u0430, \u043c\u043e\u0434\u0435\u043b\u044c \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430, \u0445\u043e\u0442\u0438\u0442\u0435 \u043b\u0438 \u0432\u044b \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u0438\u0434\u0435\u043e \u0438\u043b\u0438 \u043d\u0435\u0442, \u0438 \u043c\u043d\u043e\u0433\u0438\u0435 \u0434\u0440\u0443\u0433\u0438\u0435. \u0427\u0442\u043e\u0431\u044b \u0431\u043e\u043b\u044c\u0448\u0435 \u0443\u0437\u043d\u0430\u0442\u044c \u043e\u0431 \u043e\u043f\u0446\u0438\u044f\u0445, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 <a href=\"https:\/\/github.com\/mfrashad\/clipit\/blob\/master\/clipit.py\">\u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c <\/a>\u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434.<\/p>\n<p>\u0412\u043e\u0442 \u043a\u043e\u0434 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438:<\/p>\n<pre><code class=\"python\">import sys sys.path.append(\"clipit\") import clipit  # To reset settings to default clipit.reset_settings()  # You can use \"|\" to separate multiple prompts prompts = \"underwater city\"  # You can trade off speed for quality: draft, normal, better, best quality = \"normal\"  # Aspect ratio: widescreen, square aspect = \"widescreen\"  # Add settings clipit.add_settings(prompts=prompts, quality=quality, aspect=aspect)  # Apply these settings and run settings = clipit.apply_settings() clipit.do_init(settings) cliptit.do_run(settings)<\/code><\/pre>\n<p>\u041a\u043e\u0433\u0434\u0430 \u0432\u044b \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u0435 \u043a\u043e\u0434, \u043e\u043d \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435. \u041d\u0430 \u043a\u0430\u0436\u0434\u043e\u0439 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438\u0431\u043b\u0438\u0436\u0430\u0442\u044c\u0441\u044f \u043a \u0442\u0435\u043a\u0441\u0442\u0443, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b \u0432\u0432\u0435\u043b\u0438.<\/p>\n<figure class=\"full-width\"><figcaption>\u0418\u0442\u0435\u0440\u0430\u0446\u0438\u0438 \u043f\u043e \u0437\u0430\u0440\u043e\u0441\u0443 \u201cunderwater city\u201d<\/figcaption><\/figure>\n<h3>\u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439<\/h3>\n<p>\u0412\u043e\u0442 \u0442\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439, \u0438\u043c \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 <code>iterations<\/code>:<\/p>\n<pre><code class=\"python\">clipit.add_settings(iterations=500)<\/code><\/pre>\n<h3>\u0413\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u0432\u0438\u0434\u0435\u043e<\/h3>\n<p>\u0412 \u043b\u044e\u0431\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0443\u0436\u043d\u043e \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u044d\u0442\u0438 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0438 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u044e \u0441\u0430\u043c\u043e\u0439 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0434\u043e\u0431\u0430\u0432\u044c\u0442\u0435 <code>make_video=True<\/code> \u043f\u0435\u0440\u0435\u0434 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435\u043c \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a.<\/p>\n<pre><code class=\"python\">clipit.add_settings(make_video=True)<\/code><\/pre>\n<p>\u041f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f \u044d\u0442\u043e\u0442 \u0440\u043e\u043b\u0438\u043a:<\/p>\n<figure class=\"\"><figcaption>\u0421\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043f\u043e\u0434\u0432\u043e\u0434\u043d\u044b\u0439 \u0433\u043e\u0440\u043e\u0434, \u0437\u0430\u043f\u0440\u043e\u0441 \u201cUnderwater City\u201d<\/figcaption><\/figure>\n<h3>\u0423\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439<\/h3>\n<p>\u0420\u0430\u0437\u043c\u0435\u0440 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043e\u043f\u0446\u0438\u0435\u0439\u00a0<code>size=(width, height)<\/code>. \u0421\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c \u0431\u0430\u043d\u043d\u0435\u0440\u043d\u043e\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0441 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0435\u043c 800&#215;200. \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u0431\u043e\u043b\u0435\u0435 \u0432\u044b\u0441\u043e\u043a\u043e\u0435 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u0431\u043e\u043b\u044c\u0448\u0435\u0433\u043e \u043e\u0431\u044a\u0451\u043c\u0430 \u043f\u0430\u043c\u044f\u0442\u0438 GPU.<\/p>\n<pre><code class=\"python\">clipit.add_settings(size=(800, 200))<\/code><\/pre>\n<figure class=\"full-width\"><figcaption>\u0411\u0430\u043d\u043d\u0435\u0440 800&#215;200 \u043f\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0443 \u201cFantasy Kingdom #artstation\u201d<\/figcaption><\/figure>\n<h3>\u0413\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u043f\u0438\u043a\u0441\u0435\u043b\u044c-\u0430\u0440\u0442\u0430<\/h3>\n<p>\u041c\u043e\u0436\u043d\u043e \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438 \u043f\u0438\u043a\u0441\u0435\u043b\u044c-\u0430\u0440\u0442. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0440\u0435\u043d\u0434\u0435\u0440\u0435\u0440 CLIPDraw \u0437\u0430 \u0441\u0446\u0435\u043d\u043e\u0439 \u0441 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u0438\u043d\u0436\u0435\u043d\u0435\u0440\u043d\u044b\u043c\u0438 \u0440\u0435\u0448\u0435\u043d\u0438\u044f\u043c\u0438, \u0442\u0430\u043a\u0438\u043c\u0438 \u043a\u0430\u043a \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0435 \u0446\u0432\u0435\u0442\u043e\u0432 \u043f\u0430\u043b\u0438\u0442\u0440\u044b, \u043f\u0438\u043a\u0441\u0435\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0438 \u0442.\u0434. \u041f\u0440\u043e\u0441\u0442\u043e \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u0435 \u043e\u043f\u0446\u0438\u044e <code>use_pixeldraw=True<\/code>.<\/p>\n<pre><code class=\"python\">clipit.add_settings(use_pixeldraw=True)<\/code><\/pre>\n<figure class=\"\"><figcaption>\u0418\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u043f\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0443 \u201cKnight in armor #pixelart\u201d<\/figcaption><\/figure>\n<figure class=\"\"><figcaption>\u0418\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u043f\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0443 \u201cA world of chinese fantasy video game #pixelart\u201d<\/figcaption><\/figure>\n<h3>VQGAN+CLIP \u043c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0445 \u0441\u043b\u043e\u0432<\/h3>\n<p>\u0418\u0437-\u0437\u0430 \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u044f \u0432 CLIP \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0445 \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0445 \u0441\u043b\u043e\u0432 \u043a \u043f\u043e\u0434\u0441\u043a\u0430\u0437\u043a\u0435 \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u0434\u0430\u0442\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0439 \u044d\u0444\u0444\u0435\u043a\u0442 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c\u043e\u043c\u0443 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044e. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u043b\u043e\u0432\u0430 &#171;unreal engine&#187;\u00a0 \u043a \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u043e\u0439 \u043f\u043e\u0434\u0441\u043a\u0430\u0437\u043a\u0435, \u043a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u043e, \u0441\u043e\u0437\u0434\u0430\u0451\u0442 \u0440\u0435\u0430\u043b\u0438\u0441\u0442\u0438\u0447\u043d\u043e\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0438\u043b\u0438 HD \u0441\u0442\u0438\u043b\u044c. \u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0445 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0439 \u0441\u0430\u0439\u0442\u043e\u0432, \u0442\u0430\u043a\u0438\u0445 \u043a\u0430\u043a &#171;deviantart&#187;, &#171;artstation&#187;\u00a0 \u0438\u043b\u0438 &#171;flickr&#187;, \u043e\u0431\u044b\u0447\u043d\u043e \u0434\u0435\u043b\u0430\u0435\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0431\u043e\u043b\u0435\u0435 \u044d\u0441\u0442\u0435\u0442\u0438\u0447\u043d\u044b\u043c\u0438. \u041c\u043d\u0435 \u0431\u043e\u043b\u044c\u0448\u0435 \u0432\u0441\u0435\u0433\u043e \u043d\u0440\u0430\u0432\u0438\u0442\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0435 \u0441\u043b\u043e\u0432\u043e &#171;artstation\u201d, \u0442\u0430\u043a \u043a\u0430\u043a \u044f \u0441\u0447\u0438\u0442\u0430\u044e, \u0447\u0442\u043e \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043b\u0443\u0447\u0448\u0438\u0435 \u043a\u0430\u0440\u0442\u0438\u043d\u044b.<\/p>\n<figure class=\"full-width\"><figcaption>\u0421\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0445 \u0441\u043b\u043e\u0432<\/figcaption><\/figure>\n<p>\u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0435 \u0441\u043b\u043e\u0432\u0430, \u0447\u0442\u043e\u0431\u044b \u043e\u0431\u0443\u0441\u043b\u043e\u0432\u0438\u0442\u044c \u0445\u0443\u0434\u043e\u0436\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u0441\u0442\u0438\u043b\u044c: &#171;pencil sketch\u201d, &#171;low poly&#187; \u0438\u043b\u0438 \u0434\u0430\u0436\u0435 \u0438\u043c\u044f \u0445\u0443\u0434\u043e\u0436\u043d\u0438\u043a\u0430 \u2014 &#171;Thomas Kinkade&#187; \u0438\u043b\u0438 &#171;James Gurney\u201d.<\/p>\n<figure class=\"full-width\"><figcaption>\u041a\u043b\u044e\u0447\u0435\u0432\u044b\u0435 \u0441\u043b\u043e\u0432\u0430 \u0441\u0442\u0438\u043b\u044f \u2014 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435<\/figcaption><\/figure>\n<p>\u0427\u0442\u043e\u0431\u044b \u0443\u0437\u043d\u0430\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 \u043e \u0432\u043b\u0438\u044f\u043d\u0438\u0438 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0445 \u0441\u043b\u043e\u0432, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f \u0441 <a href=\"https:\/\/imgur.com\/a\/SALxbQm\">\u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435\u043c<\/a>, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u0431\u043e\u043b\u0435\u0435 200 \u0441\u043b\u043e\u0432 \u043d\u0430 4 \u0442\u0435\u043c\u044b.<\/p>\n<h2>UI \u043d\u0430 Gradio<\/h2>\n<p><a href=\"https:\/\/gradio.app\/\">Gradio<\/a> \u2014 \u044d\u0442\u043e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 Python, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0443\u043f\u0440\u043e\u0449\u0430\u0435\u0442 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u0435 \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u0439 ML \u0434\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0441\u0442\u0440\u043e\u043a \u043a\u043e\u0434\u0430. \u0414\u0435\u043c\u043e\u0432\u0435\u0440\u0441\u0438\u044f \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u043c\u0435\u043d\u044c\u0448\u0435 10 \u043c\u0438\u043d\u0443\u0442 \u0440\u0430\u0431\u043e\u0442\u044b. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c Gradio \u0432 Colab, \u0438 \u043e\u043d \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u0441\u0441\u044b\u043b\u043a\u0443 \u0434\u043b\u044f \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u043d\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043d\u0430 \u0434\u043e\u043c\u0435\u043d\u0435 Gradio. \u0421\u0441\u044b\u043b\u043a\u043e\u0439 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f.<\/p>\n<p>Gradio \u0438\u043c\u0435\u0435\u0442 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f, \u043d\u043e \u044f \u0441\u0447\u0438\u0442\u0430\u044e, \u0447\u0442\u043e \u044d\u0442\u043e \u0441\u0430\u043c\u0430\u044f \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0430\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430, \u043a\u043e\u0433\u0434\u0430 \u0432\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u0445\u043e\u0442\u0438\u0442\u0435 \u043f\u0440\u043e\u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043e\u0434\u043d\u0443 \u0444\u0443\u043d\u043a\u0446\u0438\u044e.<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u041d\u0438\u0436\u0435 \u043a\u043e\u0434 \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u0434\u043b\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f Text2Art. \u0414\u0443\u043c\u0430\u044e, \u0447\u0442\u043e \u043e\u043d \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u043e\u043d\u044f\u0442\u0435\u043d, \u043d\u043e, \u0435\u0441\u043b\u0438 \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0431\u043e\u043b\u044c\u0448\u0435 \u043e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0439, \u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435 <a href=\"https:\/\/gradio.app\/docs\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e <\/a>Gradio.<\/p>\n<pre><code class=\"python\">import gradio as gr import torch import clipit  # Define the main function def generate(prompt, quality, style, aspect):     torch.cuda.empty_cache()     clipit.reset_settings()          use_pixeldraw = (style == 'pixel art')     use_clipdraw = (style == 'painting')     clipit.add_settings(prompts=prompt,                         aspect=aspect,                         quality=quality,                         use_pixeldraw=use_pixeldraw,                         use_clipdraw=use_clipdraw,                         make_video=True)        settings = clipit.apply_settings()     clipit.do_init(settings)     clipit.do_run(settings)      return 'output.png', 'output.mp4'  # Create the UI prompt = gr.inputs.Textbox(default=\"Underwater city\", label=\"Text Prompt\") quality = gr.inputs.Radio(choices=['draft', 'normal', 'better'], label=\"Quality\") style = gr.inputs.Radio(choices=['image', 'painting','pixel art'], label=\"Type\") aspect = gr.inputs.Radio(choices=['square', 'widescreen','portrait'], label=\"Size\")  # Launch the demo iface = gr.Interface(generate, inputs=[prompt, quality, style, aspect], outputs=['image', 'video'],<\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-405572","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/405572","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=405572"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/405572\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=405572"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=405572"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=405572"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}