How dileep-sai-paila/kc_detector works
Main Components
• Frontend:
• Represents the mobile or desktop user interface built with Flet.
• Key parts include the file picker, progress bar, result display panel, and demo button.
• Backend:
• A Flask API service handling image upload, processing, and ML predictions.
• Core endpoints include /predict (image analysis and prediction) and /greet (simple health-check endpoint).
• Machine Learning Models:
• ML assets stored in the backend’s static/assets directory:
▸ Random Forest model (RF_model.pkl) for creatinine prediction.
▸ Feature Extractor model (feature_extractor_model.h5) to process input images.
▸ Label Encoder (label_encoder.pkl) for mapping model outputs.
• Data & Static Assets:
• Frontend static assets (e.g., demo_data.json) as well as backend assets used during processing.
• Image Processing Pipeline:
Relationships and Interactions
• The Frontend captures an image (or takes the demo data) and sends it via an API call (using /predict) to the Backend.
• The Backend processes the image using image processing routines and then passes extracted features to the ML models.
• ML models (feature extractor followed by the Random Forest predictor) generate the creatinine level prediction, which is then returned (along with similarity metrics) to the Frontend.
• Additionally, the /greet endpoint demonstrates a direct communication check.
Architectural Patterns and Design Principles
• Separation of Concerns (Frontend for UI/UX; Backend for processing and predictions).
• Modular Design: Isolate image processing, ML prediction, and API routing in the backend.
• Clear API boundary: Defined endpoints ensure a well-structured communication channel.
• Use of pre-trained models emphasizes the reuse of existing components and supports maintainability.
Relevant Technologies and Frameworks
• Backend: Python Flask is used to set up the API, handling request routing, image processing, and ML inference.
• Frontend: Flet UI framework to build a responsive modern interface.
• Machine Learning: Models implemented using Python (likely with libraries such as scikit-learn, TensorFlow/Keras for the feature extractor, etc.).
• Flow within the backend. For example:
• “Image Preprocessing → Feature Extraction → Prediction” as a step-by-step process within the Backend.