Update app.py
Browse files
app.py
CHANGED
|
@@ -2165,7 +2165,7 @@ def similarity_matching(sprites_data: str, project_folder: str) -> str:
|
|
| 2165 |
# Copy matched backdrop assets + collect
|
| 2166 |
# =========================================
|
| 2167 |
backdrop_data = []
|
| 2168 |
-
|
| 2169 |
for backdrop_idx, matched_idx in enumerate(most_similar_indices):
|
| 2170 |
matched_image_path = folder_image_paths[matched_idx]
|
| 2171 |
matched_folder = os.path.dirname(matched_image_path)
|
|
@@ -2175,6 +2175,11 @@ def similarity_matching(sprites_data: str, project_folder: str) -> str:
|
|
| 2175 |
if not matched_folder.startswith(backdrop_base_path):
|
| 2176 |
continue
|
| 2177 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2178 |
logger.info(f"Matched backdrop: {matched_image_path}")
|
| 2179 |
|
| 2180 |
# 1) Copy the matched backdrop image itself
|
|
|
|
| 2165 |
# Copy matched backdrop assets + collect
|
| 2166 |
# =========================================
|
| 2167 |
backdrop_data = []
|
| 2168 |
+
copied_backdrop_folders = set()
|
| 2169 |
for backdrop_idx, matched_idx in enumerate(most_similar_indices):
|
| 2170 |
matched_image_path = folder_image_paths[matched_idx]
|
| 2171 |
matched_folder = os.path.dirname(matched_image_path)
|
|
|
|
| 2175 |
if not matched_folder.startswith(backdrop_base_path):
|
| 2176 |
continue
|
| 2177 |
|
| 2178 |
+
# skip if backdrop folder already processed
|
| 2179 |
+
if matched_folder in copied_backdrop_folders:
|
| 2180 |
+
continue
|
| 2181 |
+
copied_backdrop_folders.add(matched_folder)
|
| 2182 |
+
|
| 2183 |
logger.info(f"Matched backdrop: {matched_image_path}")
|
| 2184 |
|
| 2185 |
# 1) Copy the matched backdrop image itself
|