Update app.py
Browse files
app.py
CHANGED
|
@@ -1684,6 +1684,22 @@ def extract_images_from_pdf(pdf_stream, output_dir):
|
|
| 1684 |
def similarity_matching(sprites_data: dict, project_folder: str, top_k: int = 1, min_similarity: float = None) -> str:
|
| 1685 |
print("🔍 Running similarity matching…")
|
| 1686 |
import os
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1687 |
os.makedirs(project_folder, exist_ok=True)
|
| 1688 |
|
| 1689 |
backdrop_base_path = r"D:\DEV PATEL\2025\scratch_VLM\scratch_agent\blocks\Backdrops"
|
|
|
|
| 1684 |
def similarity_matching(sprites_data: dict, project_folder: str, top_k: int = 1, min_similarity: float = None) -> str:
|
| 1685 |
print("🔍 Running similarity matching…")
|
| 1686 |
import os
|
| 1687 |
+
import json
|
| 1688 |
+
import numpy as np
|
| 1689 |
+
import torch
|
| 1690 |
+
from PIL import Image, ImageOps, ImageEnhance
|
| 1691 |
+
from imagededup.methods import PHash
|
| 1692 |
+
from transformers import AutoImageProcessor, AutoModel
|
| 1693 |
+
import io
|
| 1694 |
+
import base64
|
| 1695 |
+
from pathlib import Path
|
| 1696 |
+
import cv2
|
| 1697 |
+
# hashing & image-match
|
| 1698 |
+
from image_match.goldberg import ImageSignature
|
| 1699 |
+
import sys
|
| 1700 |
+
import math
|
| 1701 |
+
import hashlib
|
| 1702 |
+
from typing import List, Tuple
|
| 1703 |
os.makedirs(project_folder, exist_ok=True)
|
| 1704 |
|
| 1705 |
backdrop_base_path = r"D:\DEV PATEL\2025\scratch_VLM\scratch_agent\blocks\Backdrops"
|