# eyesun23/image-webcam-classifier architecture

> Architecture diagram of the GitHub repository eyesun23/image-webcam-classifier, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-22). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/eyesun23/image-webcam-classifier
- Repository: https://github.com/eyesun23/image-webcam-classifier

## Overview

##### Project type and purpose
- This is a client‐side, single‐page web application built with Angular 8.
- Its sole purpose is to let end users upload an image or open their webcam in the browser, then classify the visual content using TensorFlow.js and the pre‐trained MobileNet model.

##### File structure
- Top‐level files like `angular.json`, `package.json`, `.gitignore` indicate an Angular workspace.
- `src/app` contains the core app:
- `app.module.ts` / `app-routing.module.ts`
- `header/` for a static banner
- `image-classifier/` for image‐upload classification
- `webcam-classifier/` for live webcam classification
- `src/environments` holds Angular environment configurations.
- Testing folders (`e2e/`, `src/**/*.spec.ts`) use Protractor and Karma for end‐to‐end and unit tests.

##### README for additional insights
- Confirms Angular 8 front end
- Specifies dependencies: `@tensorflow/tfjs`, `@tensorflow-models/mobilenet`
- No backend or server‐side logic—everything runs in the browser

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Layers and Components

    Browser["User Browser"]:::external

    subgraph "Angular Application Shell"
        direction TB
        AppModule["App Module"]:::ui
        RouterModule["App Routing Module"]:::ui
        HeaderComponent["Header Component"]:::ui
        ImageClassifierComp["ImageClassifier Component"]:::ui
        WebcamClassifierComp["WebcamClassifier Component"]:::ui
    end

    subgraph "TensorFlow Layer"
        direction TB
        TFJS["TensorFlow.js Core"]:::ml
        MobileNet["MobileNet Model"]:::ml
    end

    ExternalStore["Model Weight Store (CDN)"]:::external

    subgraph "User Inputs"
        direction TB
        FileUpload["File Upload Input"]:::ui
        WebcamAPI["Webcam MediaDevices API"]:::ui
    end

    %% Connections
    Browser -->|Loads App| AppModule
    AppModule -->|Configures Routes| RouterModule
    AppModule -->|Declares| HeaderComponent
    RouterModule -->|Route to| ImageClassifierComp
    RouterModule -->|Route to| WebcamClassifierComp

    FileUpload -->|ImageFile| ImageClassifierComp
    WebcamAPI -->|VideoFrame| WebcamClassifierComp

    ImageClassifierComp -->|passes Tensor| TFJS
    WebcamClassifierComp -->|passes Tensor| TFJS

    TFJS -->|loads weights| MobileNet
    MobileNet -->|fetch weights| ExternalStore
    MobileNet -->|returns predictions| TFJS
    TFJS -->|returns predictions| ImageClassifierComp
    TFJS -->|returns predictions| WebcamClassifierComp

    %% Click Events
    click AppModule "https://github.com/eyesun23/image-webcam-classifier/blob/master/src/app/app.module.ts"
    click RouterModule "https://github.com/eyesun23/image-webcam-classifier/blob/master/src/app/app-routing.module.ts"
    click HeaderComponent "https://github.com/eyesun23/image-webcam-classifier/blob/master/src/app/header/header.component.ts"
    click HeaderComponent "https://github.com/eyesun23/image-webcam-classifier/blob/master/src/app/header/header.component.html"
    click HeaderComponent "https://github.com/eyesun23/image-webcam-classifier/blob/master/src/app/header/header.component.scss"
    click ImageClassifierComp "https://github.com/eyesun23/image-webcam-classifier/blob/master/src/app/image-classifier/image-classifier.component.ts"
    click ImageClassifierComp "https://github.com/eyesun23/image-webcam-classifier/blob/master/src/app/image-classifier/image-classifier.component.html"
    click ImageClassifierComp "https://github.com/eyesun23/image-webcam-classifier/blob/master/src/app/image-classifier/image-classifier.component.scss"
    click ImageClassifierComp "https://github.com/eyesun23/image-webcam-classifier/blob/master/src/app/image-classifier/image-classifier.component.spec.ts"
    click WebcamClassifierComp "https://github.com/eyesun23/image-webcam-classifier/blob/master/src/app/webcam-classifier/webcam-classifier.component.ts"
    click WebcamClassifierComp "https://github.com/eyesun23/image-webcam-classifier/blob/master/src/app/webcam-classifier/webcam-classifier.component.html"
    click WebcamClassifierComp "https://github.com/eyesun23/image-webcam-classifier/blob/master/src/app/webcam-classifier/webcam-classifier.component.scss"
    click WebcamClassifierComp "https://github.com/eyesun23/image-webcam-classifier/blob/master/src/app/webcam-classifier/webcam-classifier.component.spec.ts"
    click PredictionInterface "https://github.com/eyesun23/image-webcam-classifier/blob/master/src/app/prediction.ts"
    click EnvironmentDev "https://github.com/eyesun23/image-webcam-classifier/blob/master/src/environments/environment.ts"
    click EnvironmentProd "https://github.com/eyesun23/image-webcam-classifier/blob/master/src/environments/environment.prod.ts"
    click MainEntry "https://github.com/eyesun23/image-webcam-classifier/blob/master/src/main.ts"
    click IndexHTML "https://github.com/eyesun23/image-webcam-classifier/blob/master/src/index.html"
    click GlobalStyles "https://github.com/eyesun23/image-webcam-classifier/blob/master/src/styles.scss"
    click PackageJSON "https://github.com/eyesun23/image-webcam-classifier/blob/master/package.json"
    click E2EConfig "https://github.com/eyesun23/image-webcam-classifier/blob/master/e2e/protractor.conf.js"
    click E2ETest "https://github.com/eyesun23/image-webcam-classifier/blob/master/e2e/src/app.e2e-spec.ts"
    click E2EPage "https://github.com/eyesun23/image-webcam-classifier/blob/master/e2e/src/app.po.ts"
    click KarmaConfig "https://github.com/eyesun23/image-webcam-classifier/blob/master/karma.conf.js"
    click TestSetup "https://github.com/eyesun23/image-webcam-classifier/blob/master/src/test.ts"
    click TSConfigSpec "https://github.com/eyesun23/image-webcam-classifier/blob/master/tsconfig.spec.json"

    %% Styles
    classDef ui fill:#E0F7FA,stroke:#006064,color:#006064;
    classDef ml fill:#E8F5E9,stroke:#2E7D32,color:#2E7D32;
    classDef external fill:#FFF3E0,stroke:#EF6C00,color:#EF6C00;
```
