diff --git a/assets/img/example2-zip.png b/assets/img/example2-zip.png deleted file mode 100644 index 9ce67bb..0000000 Binary files a/assets/img/example2-zip.png and /dev/null differ diff --git a/assets/img/flags/GB.png b/assets/img/flags/GB.png deleted file mode 100644 index 02fa2a1..0000000 Binary files a/assets/img/flags/GB.png and /dev/null differ diff --git a/assets/img/flags/JP.png b/assets/img/flags/JP.png deleted file mode 100644 index 0516af4..0000000 Binary files a/assets/img/flags/JP.png and /dev/null differ diff --git a/assets/img/flags/RU.png b/assets/img/flags/RU.png deleted file mode 100644 index d9624ca..0000000 Binary files a/assets/img/flags/RU.png and /dev/null differ diff --git a/assets/img/flags/US.png b/assets/img/flags/US.png deleted file mode 100644 index 2b04dcf..0000000 Binary files a/assets/img/flags/US.png and /dev/null differ diff --git a/assets/img/flags/license.txt b/assets/img/flags/license.txt deleted file mode 100644 index 23f7a4c..0000000 --- a/assets/img/flags/license.txt +++ /dev/null @@ -1,15 +0,0 @@ -Flag icons are downloaded from here: https://www.gosquared.com/download/pixels/flags.zip - - - -Text from LICENSE.txt file (MIT license, GPL-compatible): - - - -Copyright (c) 2013 Go Squared Ltd. http://www.gosquared.com/ - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/assets/index.html b/assets/index.html index eb2035e..7ac7981 100644 --- a/assets/index.html +++ b/assets/index.html @@ -1,77 +1,146 @@ - - - - - waifu2x - - - - - - - - -
-
waifu2x
-

Single-Image Super-Resolution for Anime-Style Art using Deep Convolutional Neural Networks. And it supports photo.

- - - -
Convert image:
- -
-
-
Image choosing:
-
- -
Or choose a file:
-
-
Limits: Size: 2MB, Noise Reduction: 2560x2560px, Upscaling: 1280x1280px.
-
- -
-
Style:
-
- - -
-
- -
-
Noise Reduction:
(expect JPEG artifact)
-
- - - - -
-
You need use noise reduction if image actually has noise or it may cause opposite effect.
-
- -
-
Upscaling:
-
- - - -
-
- - - - -
If you are using Firefox, Please press the CTRL+S key to save image. "Save Image" option doesn't work.
- -
-
-
- waifu2x -
- + + + + + + + + + + + + + + waifu2x + + +
+

waifu2x

+
+ + English + + / + + 日本語 + + / + + Русский + + / + + Português + +
+

Single-Image Super-Resolution for Anime-Style Art using Deep Convolutional Neural Networks. And it supports photo.

+ +
+
+
Image choosing:
+
+ +
+ Or choose a file: +
+
+
+ Limits: Size: 2MB, Noise Reduction: 2560x2560px, Upscaling: 1280x1280px. +
+
+
+
+ Style: +
+
+ + +
+
+
+
+ Noise Reduction: +
+ (expect JPEG artifact) +
+
+
+ + + +
+
+ You need use noise reduction if image actually has noise or it may cause opposite effect. +
+
+
+
+ Upscaling: +
+
+
+ + + +
+
+ + + + +
+
    + +
  • If you are using Firefox, Please press the CTRL+S key to save image. "Save Image" option doesn't work.
  • + +
+
+
+
+
+ waifu2x +
+ diff --git a/assets/index.ja.html b/assets/index.ja.html index 22fce92..c1979b2 100644 --- a/assets/index.ja.html +++ b/assets/index.ja.html @@ -1,77 +1,146 @@ - - - - waifu2x - - - - - - - - -
-
waifu2x
-

深層畳み込みニューラルネットワークによる二次元画像のための超解像システム。 写真にも対応。

- - - -
画像を変換します:
- -
-
-
画像:
-
- -
ファイルを選んでください:
-
-
制限: サイズ: 2MB, ノイズ除去: 2560x2560px, 拡大後: 1280x1280px
-
- -
-
スタイル:
-
- - -
-
- -
-
ノイズ除去:
(JPEGノイズを想定)
-
- - - - -
-
画像はノイズがなければノイズ除去すると逆効果を引き起こす可能性があります。
-
- -
-
拡大:
-
- - - -
-
- - - - -
Firefoxの方は、右クリから画像が保存できないようなので、CTRL+SキーかALTキー後 ファイル - ページを保存 で画像を保存してください。
- -
-
-
- waifu2x -
- + + + + + + + + + + + + + waifu2x + + +
+

waifu2x

+
+ + English + + / + + 日本語 + + / + + Русский + + / + + Português + +
+

深層畳み込みニューラルネットワークによる二次元画像のための超解像システム。 写真にも対応。

