From 06f871dd2d368d4bd3d97720efccae8f414991c8 Mon Sep 17 00:00:00 2001 From: artem Date: Thu, 26 Feb 2026 10:27:40 +0300 Subject: [PATCH] =?UTF-8?q?=D0=BC=D0=B5=D1=82=D1=80=D0=B8=D0=BA=D0=B0=20?= =?UTF-8?q?=D1=86=D0=B5=D0=BB=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/admin/views/results.py | 7 +------ ...2046-081eb0827a55-parent-commit-3baab00.py | 1 + server/modules/recognizer/service.py | 21 ++++++------------- server/static/scripts.js | 3 +-- server/templates/share.html | 2 +- 5 files changed, 10 insertions(+), 24 deletions(-) diff --git a/server/admin/views/results.py b/server/admin/views/results.py index c0f10eb..f42e30a 100644 --- a/server/admin/views/results.py +++ b/server/admin/views/results.py @@ -31,9 +31,4 @@ class ResultsView(ModelView): "path": _list_thumbnail, } - column_list = [ - "result", - "path", - "beerd", - "probability" - ] + column_list = ["result", "path", "beerd", "probability"] diff --git a/server/migration/versions/2026-02-07-2046-081eb0827a55-parent-commit-3baab00.py b/server/migration/versions/2026-02-07-2046-081eb0827a55-parent-commit-3baab00.py index 984fafb..614a623 100644 --- a/server/migration/versions/2026-02-07-2046-081eb0827a55-parent-commit-3baab00.py +++ b/server/migration/versions/2026-02-07-2046-081eb0827a55-parent-commit-3baab00.py @@ -5,6 +5,7 @@ Revises: bebaddef3e8d Create Date: 2026-02-07 20:46:53.971562 """ + from collections.abc import Sequence import sqlalchemy as sa diff --git a/server/modules/recognizer/service.py b/server/modules/recognizer/service.py index adb6864..acd4f8d 100644 --- a/server/modules/recognizer/service.py +++ b/server/modules/recognizer/service.py @@ -1,4 +1,3 @@ -import asyncio import io import os from dataclasses import dataclass @@ -151,20 +150,16 @@ class RecognizerService: ) description.setdefault(name, []).append(f"/dogs-characteristics/{name.replace(' ', '_')}") results[probabilities] = name - + share_id = await self.create_result( attachment, user_id, device_id, - [ResultNameBeerds(name=results[key], probability=key*100) for key in results], + [ResultNameBeerds(name=results[key], probability=key * 100) for key in results], ) - + return RecognizerResult( - results=results, - images=images, - description=description, - uploaded_attach_id=attachment.id, - share_id=share_id + results=results, images=images, description=description, uploaded_attach_id=attachment.id, share_id=share_id ) async def predict_cat_image(self, image: bytes) -> RecognizerResult: @@ -184,12 +179,8 @@ class RecognizerService: ) results[probabilities] = name return RecognizerResult( - results=results, - images=images, - description=None, - uploaded_attach_id=attachment.id, - share_id=None - ) + results=results, images=images, description=None, uploaded_attach_id=attachment.id, share_id=None + ) def _predict(self, image: bytes, model, device="cpu") -> list[Any]: img_size = (224, 224) diff --git a/server/static/scripts.js b/server/static/scripts.js index cc8ed4f..ad9c368 100644 --- a/server/static/scripts.js +++ b/server/static/scripts.js @@ -21,11 +21,10 @@ async function SavePhoto(self) { if (!shareID) { style = "style='display:none'" } - console.log(style, !shareID); let text = `

Результаты

-
+
diff --git a/server/templates/share.html b/server/templates/share.html index 0730aac..2328b10 100644 --- a/server/templates/share.html +++ b/server/templates/share.html @@ -16,7 +16,7 @@

Результаты

-
+