ссылка на описание в результатах, небольшие правки в сталях
Gitea Actions Demo / build_and_push (push) Successful in 1m17s
Details
Gitea Actions Demo / build_and_push (push) Successful in 1m17s
Details
This commit is contained in:
parent
f63a2cf81e
commit
9f06b5567a
|
|
@ -40,6 +40,7 @@ class RecognizerService:
|
|||
predicted_data = self._predict(image, DOG_MODEL)
|
||||
results = {}
|
||||
images = []
|
||||
description = {}
|
||||
images_dogs = await self._repository.images_dogs()
|
||||
for d in predicted_data:
|
||||
predicted_idx, probabilities = d
|
||||
|
|
@ -54,10 +55,12 @@ class RecognizerService:
|
|||
],
|
||||
}
|
||||
)
|
||||
description.setdefault(name, []).append(f"/dogs-characteristics/{name.replace(" ", "_")}")
|
||||
results[probabilities] = name
|
||||
return {
|
||||
"results": results,
|
||||
"images": images,
|
||||
"description": description,
|
||||
}
|
||||
|
||||
async def predict_cat_image(self, image: bytes) -> dict:
|
||||
|
|
|
|||
|
|
@ -32,7 +32,12 @@ async function SavePhoto(self) {
|
|||
|
||||
// Обработка основных результатов
|
||||
for (let key in json.results) {
|
||||
if (json.description != undefined) {
|
||||
text += `<div class='image-block'><div class='image-text'>${json.results[key]} (вероятность: ${Math.round(parseFloat(key) * 100)}%) <br/><a href="${json.description[json.results[key]]}" target='_blank'>Описание </a></div>`;
|
||||
} else {
|
||||
text += `<div class='image-block'><div class='image-text'>${json.results[key]} (вероятность: ${Math.round(parseFloat(key) * 100)}%)</div>`;
|
||||
}
|
||||
|
||||
|
||||
// Поиск всех изображений для текущего результата
|
||||
let allUrls = [];
|
||||
|
|
|
|||
|
|
@ -129,6 +129,10 @@ form {
|
|||
left: 0;
|
||||
}
|
||||
|
||||
#file-input {
|
||||
max-width: 80%;
|
||||
}
|
||||
|
||||
input[type="submit"] {
|
||||
padding: 10px;
|
||||
color: #fff;
|
||||
|
|
@ -209,6 +213,7 @@ input[type="text"]:hover {
|
|||
border-radius: 6px;
|
||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
||||
transition: transform 0.2s;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
/* Адаптация для мобильных */
|
||||
|
|
|
|||
|
|
@ -45,6 +45,6 @@
|
|||
{% block form %}{% endblock %}
|
||||
</body>
|
||||
</section>
|
||||
<script src="/static/scripts.js?v=5"></script>
|
||||
<script src="/static/scripts.js?v=6"></script>
|
||||
|
||||
</html>
|
||||
|
|
|
|||
Loading…
Reference in New Issue