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