# fancyfoot/smolvlm-realtime-webcam architecture

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

- Interactive diagram: https://gitdiagram.com/fancyfoot/smolvlm-realtime-webcam
- Repository: https://github.com/fancyfoot/smolvlm-realtime-webcam

## Overview

##### Project type and purpose
- This is a lightweight web-based demo that shows how to do real-time object detection in the browser using a remote LLM inference server (llama.cpp running SmolVLM-500M).
- It is essentially a single-page frontend (index.html) that captures your camera feed, sends frames to a standalone ML inference server, and displays the results.

##### File structure
- Top level only contains:
- LICENSE
- README.md
- index.html
- There is no backend source code in this repo – the inference server is an external process you install and run separately (llama.cpp).
- All application logic lives in index.html (JavaScript + HTML).

##### README for additional insights
- You must install llama.cpp, start it with the SmolVLM-500M model, then open index.html in a browser.
- The demo uses getUserMedia for camera input, sends each frame (or captured image) via HTTP to the llama-server, and renders detected objects live.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Repository Files"
        README["README.md"]:::doc
        LICENSE["LICENSE"]:::doc
    end

    subgraph "Client Side"
        Camera["User Camera (getUserMedia)"]:::infrastructure
        Browser["Browser UI<br/>(index.html + JS)"]:::frontend
    end

    Network["Network / HTTP"]:::network

    subgraph "Inference Backend"
        Server["llama.cpp Inference Server"]:::server
        Model["SmolVLM-500M Model"]:::server
        Hardware["GPU/CPU Hardware"]:::infrastructure
    end

    Camera -->|"capture frame"| Browser
    Browser -->|"POST /frame"| Network
    Network -->|"HTTP request"| Server
    Server -->|"load model"| Model
    Model -->|"run inference"| Server
    Server -->|"JSON response"| Network
    Network -->|"HTTP response"| Browser
    Browser -->|"render overlay"| Browser

    click Browser "https://github.com/fancyfoot/smolvlm-realtime-webcam/blob/main/index.html"
    click README "https://github.com/fancyfoot/smolvlm-realtime-webcam/blob/main/README.md"
    click LICENSE "https://github.com/fancyfoot/smolvlm-realtime-webcam/tree/main/LICENSE"

    classDef frontend fill:#ccffcc,stroke:#333,stroke-width:1px
    classDef server fill:#ccf,stroke:#333,stroke-width:1px
    classDef infrastructure fill:#eee,stroke:#333,stroke-width:1px
    classDef network fill:#ddd,stroke:#333,stroke-width:1px
    classDef doc fill:#ffffcc,stroke:#333,stroke-width:1px
```
