aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xmagni.py16
-rw-r--r--template.jinja22
2 files changed, 15 insertions, 3 deletions
diff --git a/magni.py b/magni.py
index f1aaef9..dde17f7 100755
--- a/magni.py
+++ b/magni.py
@@ -95,6 +95,8 @@ def get_image_path() -> str:
return image_path
+# TODO-both models are garbage. should train models specifically
+# for black and white pics.
def espcn_superscaler(img):
"""ESPCN superscaler."""
superres = cv2.dnn_superres.DnnSuperResImpl_create()
@@ -203,8 +205,18 @@ async def model_downloader() -> typing.Optional[
"https://github.com/Saafke/FSRCNN_Tensorflow/raw/master/models/FSRCNN_x2.pb",
]
+ url_list: typing.List[str] = []
+ for model in down_list:
+ if (
+ os.path.exists(
+ get_model_path() + "/" + model[model.rfind("/") + 1 :]
+ )
+ is False
+ ):
+ url_list.append(model)
+
url_tag_list: typing.List[typing.Tuple[str, str]] = []
- for url in down_list:
+ for url in url_list:
url_tag_list.append((url, url[url.rfind("/") + 1 :]))
response_list: typing.Optional[
typing.List[typing.Tuple[requests.Response, str]]
@@ -306,7 +318,7 @@ def serve(port: int) -> None:
"""Startup a simple http file server."""
handler = MagniHTTPRequestHandler
- print("now servering on {}:{}".format("127.0.0.1", repr(port)))
+ print(f"now servering on 127.0.0.1:{repr(port)}")
with socketserver.TCPServer(("", port), handler) as httpd:
httpd.serve_forever()
diff --git a/template.jinja2 b/template.jinja2
index e307b6b..1ba2f40 100644
--- a/template.jinja2
+++ b/template.jinja2
@@ -10,7 +10,7 @@
<p align="center">
<div>
{% for image in image_list %}
- <img src={{image}} alt="">
+ <img src={{image}} alt="" align="middle">
{% endfor %}
</div>
</p>