# quic/ai-hub-apps architecture

> Architecture diagram of the GitHub repository quic/ai-hub-apps, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/quic/ai-hub-apps
- Repository: https://github.com/quic/ai-hub-apps

## Overview

##### Main Components

a. Platform Layer
- Android Apps Container
- Windows Apps Container
- Tutorials Container

b. Runtime Layer
- TensorFlow Lite Runtime
- ONNX Runtime
- Genie SDK (with AI Engine Direct SDK)

c. Hardware Acceleration Layer
- CPU Support
- GPU Support
- NPU Support (Hexagon HTP)

d. Application Categories
- Chat/LLM Applications
- Computer Vision Applications
- Speech Processing Applications

**┌─ Applications Layer ─────────────────────────────────────┐**
- Android Apps         Windows Apps         Tutorials     │
- ChatApp           - ChatApp            - LLM Deploy  │
- ImageClass        - Classification      - ONNX Deploy │
- SegmentationApp   - ObjectDetection                  │
- SuperResolution   - SuperResolution                  │
- WhisperKit       - Whisper                          │
- ┬──────────────────────────────────┘
- ↓
**┌─ Runtime Layer ──────────────────────────────────────────┐**

- TensorFlow Lite  ←→  ONNX Runtime  ←→  Genie SDK      │

- ┬──────────────────────────────────┘
- ↓
**┌─ Hardware Acceleration Layer ────────────────────────────┐**

- CPU     ←→      GPU      ←→     NPU (HTP)          │

- ┘

##### Important Relationships

- Dependencies between shared components (like tflite_helpers)
- Hardware acceleration paths for each runtime
- Model configurations to their respective applications

##### Additional Elements

- Version/compatibility information for supported Snapdragon chipsets
- Data flow paths for each application type
- Supported API versions and OS requirements

##### Implementation Details

- Use standardized UML notation for components
- Clear labels for each major system
- Notes for specific hardware requirements
- Configuration paths for different deployment scenarios

##### Optimization Paths

- NPU acceleration paths for supported models
- Fallback paths for non-Snapdragon devices
- Different quantization options (FP16, INT8)

This system design should help developers understand how the different components interact and how to best utilize the framework for their specific needs.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles and classes
    classDef android fill:#3498db,color:white
    classDef windows fill:#2ecc71,color:white
    classDef tutorial fill:#e67e22,color:white
    classDef runtime fill:#f1c40f,color:black
    classDef hardware fill:#9b59b6,color:white
    classDef shared fill:#e74c3c,color:white

    %% Applications Layer
    subgraph Apps["Applications Layer"]
        direction TB
        
        subgraph Android["Android Applications"]
            direction TB
            AChatApp["Chat App"]:::android
            AImageClass["Image Classification"]:::android
            ASegment["Segmentation"]:::android
            ASuperRes["Super Resolution"]:::android
            AWhisper["WhisperKit"]:::android
        end

        subgraph Windows["Windows Applications"]
            direction TB
            WChatApp["Chat App"]:::windows
            WClass["Classification"]:::windows
            WObjDet["Object Detection"]:::windows
            WSuperRes["Super Resolution"]:::windows
            WWhisper["Whisper"]:::windows
        end

        subgraph Tutorials["Tutorials"]
            direction TB
            TLLM["LLM Deploy"]:::tutorial
            TONNX["ONNX Deploy"]:::tutorial
        end
    end

    %% Runtime Layer
    subgraph Runtime["Runtime Layer"]
        direction TB
        TFLite["TensorFlow Lite"]:::runtime
        ONNX["ONNX Runtime"]:::runtime
        Genie["Genie SDK"]:::runtime
    end

    %% Hardware Layer
    subgraph Hardware["Hardware Acceleration Layer"]
        direction TB
        CPU["CPU"]:::hardware
        GPU["GPU"]:::hardware
        NPU["NPU (HTP)"]:::hardware
    end

    %% Shared Components
    TFHelpers["TFLite Helpers"]:::shared
    ImgHelpers["Image Processing Utilities"]:::shared
    GenieConfig["Genie SDK Configs"]:::shared
    HTPConfig["HTP Configs"]:::shared

    %% Relationships
    Apps --> Runtime
    Runtime --> Hardware
    TFHelpers --> Runtime
    ImgHelpers --> Apps
    GenieConfig --> Genie
    HTPConfig --> NPU

    %% Click Events
    click Android "https://github.com/quic/ai-hub-apps/tree/main/apps/android/"
    click Windows "https://github.com/quic/ai-hub-apps/tree/main/apps/windows/"
    click Tutorials "https://github.com/quic/ai-hub-apps/tree/main/tutorials/"
    
    click AChatApp "https://github.com/quic/ai-hub-apps/tree/main/apps/android/ChatApp/"
    click WChatApp "https://github.com/quic/ai-hub-apps/tree/main/apps/windows/cpp/ChatApp/"
    
    click AImageClass "https://github.com/quic/ai-hub-apps/tree/main/apps/android/ImageClassification/"
    click ASegment "https://github.com/quic/ai-hub-apps/tree/main/apps/android/SemanticSegmentation/"
    click WClass "https://github.com/quic/ai-hub-apps/tree/main/apps/windows/cpp/Classification/"
    click WObjDet "https://github.com/quic/ai-hub-apps/tree/main/apps/windows/cpp/ObjectDetection/"
    
    click ASuperRes "https://github.com/quic/ai-hub-apps/tree/main/apps/android/SuperResolution/"
    click WSuperRes "https://github.com/quic/ai-hub-apps/tree/main/apps/windows/cpp/SuperResolution/"
    
    click AWhisper "https://github.com/quic/ai-hub-apps/tree/main/apps/android/WhisperKit/"
    click WWhisper "https://github.com/quic/ai-hub-apps/tree/main/apps/windows/python/Whisper/"
    
    click TFHelpers "https://github.com/quic/ai-hub-apps/tree/main/apps/android/tflite_helpers/"
    click ImgHelpers "https://github.com/quic/ai-hub-apps/tree/main/apps/android/image_preprocessing_helpers/"
    
    click GenieConfig "https://github.com/quic/ai-hub-apps/tree/main/apps/android/ChatApp/src/main/assets/htp_config/"
    click HTPConfig "https://github.com/quic/ai-hub-apps/tree/main/apps/android/ChatApp/src/main/assets/htp_config/"
```