+ +
+
+
画像を選択:
+
+ +
+ ファイルを選択: +
+
+
+ 制限: サイズ: 3MB, ノイズ除去: 2560x2560px, 拡大(前): 1280x1280px. +
+
+
+
+ スタイル: +
+
+ + +
+
+
+
+ ノイズ除去: +
+ (JPEGノイズを想定) +
+
+
+ + + +
+
+ ノイズ除去は細部が消えることがあります。JPEGノイズがある場合に使用します。 +
+
+
+
+ 拡大: +
+
+
+ + + +
+
+ + + + +
+
    + +
  • Firefoxの方は、右クリから画像が保存できないようなので、CTRL+SキーかALTキー後 ファイル - ページを保存 で画像を保存してください。
  • + +
+
+
+
+
+ waifu2x +
+ diff --git a/assets/index.pt.html b/assets/index.pt.html index 950e154..e71cdc5 100644 --- a/assets/index.pt.html +++ b/assets/index.pt.html @@ -1,66 +1,146 @@ - - + + + - - waifu2x + + + + + - - + + + + waifu2x -

waifu2x

-
-
- Fork me on GitHub - +
+

waifu2x

+ - en/ja/ru/pt +

Single-Image Super-Resolution for Anime-Style Art using Deep Convolutional Neural Networks. And it supports photo.

+ +
+
+
Imagem:
+
+ +
+ ARQUIVO: +
+
+
+ Limites: Tamanho: 2MB, Redução de ruído: 2560x2560px, Aumento de escala: 1280x1280px. +
+
+
+
+ Estilo: +
+
+ + +
+
+
+
+ Redução de ruído: +
+ (Exceto artefato JPEG) +
+
+
+ + + +
+
+ Quando usando a escala 2x, Nós nunca recomendamos usar um nível alto de redução de ruído, quase sempre deixa a imagem pior, faz sentido apenas para casos raros quando a imagem tinha uma qualidade muito má desde o começo. +
+
+
+
+ Aumento de escala: +
+
+
+ + + +
+
+ + + + +
+
    + +
  • Se Você estiver usando o Firefox, por favor, aperte CTRL+S para salvar a imagem. A opção "Salvar Imagem" não funciona
  • + +
+
+
-
-
Single-Image Super-Resolution for Anime-Style Art using Deep Convolutional Neural Networks. And it supports photo. sobre.
-
-
-
-
- Imagem -
- URL: ou -
-
- ARQUIVO: -
-
- Limites: Tamanho: 2MB, Redução de ruído: 2560x2560px, Aumento de escala: 1280x1280px -
-
-
- Estilo - - -
-
- Redução de ruído (Exceto artefato JPEG) - - - -
- Quando usando a escala 2x, Nós nunca recomendamos usar um nível alto de redução de ruído, quase sempre deixa a imagem pior, faz sentido apenas para casos raros quando a imagem tinha uma qualidade muito má desde o começo. -
-
-
- Aumento de escala - - - -
-
- -
-
-
    -
  • Se Você estiver usando o Firefox, por favor, aperte CTRL+S para salvar a imagem. A opção "Salvar Imagem" não funciona -
+ diff --git a/assets/index.ru.html b/assets/index.ru.html index d51764d..03984ad 100644 --- a/assets/index.ru.html +++ b/assets/index.ru.html @@ -1,78 +1,146 @@ - - - - waifu2x - - - - - - - - -
-
waifu2x
-

Waifu2x позволяет увеличивать в 4 раза рисованные изображения, например аниме или арт, а также устранять шум на изображении (преимущественно артефакты сжатия JPEG).

-

Теперь также поддерживаются фотографии.

- - - -
Преобразовать изображение:
- -
-
-
Выбор изображения:
-
- -
Либо выберите файл:
-
-
Макс. размер файла — 2MB, устранение шума — макс. 2560x2560px, апскейл — 1280x1280px.
-
- -
-
Тип изображения:
-
- - -
-
- -
-
Устранение шума:
(артефактов JPEG)
-
- - - - -
-
Устранение шума нужно использовать, если на картинке действительно есть шум, иначе это даст противоположный эффект.
-
- -
-
Апскейл:
(увеличение размера)
-
- - - -
-
- - - - -
Если Вы используете Firefox, для сохранения изображения нажмите Ctrl+S (перетаскивание изображения и опция "Сохранить изображение" работать не будут).
- -
-
-
- waifu2x -
- + + + + + + + + + + + + + waifu2x + + +
+

waifu2x

+ +

Waifu2x позволяет увеличивать в 4 раза рисованные изображения, например аниме или арт, а также устранять шум на изображении (преимущественно артефакты сжатия JPEG). Теперь также поддерживаются фотографии.

