# krisshvamsi/skin-disease-identification-using-image-analysis architecture

> Architecture diagram of the GitHub repository krisshvamsi/skin-disease-identification-using-image-analysis, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/krisshvamsi/skin-disease-identification-using-image-analysis
- Repository: https://github.com/krisshvamsi/skin-disease-identification-using-image-analysis

## Overview

##### Project type and purpose
- This is a full-stack web application for automatic skin-disease identification.
- It uses a deep-learning model (CNN built with Keras/TensorFlow) to analyze uploaded images and predict skin conditions.
- The Flask framework serves the web interface and handles API requests; static assets and HTML templates provide the frontend.

##### File structure
- Root files:
– app.py: main Flask application (controllers/routes, model loading, inference logic).
– README.md, project_documentation.docx: documentation of purpose and design.
- Model code directory: contains Jupyter notebooks (model training, prototyping) but no production code.
- templates/: HTML files (views) for rendering pages (base.html, upload form, results view).
- static/: frontend assets (main.js, main.css) (client-side scripts for image upload, UI interactions).

##### README for architectural insights
- CNN model trained in notebooks, exported and loaded in Flask.
- Flask interacts with Firebase for data storage or user authentication (external service).
- Workflow: user uploads image → Flask preprocesses → CNN inference → result returned → optionally saved to Firebase.

##### Main components and their responsibilities
A. Web Client (Browser)
– Renders HTML/CSS/UI (static assets + templates)
– Handles user interactions (image upload, displaying results) via JavaScript
B. Flask Web Server
– Routes/Controllers in app.py
– Request validation, image preprocessing
– Invokes CNN model for inference
– Sends JSON or HTML response back to client
C. Deep-Learning Model
– Keras/TensorFlow model loaded on startup
– Performs forward pass on input image, returns prediction
D. Data Storage / External Services
– Firebase: stores user submissions, logs, or model metadata
E. Model Training Environment (offline)
– Jupyter notebooks in Model code/ for model development and retraining

##### Relationships & Data Flows
- Client → Flask: HTTP POST with image file
- Flask → Model: in-process function call for inference
- Model → Flask: prediction result
- Flask → Client: JSON or rendered HTML with prediction and confidence
- Flask → Firebase: write user submission & result (optional)
- Model code notebooks operate offline and feed new model artifacts into production (e.g., .h5 file)

##### Architectural Patterns & Design Principles
- MVC pattern:
– Model: CNN artifact loaded by Flask
– View: templates + static assets
– Controller: routes in app.py
- Monolithic deployment: one Flask service bundles web server and model in one process
- Separation of concerns: frontend resources in static/templates, backend logic in app.py, model training separate

##### Details
- Technologies next to components (e.g., Flask, Keras, HTML5).
- Performance considerations (e.g., GPU/CPU inference).

##### Summary
- Layers (presentation, application, model, data).
- Separation of concerns and external dependencies.
- Keep it as detailed as necessary for understanding, without overcrowding—use grouping and layering.
- This will give stakeholders and new engineers a clear view of how the skin-disease identification system is constructed and operates end to end.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client Layer
    subgraph "Client Layer"
        direction TB
        WebClient["Web Client<br/>(HTML/CSS/JS)"]:::frontend
        BaseTemplate["base.html"]:::frontend
        CSS["main.css"]:::frontend
        JS["main.js"]:::frontend
    end

    %% Application Layer
    subgraph "Application Layer"
        direction TB
        FlaskApp["Flask Application<br/>(app.py)"]:::backend
    end

    %% Model Layer
    subgraph "Model Layer"
        direction TB
        CNNModel["CNN Model<br/>(Keras/TensorFlow .h5)"]:::model
    end

    %% Data Layer
    subgraph "Data Layer"
        direction TB
        Firebase["Firebase<br/>(Data Store / Auth)"]:::external
    end

    %% Offline Model Training
    subgraph "Offline Training"
        direction TB
        CNNNotebook["cnn project.ipynb"]:::offline
        SkinCamNotebook["skin_cam_pred.ipynb"]:::offline
    end

    %% Connections
    WebClient -->|"POST /upload image"| FlaskApp
    FlaskApp -->|"model.predict(image_tensor)"| CNNModel
    CNNModel -->|"prediction result"| FlaskApp
    FlaskApp -->|"JSON/HTML response"| WebClient
    FlaskApp -->|"save record (image,result)"| Firebase
    CNNNotebook -.->|"develops model"| CNNModel
    SkinCamNotebook -.->|"prototypes model"| CNNModel

    %% Click Events
    click BaseTemplate "https://github.com/krisshvamsi/skin-disease-identification-using-image-analysis/blob/main/templates/base.html"
    click CSS "https://github.com/krisshvamsi/skin-disease-identification-using-image-analysis/blob/main/static/css/main.css"
    click JS "https://github.com/krisshvamsi/skin-disease-identification-using-image-analysis/blob/main/static/js/main.js"
    click FlaskApp "https://github.com/krisshvamsi/skin-disease-identification-using-image-analysis/blob/main/app.py"
    click CNNNotebook "https://github.com/krisshvamsi/skin-disease-identification-using-image-analysis/blob/main/Model code/cnn project.ipynb"
    click SkinCamNotebook "https://github.com/krisshvamsi/skin-disease-identification-using-image-analysis/blob/main/Model code/skin_cam_pred.ipynb"
    click README "https://github.com/krisshvamsi/skin-disease-identification-using-image-analysis/blob/main/README.md"
    click Doc "https://github.com/krisshvamsi/skin-disease-identification-using-image-analysis/blob/main/project_documentation.docx"

    %% Styles
    classDef frontend fill:#D6EAF8,stroke:#3498DB,stroke-width:1px
    classDef backend fill:#D5F5E3,stroke:#27AE60,stroke-width:1px
    classDef model fill:#FCF3CF,stroke:#F1C40F,stroke-width:1px
    classDef external fill:#FADBD8,stroke:#E74C3C,stroke-width:1px
    classDef offline fill:#F2F3F4,stroke:#95A5A6,stroke-width:1px
```
