code reviewed

This commit is contained in:
Aherobo Ovie Victor
2025-07-22 09:46:32 +01:00
parent a9351f2c86
commit 5e07248594
11 changed files with 24 additions and 7 deletions
+7 -7
View File
@@ -14,13 +14,13 @@ except Exception as e:
print("Could not set torch num threads:", e) print("Could not set torch num threads:", e)
import json import json
import numpy as np import numpy as np
from image_utils import download_image from services.image_utils import download_image
from tag_identification import TagIdentification from models.tag_identification import TagIdentification
from tag_match import get_best_match from models.tag_match import get_best_match
from data_utils import load_tag_guides, load_expert_data, load_community_data from data.data_utils import load_tag_guides, load_expert_data, load_community_data
from image_similarity import load_index, search_similar_images, transform_image from services.image_similarity import load_index, search_similar_images, transform_image
from result_aggregation import aggregate_results from services.result_aggregation import aggregate_results
from llm_tag_similarity import LLMTagSimilarity from models.llm_tag_similarity import LLMTagSimilarity
from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.metrics.pairwise import cosine_similarity from sklearn.metrics.pairwise import cosine_similarity
+17
View File
@@ -0,0 +1,17 @@
# Refactoring Checklist: Backend Folder Structure
## Goal
Restructure the backend code into a more modular, maintainable format.
## Steps
- [ ] 1. Create new folders inside `backend/`: `api/`, `data/`, `models/`, `services/`, `utils/`
- [ ] 2. Move `app.py` to `main.py` in `backend/`
- [ ] 3. Move `data_utils.py` to `backend/data/data_utils.py`
- [ ] 4. Move `image_similarity.py` and `image_utils.py` to `backend/services/`
- [ ] 5. Move `llm_tag_similarity.py`, `tag_identification.py`, and `tag_match.py` to `backend/models/`
- [ ] 6. Move `result_aggregation.py` to `backend/services/`
- [ ] 7. Move `front_tag_embeddings.index` and `tag_identification_cache.json` to `backend/data/`
- [ ] 8. Update all import statements to reflect the new structure
- [ ] 9. Test the application to ensure everything works
- [ ] 10. Update documentation if needed