How ritesh2006m/jewellery-sketch-to-realistic-design-transformation- works
Project type and purpose
• This is a full-stack web application whose goal is to transform user-provided jewelry sketches or text prompts into realistic gold-jewelry images and let users organize those outputs into personalized collections.
• Key technologies: React (client), Node.js/Express (backend API), Python/Flask (AI model inference), TensorFlow-Keras model (.h5), and a persistent store for user data.
File structure
• Top level:
• api/ → Node.js + Express backend, contains server.js, userModel.js, model/ with Python scripts and the .h5 model file
• client/ → React single-page application with components, CSS, public assets, and Firebase config
• api/.env : environment variables (e.g., database URI, Firebase secrets)
• client/src/firebase/firebase-config.js : front-end’s Firebase initialization (auth, possibly Firestore)
• package.json in root, api/, client/ indicating separate npm projects and scripts
README
• Describes two “services”:
a. Sketch-to-Jewelry (upload sketch → realistic image)
b. Text-to-Image (text prompt → jewelry design)
• Notes Python dependencies (Flask, TensorFlow, Torch, diffusers), Node dependencies, and instructions to start both backend and frontend with npm scripts.
Main components and interactions
a. Components:
1. User’s Web Browser (UI)
2. React Frontend (client/src)
3. Firebase Auth Service (external)
4. Node.js/Express Backend (api/server.js + user/userModel.js)
5. Python/Flask ML Microservice (api/model/app.py)
6. AI Model File (generator.h5)
7. Datastore (e.g., MongoDB or Firebase Firestore)
8. Object Storage (optional – storing generated images)
b. Data Flow / Interactions:
1. User logs in or signs up via React → Firebase Auth → returns JWT
2. React issues REST calls to Express, attaching JWT
3. Express middleware validates JWT (or uses its own DB via Mongoose) → handles user profile & collection CRUD
4. For generation requests, Express forwards payload (sketch image or text prompt) to Flask ML service
5. Flask loads .h5 model and runs inference → returns generated image
6. Express stores image metadata (and maybe the image itself in object storage) and updates user’s collection in the database
7. React polls or fetches updated collection for display
c. Architectural patterns & principles:
– Clear separation of concerns: UI, API gateway, ML inference service, and persistence
– Microservice style for heavy AI tasks to isolate Python dependencies
– Stateless frontend + stateful backend (JWT-based auth)
– Use of environment variables for secrets/config
d. Key technologies / frameworks:
– React + React Router + CSS modules
– Firebase Auth (and possibly Firestore)
– Express.js + Mongoose (MongoDB) or alternative DB
– Flask + Flask-CORS for Python service
– TensorFlow/Keras, Torch, diffusers for AI inference
Elements
• UI (blue)
• API gateway (green)
• ML microservice (orange)
• External services (gray)
– Notation for environment variables (.env) feeding into Express and Flask