feat: initialize full-stack architecture with backend routes, database schema, and glassmorphic frontend UI

This commit is contained in:
2026-05-13 00:12:19 +03:00
parent bd73f18d5c
commit 0732acbda5
21 changed files with 1937 additions and 307 deletions

View File

@@ -0,0 +1,20 @@
from PIL import Image
import imagehash
import os
def calculate_image_hash(image_path):
"""Вычисляет перцептивный хеш изображения."""
try:
img = Image.open(image_path)
hash_val = imagehash.phash(img)
return str(hash_val)
except Exception as e:
print(f"Hashing Error: {e}")
return None
def compare_hashes(hash1, hash2, threshold=5):
"""Сравнивает два хеша. Если разница меньше порога, изображения считаются похожими."""
h1 = imagehash.hex_to_hash(hash1)
h2 = imagehash.hex_to_hash(hash2)
diff = h1 - h2
return diff <= threshold