2023-07-06 07:32:59 +04:00
|
|
|
|
<!DOCTYPE html>
|
|
|
|
|
<html lang="en">
|
|
|
|
|
<head>
|
|
|
|
|
<meta charset="UTF-8" />
|
|
|
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
|
|
|
<title>Анализ аудиторий</title>
|
2023-07-07 23:21:12 +04:00
|
|
|
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-9ndCyUaIbzAi2FUVXJi0CjmCapSmO7SnpJef0486qhLnuZ2cdeRhO02iuK6FUUVM" crossorigin="anonymous">
|
|
|
|
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js" integrity="sha384-geWF76RCwLtnZ8qwWowPQNguL3RmwHVBC9FhGdlKrxdiJJigb/j/68SIy3Te4Bkz" crossorigin="anonymous"></script>
|
2023-07-06 07:32:59 +04:00
|
|
|
|
</head>
|
|
|
|
|
<body>
|
|
|
|
|
<p>
|
|
|
|
|
Загрузите изображение в поле ниже, чтобы проверить, на фотография пустая
|
|
|
|
|
или заполненная аудитория.
|
|
|
|
|
</p>
|
|
|
|
|
<form id="uploadForm" action="analyze">
|
|
|
|
|
<div>
|
|
|
|
|
<label for="image">Нажмите, чтобы загрузить изображение</label>
|
|
|
|
|
<input type="file" name="image" id="image" />
|
|
|
|
|
</div>
|
|
|
|
|
<div>
|
|
|
|
|
<label for="ontology">Онтология предметной области</label>
|
|
|
|
|
<input type="file" name="ontology" id="ontology" />
|
|
|
|
|
</div>
|
2023-07-07 23:21:12 +04:00
|
|
|
|
<div>
|
|
|
|
|
<label for="queries">Набор запросов для запуска</label>
|
|
|
|
|
<input
|
|
|
|
|
type="text"
|
|
|
|
|
name="queries"
|
|
|
|
|
id="queries"
|
|
|
|
|
value="QueryGetNotEmpty,QueryGetCheck,QueryGetEmpty"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
2023-07-06 07:32:59 +04:00
|
|
|
|
<div>
|
|
|
|
|
<button type="submit">Отправить</button>
|
|
|
|
|
</div>
|
|
|
|
|
</form>
|
|
|
|
|
|
2023-07-07 23:21:12 +04:00
|
|
|
|
<img src="none.png" alt="Результат" id="imgslot" />
|
|
|
|
|
<div id="queriesResult"></div>
|
2023-07-06 07:32:59 +04:00
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
document
|
|
|
|
|
.getElementById("uploadForm")
|
|
|
|
|
.addEventListener("submit", (event) => {
|
|
|
|
|
event.preventDefault();
|
|
|
|
|
const data = new FormData(event.target);
|
|
|
|
|
fetch("/analyze", { method: "POST", body: data })
|
|
|
|
|
.then((res) => res.json())
|
|
|
|
|
.then((data) => {
|
2023-07-07 23:21:12 +04:00
|
|
|
|
const img = document.getElementById("imgslot");
|
|
|
|
|
const queriesResult = document.getElementById("queriesResult");
|
|
|
|
|
|
|
|
|
|
img.src = "none.png";
|
2023-07-06 07:32:59 +04:00
|
|
|
|
if (data.image) {
|
2023-07-07 23:21:12 +04:00
|
|
|
|
img.src = "data:image/jpg;base64," + data.image;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
queriesResult.innerHTML = "";
|
|
|
|
|
if (data.data && data.data.response) {
|
|
|
|
|
for (const [query, result] of Object.entries(
|
|
|
|
|
data.data.response
|
|
|
|
|
)) {
|
|
|
|
|
// Отрисовка результата запросов.
|
|
|
|
|
const markup = `
|
|
|
|
|
<h1>${query}</h1>
|
|
|
|
|
<table class="table table-bordered table-striped">
|
|
|
|
|
<tr>
|
|
|
|
|
${result.columns.map((column) => `<th>${column}</th>`).join("")}
|
|
|
|
|
</tr>
|
|
|
|
|
${result.rows.map(
|
|
|
|
|
(row) =>
|
|
|
|
|
`<tr>${Object.entries(row)
|
|
|
|
|
.map(([key, value]) => `<td>${value.value}</td>`)
|
|
|
|
|
.join("")}</tr>`
|
|
|
|
|
)}
|
|
|
|
|
</table>
|
|
|
|
|
`;
|
|
|
|
|
queriesResult.innerHTML += markup;
|
|
|
|
|
}
|
2023-07-06 07:32:59 +04:00
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
</script>
|
|
|
|
|
</body>
|
|
|
|
|
</html>
|