Немного красоты
This commit is contained in:
parent
d70592fc64
commit
354d5fdbd5
@ -1,86 +1,100 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en" class="h-100">
|
||||||
<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>
|
|
||||||
<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>
|
|
||||||
</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>
|
|
||||||
<div>
|
|
||||||
<label for="queries">Набор запросов для запуска</label>
|
|
||||||
<input
|
|
||||||
type="text"
|
|
||||||
name="queries"
|
|
||||||
id="queries"
|
|
||||||
value="QueryGetNotEmpty,QueryGetCheck,QueryGetEmpty"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<button type="submit">Отправить</button>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
|
|
||||||
<img src="none.png" alt="Результат" id="imgslot" />
|
<head>
|
||||||
<div id="queriesResult"></div>
|
<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>
|
||||||
|
<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>
|
||||||
|
</head>
|
||||||
|
|
||||||
<script>
|
<body class="bg-body-secondary h-100 d-flex align-items-center">
|
||||||
document
|
<div class="container py-3">
|
||||||
.getElementById("uploadForm")
|
<div class="card">
|
||||||
.addEventListener("submit", (event) => {
|
<div class="card-body">
|
||||||
event.preventDefault();
|
<div class="row">
|
||||||
const data = new FormData(event.target);
|
<div class="col-lg">
|
||||||
fetch("/analyze", { method: "POST", body: data })
|
<p class="alert alert-info">
|
||||||
.then((res) => res.json())
|
Загрузите изображение в поле ниже, чтобы проверить, на
|
||||||
.then((data) => {
|
фотография пустая или заполненная аудитория.
|
||||||
const img = document.getElementById("imgslot");
|
</p>
|
||||||
const queriesResult = document.getElementById("queriesResult");
|
<form id="uploadForm" action="analyze">
|
||||||
|
<div>
|
||||||
|
<label for="image" class="form-label">Нажмите, чтобы загрузить изображение</label>
|
||||||
|
<input type="file" class="form-control" name="image" id="image" />
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label for="ontology" class="form-label">Онтология предметной области</label>
|
||||||
|
<input type="file" class="form-control" name="ontology" id="ontology" />
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label for="queries" class="form-label">Набор запросов для запуска</label>
|
||||||
|
<input type="text" class="form-control" name="queries" id="queries"
|
||||||
|
value="QueryGetNotEmpty,QueryGetCheck,QueryGetEmpty" />
|
||||||
|
</div>
|
||||||
|
<div class="my-3">
|
||||||
|
<button type="submit" class="btn btn-primary">
|
||||||
|
Отправить
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg">
|
||||||
|
<img src="none.png" alt="Результат" id="imgslot" class="w-100" />
|
||||||
|
<div id="queriesResult"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<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) => {
|
||||||
|
const img = document.getElementById("imgslot");
|
||||||
|
const queriesResult = document.getElementById("queriesResult");
|
||||||
|
|
||||||
img.src = "none.png";
|
img.src = "none.png";
|
||||||
if (data.image) {
|
if (data.image) {
|
||||||
img.src = "data:image/jpg;base64," + data.image;
|
img.src = "data:image/jpg;base64," + data.image;
|
||||||
}
|
}
|
||||||
|
|
||||||
queriesResult.innerHTML = "";
|
queriesResult.innerHTML = "";
|
||||||
if (data.data && data.data.response) {
|
if (data.data && data.data.response) {
|
||||||
for (const [query, result] of Object.entries(
|
for (const [query, result] of Object.entries(
|
||||||
data.data.response
|
data.data.response
|
||||||
)) {
|
)) {
|
||||||
// Отрисовка результата запросов.
|
// Отрисовка результата запросов.
|
||||||
const markup = `
|
const markup = `
|
||||||
<h1>${query}</h1>
|
<h1 class="display-6">${query}</h1>
|
||||||
<table class="table table-bordered table-striped">
|
<table class="table table-bordered table-striped">
|
||||||
<tr>
|
<tr>
|
||||||
${result.columns.map((column) => `<th>${column}</th>`).join("")}
|
${result.columns.map((column) => `<th>${column}</th>`).join("")}
|
||||||
</tr>
|
</tr>
|
||||||
${result.rows.map(
|
${result.rows.map(
|
||||||
(row) =>
|
(row) =>
|
||||||
`<tr>${Object.entries(row)
|
`<tr>${Object.entries(row)
|
||||||
.map(([key, value]) => `<td>${value.value}</td>`)
|
.map(([key, value]) => `<td>${value.value}</td>`)
|
||||||
.join("")}</tr>`
|
.join("")}</tr>`
|
||||||
)}
|
)}
|
||||||
</table>
|
</table>
|
||||||
`;
|
`;
|
||||||
queriesResult.innerHTML += markup;
|
queriesResult.innerHTML += markup;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
});
|
});
|
||||||
</script>
|
});
|
||||||
</body>
|
</script>
|
||||||
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
BIN
static/none.png
Normal file
BIN
static/none.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 13 KiB |
Loading…
Reference in New Issue
Block a user