+ +
+
+
Выбор изображения:
+
+ +
+ Либо выберите файл: +
+
+
+ Макс. размер файла — 2MB, устранение шума — макс. 2560x2560px, апскейл — 1280x1280px. +
+
+
+
+ Тип изображения: +
+
+ + +
+
+
+
+ Устранение шума: +
+ (артефактов JPEG) +
+
+
+ + + +
+
+ Устранение шума нужно использовать, если на картинке действительно есть шум, иначе это даст противоположный эффект. +
+
+
+
+ Апскейл: +
+
+
+ + + +
+
+ + + + +
+
    + +
  • Если Вы используете Firefox, для сохранения изображения нажмите Ctrl+S (перетаскивание изображения и опция "Сохранить изображение" работать не будут).
  • + +
+
+
+
+
+ waifu2x +
+ diff --git a/assets/mobile.css b/assets/mobile.css new file mode 100644 index 0000000..5d598e4 --- /dev/null +++ b/assets/mobile.css @@ -0,0 +1,28 @@ +body { + width: 98%; + font-size: 100%; +} +.all-page { + width: auto; + margin: 1em auto; + padding: 1em; +} +.main-title { + display: block; +} +.option-left { + width: auto; + display: block; +} +#url { + width: 100%; + height: 2em; +} +.option-right { + display: block; +} +.button { + min-width: 10px; + width: 100%; + height: 3em; +} diff --git a/assets/src/example1-zip.png b/assets/src/example1-zip.png deleted file mode 100644 index 2892269..0000000 Binary files a/assets/src/example1-zip.png and /dev/null differ diff --git a/assets/src/example1.png b/assets/src/example1.png deleted file mode 100644 index a13b930..0000000 Binary files a/assets/src/example1.png and /dev/null differ diff --git a/assets/src/example2.png b/assets/src/example2.png deleted file mode 100644 index 66f69d3..0000000 Binary files a/assets/src/example2.png and /dev/null differ diff --git a/assets/style.css b/assets/style.css index 28c3407..cb5fdef 100644 --- a/assets/style.css +++ b/assets/style.css @@ -1,165 +1,190 @@ -html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, font, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td { margin: 0; padding: 0; border: 0; outline: 0; vertical-align: top; background: transparent; } /*Reset style*/ -button::-moz-focus-inner, input[type="reset"]::-moz-focus-inner, input[type="button"]::-moz-focus-inner, input[type="submit"]::-moz-focus-inner, input[type="submit"]::-moz-focus-inner, input[type="file"] > input[type="button"]::-moz-focus-inner { border: none; } input[type="checkbox"]:focus { -moz-outline-offset: -1px !important; -moz-outline: 1px solid #000 !important; } :focus { outline: none; } /*Remove a dotted line around 1) buttons, 2) checkboxes, 3) links*/ -a { text-decoration: none; cursor: pointer; color: inherit; } a:hover { text-decoration: underline; } -div, span, a, input { background-repeat: no-repeat; } - +button::-moz-focus-inner, +input[type="reset"]::-moz-focus-inner, + input[type="button"]::-moz-focus-inner, + input[type="submit"]::-moz-focus-inner, + input[type="submit"]::-moz-focus-inner, + input[type="file"] > input[type="button"]::-moz-focus-inner +{ + border: none; +} +input[type="checkbox"]:focus { + -moz-outline-offset: -1px !important; + -moz-outline: 1px solid #000 !important; +} +:focus { + outline: none; +} /*Remove a dotted line around 1) buttons, 2) checkboxes, 3) links*/ +a { + text-decoration: none; + cursor: pointer; + color: inherit; +} +a:hover { + text-decoration: underline; +} +div, span, a, input { + background-repeat: no-repeat; +} body { - width: 782px; - margin: 0 auto; - background: #fff; - color: #000; - font-size: 14px; - font-family: Tahoma, Arial, Verdana, Meiryo, "MS Gothic", sans-serif, Lucida Sans; - line-height: 1.5em; - text-align: center; + width: 782px; + margin: 0 auto; + background: #ccc; + color: #000; + font-size: 14px; + font-family: Tahoma, Arial, Verdana, Meiryo, "MS Gothic", sans-serif, Lucida Sans; + line-height: 1.5em; + text-align: center; +} +.all-page { + position: relative; + width: 690px; + margin: 15px auto; + padding: 10px 30px 15px 30px; + background: #eee; + border: 2px solid #999; + border-radius: 8px; + text-align: left; +} +.all-page:after { + content: ""; + position: absolute; + left: -1px; + top: -1px; + width: 100%; + height: 100%; + height: calc(100% - 2px); + padding: 0 1px; + box-shadow: 0px 5px 8px #bbb; + z-index: -1; +} /*for crop shadow bottom for 4px (2px from border and 2px from calc)*/ + +.main-title { + font-size: 2em; + font-weight: bold; + margin: 0.6em 0; + white-space: nowrap; + display: inline-block; } -.allPage { - position: relative; - width: 690px; - margin: 15px auto; - padding: 10px 30px 15px 30px; - background: #eee; - border: 2px solid #999; - text-align: left; -} -.allPage:after { content: ""; position: absolute; left: -1px; top: -1px; width: 100%; height: 100%; height: calc(100% - 2px); padding: 0 1px; box-shadow: 0px 5px 8px #bbb; z-index: -1; } /*for crop shadow bottom for 4px (2px from border and 2px from calc)*/ - -.mainTitle { - font-size: 2em; - font-weight: bold; - margin: 0.6em 0; - white-space: nowrap; -} - -.mainTitle-text { - display: inline-block; -} - -.flagLink { - display: inline-block; -} -.flagLink.first { margin-left: 20px; } - -.chooseLang { - width: 24px; - height: 24px; - margin: 0 5px; - opacity: 0.9; - vertical-align: middle; +.choose-lang { + font-size: 0.8em; + margin: 0 5px; + opacity: 0.9; + vertical-align: middle; } p { - margin: 0.4em 0; + margin: 0.4em 0; } p.margin1 { margin: 0.9em 0; } -.linksBox { - color: #999; +.links-box { + color: #999; } .example { - width: 445px; - height: 200px; + width: 445px; + height: 200px; } -.blueLink { - color: #36b; +.blue-link { + color: #36b; } -.grayLink { - color: #999; +.gray-link { + color: #999; } - - -.secondTitle { - font-size: 1.5em; - font-weight: bold; - margin: 2.4em 0 1.2em; - line-height: 1.3em; +.second-title { + font-size: 1.5em; + font-weight: bold; + margin: 1em 0 1em; + line-height: 1.3em; } -.optionBox { - margin: 1.5em 0; - white-space: nowrap; +.option-box { + margin: 1.5em 0; + white-space: nowrap; } .option-left { - display: inline-block; - width: 180px; - color: #707070; - font-weight: bold; + display: inline-block; + width: 180px; + color: #707070; + font-weight: bold; } .option-left-small { - font-size: 0.8em; - line-height: 1.5em; + font-size: 0.8em; + line-height: 1.5em; } .option-right { - display: inline-block; - white-space: normal; + display: inline-block; + white-space: normal; + vertical-align: top; } .option-right-small { - margin-top: 2px; - font-size: 0.9em; + margin-top: 2px; + font-size: 0.9em; } .option-hint { - margin: 0.5em 0; - color: #888; - font-size: 0.85em; - line-height: 1.5em; - white-space: normal; + margin: 0.5em 0; + color: #888; + font-size: 0.85em; + line-height: 1.5em; + white-space: normal; } #url { - width: 300px; - height: 23px; - padding: 0 3px; - border: 1px solid #b0b0b0; + width: 300px; + height: 23px; + padding: 0 3px; + border: 1px solid #b0b0b0; } label { - margin: 0 5px 0 0; - padding: 0; - cursor: pointer; + margin: 0 5px 0 0; + padding: 0; + cursor: pointer; } .radio { - margin: 0 4px 0 0; - padding: 0; - cursor: pointer; - vertical-align: middle; + margin: 0 4px 0 0; + padding: 0; + cursor: pointer; + vertical-align: middle; } .r-text { - vertical-align: middle; + vertical-align: middle; } .radio:checked + .r-text { color: #494; } .button { - min-width: 160px; - height: 26px; - margin: 0 10px 3px 0; - padding-bottom: 1px; - - background: #f2f2f2; - background-image: linear-gradient(to bottom, #f9f9f9, #dadada); - border: 1px solid #999; - border-radius: 1px; - cursor: pointer; + min-width: 160px; + height: 26px; + margin: 0 10px 3px 0; + padding-bottom: 1px; + background: #f2f2f2; + background-image: linear-gradient(to bottom, #f9f9f9, #dadada); + border: 1px solid #999; + border-radius: 1px; + cursor: pointer; +} +.button:hover { + background: #f7f7f7; + background-image: linear-gradient(to bottom, #fefefe, #e2e2e2); } -.button:hover { background: #f7f7f7; background-image: linear-gradient(to bottom, #fefefe, #e2e2e2); } -.bottomHint { - margin: 0.85em 0; - color: #888; - font-size: 0.85em; - line-height: 1.5em; +.bottom-hint { + margin: 0.85em 0; + color: #888; + font-size: 0.85em; + line-height: 1.5em; } diff --git a/assets/ui.js b/assets/ui.js index 4a7a116..a31b4fa 100644 --- a/assets/ui.js +++ b/assets/ui.js @@ -1,53 +1,52 @@ $(function (){ - var expires = 365; - function clear_file() { - var new_file = $("#file").clone(); - new_file.change(clear_url); - $("#file").replaceWith(new_file); + var expires = 365; + function clear_file() { + var new_file = $("#file").clone(); + new_file.change(clear_url); + $("#file").replaceWith(new_file); + } + function clear_url() { + $("#url").val("") + } + function on_change_style(e) { + var checked = $("input[name=style]:checked"); + if (checked.val() == "art") { + $(".main-title").text("waifu2x"); + } else { + $(".main-title").html("w/a/ifu2x"); } - function clear_url() { - $("#url").val("") + $.cookie("style", checked.val(), {expires: expires}); + } + function on_change_noise_level(e) + { + var checked = $("input[name=noise]:checked"); + $.cookie("noise", checked.val(), {expires: expires}); + } + function on_change_scale_factor(e) + { + var checked = $("input[name=scale]:checked"); + $.cookie("scale", checked.val(), {expires: expires}); + } + function restore_from_cookie() + { + if ($.cookie("style")) { + $("input[name=style]").filter("[value=" + $.cookie("style") + "]").prop("checked", true) } - function on_change_style(e) { - var checked = $("input[name=style]:checked"); - if (checked.val() == "art") { - $(".mainTitle-text").text("waifu2x"); - } else { - $(".mainTitle-text").html("w/a/ifu2x"); - } - $.cookie("style", checked.val(), {expires: expires}); + if ($.cookie("noise")) { + $("input[name=noise]").filter("[value=" + $.cookie("noise") + "]").prop("checked", true) } - function on_change_noise_level(e) - { - var checked = $("input[name=noise]:checked"); - $.cookie("noise", checked.val(), {expires: expires}); + if ($.cookie("scale")) { + $("input[name=scale]").filter("[value=" + $.cookie("scale") + "]").prop("checked", true) } - function on_change_scale_factor(e) - { - var checked = $("input[name=scale]:checked"); - $.cookie("scale", checked.val(), {expires: expires}); - } - function restore_from_cookie() - { - if ($.cookie("style")) { - $("input[name=style]").filter("[value=" + $.cookie("style") + "]").prop("checked", true) - } - if ($.cookie("noise")) { - $("input[name=noise]").filter("[value=" + $.cookie("noise") + "]").prop("checked", true) - } - if ($.cookie("scale")) { - $("input[name=scale]").filter("[value=" + $.cookie("scale") + "]").prop("checked", true) - } - } - - $("#url").change(clear_file); - $("#file").change(clear_url); - $("input[name=style]").change(on_change_style); - $("input[name=noise]").change(on_change_noise_level); - $("input[name=scale]").change(on_change_scale_factor); + } + $("#url").change(clear_file); + $("#file").change(clear_url); + $("input[name=style]").change(on_change_style); + $("input[name=noise]").change(on_change_noise_level); + $("input[name=scale]").change(on_change_scale_factor); - restore_from_cookie(); - on_change_style(); - on_change_scale_factor(); - on_change_noise_level(); + restore_from_cookie(); + on_change_style(); + on_change_scale_factor(); + on_change_noise_level(); }) diff --git a/web.lua b/web.lua index 656701f..070d38e 100644 --- a/web.lua +++ b/web.lua @@ -284,13 +284,8 @@ turbo.log.categories = { local app = turbo.web.Application:new( { {"^/$", FormHandler}, - {"^/style.css", turbo.web.StaticFileHandler, path.join(ROOT, "assets", "style.css")}, - {"^/ui.js", turbo.web.StaticFileHandler, path.join(ROOT, "assets", "ui.js")}, - {"^/index.html", turbo.web.StaticFileHandler, path.join(ROOT, "assets", "index.html")}, - {"^/index.ja.html", turbo.web.StaticFileHandler, path.join(ROOT, "assets", "index.ja.html")}, - {"^/index.ru.html", turbo.web.StaticFileHandler, path.join(ROOT, "assets", "index.ru.html")}, - {"^/index.pt.html", turbo.web.StaticFileHandler, path.join(ROOT, "assets", "index.pt.html")}, {"^/api$", APIHandler}, + {"^/([%a%.]+)$", turbo.web.StaticFileHandler, path.join(ROOT, "assets/")}, } ) app:listen(opt.port, "0.0.0.0", {max_body_size = CURL_MAX_SIZE}) diff --git a/webgen/assets/favicon.ico b/webgen/assets/favicon.ico new file mode 100644 index 0000000..f91fcb2 Binary files /dev/null and b/webgen/assets/favicon.ico differ diff --git a/webgen/assets/mobile.css b/webgen/assets/mobile.css new file mode 100644 index 0000000..5d598e4 --- /dev/null +++ b/webgen/assets/mobile.css @@ -0,0 +1,28 @@ +body { + width: 98%; + font-size: 100%; +} +.all-page { + width: auto; + margin: 1em auto; + padding: 1em; +} +.main-title { + display: block; +} +.option-left { + width: auto; + display: block; +} +#url { + width: 100%; + height: 2em; +} +.option-right { + display: block; +} +.button { + min-width: 10px; + width: 100%; + height: 3em; +} diff --git a/assets/src/favicon.psd b/webgen/assets/src/favicon.psd similarity index 100% rename from assets/src/favicon.psd rename to webgen/assets/src/favicon.psd diff --git a/webgen/assets/style.css b/webgen/assets/style.css new file mode 100644 index 0000000..cb5fdef --- /dev/null +++ b/webgen/assets/style.css @@ -0,0 +1,190 @@ +button::-moz-focus-inner, +input[type="reset"]::-moz-focus-inner, + input[type="button"]::-moz-focus-inner, + input[type="submit"]::-moz-focus-inner, + input[type="submit"]::-moz-focus-inner, + input[type="file"] > input[type="button"]::-moz-focus-inner +{ + border: none; +} +input[type="checkbox"]:focus { + -moz-outline-offset: -1px !important; + -moz-outline: 1px solid #000 !important; +} +:focus { + outline: none; +} /*Remove a dotted line around 1) buttons, 2) checkboxes, 3) links*/ + +a { + text-decoration: none; + cursor: pointer; + color: inherit; +} +a:hover { + text-decoration: underline; +} +div, span, a, input { + background-repeat: no-repeat; +} + +body { + width: 782px; + margin: 0 auto; + background: #ccc; + color: #000; + font-size: 14px; + font-family: Tahoma, Arial, Verdana, Meiryo, "MS Gothic", sans-serif, Lucida Sans; + line-height: 1.5em; + text-align: center; +} +.all-page { + position: relative; + width: 690px; + margin: 15px auto; + padding: 10px 30px 15px 30px; + background: #eee; + border: 2px solid #999; + border-radius: 8px; + text-align: left; +} +.all-page:after { + content: ""; + position: absolute; + left: -1px; + top: -1px; + width: 100%; + height: 100%; + height: calc(100% - 2px); + padding: 0 1px; + box-shadow: 0px 5px 8px #bbb; + z-index: -1; +} /*for crop shadow bottom for 4px (2px from border and 2px from calc)*/ + +.main-title { + font-size: 2em; + font-weight: bold; + margin: 0.6em 0; + white-space: nowrap; + display: inline-block; +} + +.choose-lang { + font-size: 0.8em; + margin: 0 5px; + opacity: 0.9; + vertical-align: middle; +} + +p { + margin: 0.4em 0; +} +p.margin1 { margin: 0.9em 0; } + +.links-box { + color: #999; +} + +.example { + width: 445px; + height: 200px; +} + +.blue-link { + color: #36b; +} + +.gray-link { + color: #999; +} + +.second-title { + font-size: 1.5em; + font-weight: bold; + margin: 1em 0 1em; + line-height: 1.3em; +} + +.option-box { + margin: 1.5em 0; + white-space: nowrap; +} + +.option-left { + display: inline-block; + width: 180px; + color: #707070; + font-weight: bold; +} + +.option-left-small { + font-size: 0.8em; + line-height: 1.5em; +} + +.option-right { + display: inline-block; + white-space: normal; + vertical-align: top; +} + +.option-right-small { + margin-top: 2px; + font-size: 0.9em; +} + +.option-hint { + margin: 0.5em 0; + color: #888; + font-size: 0.85em; + line-height: 1.5em; + white-space: normal; +} + +#url { + width: 300px; + height: 23px; + padding: 0 3px; + border: 1px solid #b0b0b0; +} + +label { + margin: 0 5px 0 0; + padding: 0; + cursor: pointer; +} + +.radio { + margin: 0 4px 0 0; + padding: 0; + cursor: pointer; + vertical-align: middle; +} + +.r-text { + vertical-align: middle; +} + +.radio:checked + .r-text { color: #494; } + +.button { + min-width: 160px; + height: 26px; + margin: 0 10px 3px 0; + padding-bottom: 1px; + background: #f2f2f2; + background-image: linear-gradient(to bottom, #f9f9f9, #dadada); + border: 1px solid #999; + border-radius: 1px; + cursor: pointer; +} +.button:hover { + background: #f7f7f7; + background-image: linear-gradient(to bottom, #fefefe, #e2e2e2); +} + +.bottom-hint { + margin: 0.85em 0; + color: #888; + font-size: 0.85em; + line-height: 1.5em; +} diff --git a/webgen/assets/ui.js b/webgen/assets/ui.js new file mode 100644 index 0000000..a31b4fa --- /dev/null +++ b/webgen/assets/ui.js @@ -0,0 +1,52 @@ +$(function (){ + var expires = 365; + function clear_file() { + var new_file = $("#file").clone(); + new_file.change(clear_url); + $("#file").replaceWith(new_file); + } + function clear_url() { + $("#url").val("") + } + function on_change_style(e) { + var checked = $("input[name=style]:checked"); + if (checked.val() == "art") { + $(".main-title").text("waifu2x"); + } else { + $(".main-title").html("w/a/ifu2x"); + } + $.cookie("style", checked.val(), {expires: expires}); + } + function on_change_noise_level(e) + { + var checked = $("input[name=noise]:checked"); + $.cookie("noise", checked.val(), {expires: expires}); + } + function on_change_scale_factor(e) + { + var checked = $("input[name=scale]:checked"); + $.cookie("scale", checked.val(), {expires: expires}); + } + function restore_from_cookie() + { + if ($.cookie("style")) { + $("input[name=style]").filter("[value=" + $.cookie("style") + "]").prop("checked", true) + } + if ($.cookie("noise")) { + $("input[name=noise]").filter("[value=" + $.cookie("noise") + "]").prop("checked", true) + } + if ($.cookie("scale")) { + $("input[name=scale]").filter("[value=" + $.cookie("scale") + "]").prop("checked", true) + } + } + $("#url").change(clear_file); + $("#file").change(clear_url); + $("input[name=style]").change(on_change_style); + $("input[name=noise]").change(on_change_noise_level); + $("input[name=scale]").change(on_change_scale_factor); + + restore_from_cookie(); + on_change_style(); + on_change_scale_factor(); + on_change_noise_level(); +}) diff --git a/webgen/gen.rb b/webgen/gen.rb new file mode 100644 index 0000000..1289e3d --- /dev/null +++ b/webgen/gen.rb @@ -0,0 +1,56 @@ +require 'erb' +require 'yaml' +require 'optparse' +require 'fileutils' + +def symbolize_keys(val) + if val.is_a?(Hash) + val.map{|k,v| + [k.to_sym, symbolize_keys(v)] + }.to_h + elsif val.is_a?(Array) + val = val.map{|v| symbolize_keys(v)} + else + val + end +end +def load_locales(dir) + locales = {} + Dir.entries(dir).each do |ent| + if ent =~ /^\w\w.yml$/ + lang = File.basename(ent, ".yml") + yml = YAML.load_file(File.join(dir, ent)) + if yml + locales[lang.to_sym] = symbolize_keys(yml) + else + locales[lang.to_sym] = {} + end + end + end + locales +end +def copy(indir, outdir) + files = Dir.entries(indir).to_a.map{|ent| + File.join(indir, ent) + }.select{|ent| + File.file?(ent) + } + FileUtils.copy(files, outdir, preserve: true) +end + +DIR = File.dirname(__FILE__) +DEFAULT_LANG = :en +LANG_DIR = File.join(DIR, "locales") +OUTPUT_DIR = File.join(DIR, "..", "assets") +DONT_MAKE_CHANGE = "This file was automatically generated by webgen/gen.rb. Do not make changes to this file manually." +locales = load_locales(LANG_DIR) +template = File.read(File.join(DIR, "templates", "index.html.erb")) +erb = ERB.new(template) +locales.each do |lang, locale| + output_path = File.join(OUTPUT_DIR, lang == DEFAULT_LANG ? "index.html" : "index.#{lang}.html") + t = locales[DEFAULT_LANG].merge(locale) + t[:dont_make_change] = DONT_MAKE_CHANGE + t[:lang] = lang.to_s + File.write(output_path, erb.result(binding)) +end +copy(File.join(DIR, "assets"), OUTPUT_DIR) diff --git a/webgen/locales/en.yml b/webgen/locales/en.yml new file mode 100644 index 0000000..4549d30 --- /dev/null +++ b/webgen/locales/en.yml @@ -0,0 +1,25 @@ +--- +title: Waifu2x +description: Single-Image Super-Resolution for Anime-Style Art using Deep Convolutional Neural Networks. And it supports photo. +show_demonstration: Show full demonstration +go_to_github: Go to GitHub +image_choosing: Image choosing +type_url: Type URL +choose_file: Or choose a file +file_limits: "Limits: Size: 2MB, Noise Reduction: 2560x2560px, Upscaling: 1280x1280px." +style: Style +artwork: Artwork +photo: Photo +noise_reduction: Noise Reduction +expect_jpeg: expect JPEG artifact +nr_none: None +nr_medium: Medium +nr_high: High +nr_hint: "You need use noise reduction if image actually has noise or it may cause opposite effect." +upscaling: Upscaling +up_none: None +button_convert: Convert +button_download: Download +hints: + - "If you are using Firefox, Please press the CTRL+S key to save image. \"Save Image\" option doesn't work." + \ No newline at end of file diff --git a/webgen/locales/ja.yml b/webgen/locales/ja.yml new file mode 100644 index 0000000..cc051e7 --- /dev/null +++ b/webgen/locales/ja.yml @@ -0,0 +1,24 @@ +--- +title: Waifu2x +description: 深層畳み込みニューラルネットワークによる二次元画像のための超解像システム。 写真にも対応。 +show_demonstration: 実行例を表示 +go_to_github: プロジェクトページ(GitHub) +image_choosing: 画像を選択 +type_url: URLを入力 +choose_file: ファイルを選択 +file_limits: "制限: サイズ: 2MB, ノイズ除去: 2560x2560px, 拡大(前): 1280x1280px." +style: スタイル +artwork: イラスト +photo: 写真 +noise_reduction: ノイズ除去 +expect_jpeg: JPEGノイズを想定 +nr_none: なし +nr_medium: 中 +nr_high: 高 +nr_hint: "ノイズ除去は細部が消えることがあります。JPEGノイズがある場合に使用します。" +upscaling: 拡大 +up_none: なし +button_convert: 実行 +button_download: 実行結果を保存 +hints: + - "Firefoxの方は、右クリから画像が保存できないようなので、CTRL+SキーかALTキー後 ファイル - ページを保存 で画像を保存してください。" diff --git a/webgen/locales/pt.yml b/webgen/locales/pt.yml new file mode 100644 index 0000000..52a2b00 --- /dev/null +++ b/webgen/locales/pt.yml @@ -0,0 +1,24 @@ +--- +title: Waifu2x +description: Single-Image Super-Resolution for Anime-Style Art using Deep Convolutional Neural Networks. And it supports photo. +show_demonstration: Sobre +go_to_github: Ir para Github +image_choosing: Imagem +type_url: URL +choose_file: ARQUIVO +file_limits: "Limites: Tamanho: 2MB, Redução de ruído: 2560x2560px, Aumento de escala: 1280x1280px." +style: Estilo +artwork: Arte +photo: Foto +noise_reduction: Redução de ruído +expect_jpeg: Exceto artefato JPEG +nr_none: Nenhuma +nr_medium: Média +nr_high: Alta +nr_hint: "Quando usando a escala 2x, Nós nunca recomendamos usar um nível alto de redução de ruído, quase sempre deixa a imagem pior, faz sentido apenas para casos raros quando a imagem tinha uma qualidade muito má desde o começo." +upscaling: Aumento de escala +up_none: Nenhum +button_convert: Converter +button_download: Baixar +hints: + - "Se Você estiver usando o Firefox, por favor, aperte CTRL+S para salvar a imagem. A opção \"Salvar Imagem\" não funciona" diff --git a/webgen/locales/ru.yml b/webgen/locales/ru.yml new file mode 100644 index 0000000..5cd98d3 --- /dev/null +++ b/webgen/locales/ru.yml @@ -0,0 +1,24 @@ +--- +title: Waifu2x +description: "Waifu2x позволяет увеличивать в 4 раза рисованные изображения, например аниме или арт, а также устранять шум на изображении (преимущественно артефакты сжатия JPEG). Теперь также поддерживаются фотографии." +show_demonstration: Посмотреть полную демонстрацию +go_to_github: Перейти на GitHub +image_choosing: Выбор изображения +type_url: Укажите URL +choose_file: Либо выберите файл +file_limits: "Макс. размер файла — 2MB, устранение шума — макс. 2560x2560px, апскейл — 1280x1280px." +style: Тип изображения +artwork: Арт +photo: Фотография +noise_reduction: Устранение шума +expect_jpeg: артефактов JPEG +nr_none: Нет +nr_medium: Средне +nr_high: Сильно +nr_hint: "Устранение шума нужно использовать, если на картинке действительно есть шум, иначе это даст противоположный эффект." +upscaling: Апскейл +up_none: Нет +button_convert: Преобразовать +button_download: Скачать +hints: + - "Если Вы используете Firefox, для сохранения изображения нажмите Ctrl+S (перетаскивание изображения и опция \"Сохранить изображение\" работать не будут)." diff --git a/webgen/templates/index.html.erb b/webgen/templates/index.html.erb new file mode 100644 index 0000000..16dd45f --- /dev/null +++ b/webgen/templates/index.html.erb @@ -0,0 +1,148 @@ + + + + + + + + + + + + + + + waifu2x + + +
+

waifu2x

+ +

<%= t[:description] %>

+ +
+
+
<%= t[:image_choosing] %>:
+
+ +
+ <%= t[:choose_file] %>: +
+
+
+ <%= t[:file_limits] %> +
+
+
+
+ <%= t[:style] %>: +
+
+ + +
+
+
+
+ <%= t[:noise_reduction] %>: +
+ (<%= t[:expect_jpeg] %>) +
+
+
+ + + +
+
+ <%= t[:nr_hint] %> +
+
+
+
+ <%= t[:upscaling] %>: +
+
+
+ + + +
+
+ <% if t[:button_convert] && !t[:button_convert].empty? %> + + <% else %> + + <% end %> + +
+
    + <% t[:hints].each do |hint| %> +
  • <%= hint %>
  • + <% end %> +
+
+
+
+
+ waifu2x +
+ +