From 59b876e2f2742bd53bea9ac2d9c1fd29c7346ba9 Mon Sep 17 00:00:00 2001 From: artem Date: Sun, 30 Apr 2023 20:58:01 +0300 Subject: [PATCH] =?UTF-8?q?=D0=BD=D0=B5=D0=B1=D0=BE=D0=BB=D1=8C=D1=88?= =?UTF-8?q?=D0=B8=D0=B5=20=D0=BF=D1=80=D0=B0=D0=B2=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/index.html | 19 ++++++++++++------- server/static/scripts.js | 15 +++++++++++---- 2 files changed, 23 insertions(+), 11 deletions(-) diff --git a/server/index.html b/server/index.html index 68218a8..1135a3f 100644 --- a/server/index.html +++ b/server/index.html @@ -3,15 +3,20 @@ Определение породы собаки по фото + -
-

-

-
-
- - +
+

Определить породу собаки по фото

+

Загрузите фото, чтобы опеределить породу собаки или щенка. Если порода смешанная, после загрузки будет показана вероятность породы животного.

+
+

+

+
+
+ + +
diff --git a/server/static/scripts.js b/server/static/scripts.js index be49042..261b936 100644 --- a/server/static/scripts.js +++ b/server/static/scripts.js @@ -1,3 +1,6 @@ + +let urlCreator = window.URL || window.webkitURL; + async function SavePhoto() { let photo = document.getElementById("file-input").files[0]; @@ -20,10 +23,14 @@ async function SavePhoto() text += "
" + json.results[key] + ": " + key + "
"; } document.getElementById("result").innerHTML = text; - let urlCreator = window.URL || window.webkitURL; - let imageUrl = urlCreator.createObjectURL(photo); - document.getElementById("image").src = imageUrl; } else { alert("Ошибка HTTP: " + response.status); } -} \ No newline at end of file +} + +document.getElementById("file-input").addEventListener("change", function () { + let photo = document.getElementById("file-input").files[0]; + let imageUrl = urlCreator.createObjectURL(photo); + document.getElementById("image").src = imageUrl; + +}); \ No newline at end of file