небольшие правки
This commit is contained in:
parent
d845eeae18
commit
59b876e2f2
|
|
@ -3,15 +3,20 @@
|
|||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Определение породы собаки по фото</title>
|
||||
<link rel="stylesheet" href="static/styles.css">
|
||||
</head>
|
||||
<body>
|
||||
<form enctype="multipart/form-data" method="post" action="/beeds" onsubmit="SavePhoto();return false">
|
||||
<p><input type="file" name="f" id="file-input">
|
||||
<input type="submit" value="Отправить"></p>
|
||||
</form>
|
||||
<div id="result"></div>
|
||||
<img id="image" style="max-width: 200px;"/>
|
||||
</body>
|
||||
<section id="main">
|
||||
<h1>Определить породу собаки по фото</h1>
|
||||
<p>Загрузите фото, чтобы опеределить породу собаки или щенка. Если порода смешанная, после загрузки будет показана вероятность породы животного.</p>
|
||||
<form enctype="multipart/form-data" method="post" action="/beeds" onsubmit="SavePhoto();return false">
|
||||
<p><input type="file" name="f" id="file-input">
|
||||
<input type="submit" value="Отправить"></p>
|
||||
</form>
|
||||
<div id="result"></div>
|
||||
<img id="image" style="max-width: 200px;"/>
|
||||
</body>
|
||||
</section>
|
||||
<script src="static/scripts.js"></script>
|
||||
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -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 += "<div>" + json.results[key] + ": " + key + "</div>";
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
});
|
||||
Loading…
Reference in New Issue