How maazuddin1/tanishq_jewelry_recomm_system works
Project type and purpose
• This is a machine-learning-powered recommendation system exposed via a Gradio-based web UI.
• Purpose: users upload a jewelry image, and the system returns top-N Tanishq jewelry recommendations.
File structure
• Top-level “app.py” is the Gradio entry point; “frontend/” holds UI code.
• “backend/” contains the service layer and supporting modules (model loader, image processor, recommender).
• “utils/formatter.py” handles response formatting.
• “models/” stores precomputed index and metadata files.
• “config.py” holds global constants (paths, device, default recommendation count).
README for additional insights
• The README defines the pipeline: User → app.py → frontend/gradio_app.py → input_handlers → backend service → supporting modules → config → models.
• No external database; model artifacts live on disk.
a. Main components:
• User & Browser (web client)
• Gradio Web Server (app.py + frontend/gradio_app.py)
• Input Handlers (frontend/input_handlers.py)
• Recommendation Service (backend/jewelry_recomm_service.py)
• Supporting Modules:
– Model Loader (backend/supportingfiles/model_loader.py)
– Image Processor (backend/supportingfiles/image_processor.py)
– Recommender Engine (backend/supportingfiles/recommender.py)
• Configuration Store (config.py)
• Model Artifacts (models/jewelry_index.idx, metadata.pkl)
• Formatter (utils/formatter.py)
b. Relationships & data flows:
1. User uploads image via Browser → Gradio UI
2. Gradio App invokes Input Handler → passes image and parameters
3. Input Handler calls Recommendation Service
4. Service loads model & metadata via Model Loader (uses paths from config)
5. Service preprocesses image via Image Processor (applies transforms from config)
6. Service queries Recommender Engine (uses index + metadata, DEFAULT_NUM_RECOMMENDATIONS)
7. Service returns raw recommendations → Input Handler
8. Input Handler invokes Formatter → produces API response
9. Gradio UI renders output to user
c. Architectural patterns/design principles:
• Layered architecture (Presentation → Application → Domain → Data)
• Single-process monolith, but clear separation of concerns
• Config-driven paths and parameters
• Model artifacts decoupled from code
d. Key technologies & libraries:
• Python 3.x
• Gradio (frontend)
• PyTorch or similar (device handling in config, image transforms)
• FAISS or another vector index (jewelry_index.idx)
• Pickle for metadata
• Standard Python modules for config management
Detailed capture of essential elements
• Do not omit: Input Handler, Formatter, Config, Model Loader, Image Processor, Recommender, Gradio App, Model files.
• Notebook (“nb/”) as a development artifact, separate from production.
• “requirements.txt” & Docker or deployment scripts (if any) as peripheral artifacts.