# nateraw/huggingpics architecture

> Architecture diagram of the GitHub repository nateraw/huggingpics, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/nateraw/huggingpics
- Repository: https://github.com/nateraw/huggingpics

## Overview

HuggingPics is a notebook-driven tool for turning web image searches into fine-tuned Vision Transformer classifiers shared on Hugging Face Hub. Its runtime data module searches for and downloads images, builds labeled datasets, and prepares training and validation batches; the Lightning classifier supplies training and validation behavior. The README documents the notebook, fine-tuning, and Hub publishing workflow. Notebook internals and model-upload code were not sampled, so those orchestration links are shown as unverified rather than asserted as source-level calls.

Main entry points: [`HuggingPics.ipynb`](https://github.com/nateraw/huggingpics/blob/main/HuggingPics.ipynb) (Workflow notebook), [`huggingpics/data.py`](https://github.com/nateraw/huggingpics/blob/main/huggingpics/data.py) (Image data module), [`huggingpics/classifier.py`](https://github.com/nateraw/huggingpics/blob/main/huggingpics/classifier.py) (Lightning classifier)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["Notebook workflow"]
  node_notebook["Workflow notebook<br/>[HuggingPics.ipynb]"]
end

subgraph group_images["Image data"]
  node_image_data["Image data module<br/>[data.py]"]
  node_search_api{{"Image search API"}}
  node_image_hosts{{"Image hosts"}}
  node_image_folder[("Labeled image folder<br/>[data.py]")]
  node_batching["Data loaders<br/>[data.py]"]
end

subgraph group_training["Model training"]
  node_pretrained_vit{{"Pretrained ViT"}}
  node_classifier["Lightning classifier<br/>[classifier.py]"]
  node_trainer["Fine-tuning"]
end

subgraph group_sharing["Model sharing"]
  node_hub{{"Hugging Face Hub"}}
end

node_user(("User"))

node_user -->|"opens"| node_notebook
node_notebook -.->|"configures data"| node_image_data
node_image_data -->|"searches terms"| node_search_api
node_image_data -->|"downloads images"| node_image_hosts
node_image_data -->|"builds dataset"| node_image_folder
node_image_data -->|"loads extractor"| node_pretrained_vit
node_image_data -->|"provides batches"| node_batching
node_notebook -.->|"fine-tunes"| node_pretrained_vit
node_notebook -.->|"uses classifier"| node_classifier
node_notebook -.->|"runs training"| node_trainer
node_batching -.->|"supplies batches"| node_trainer
node_classifier -.->|"provides training steps"| node_trainer
node_trainer -.->|"publishes model"| node_hub
node_notebook -.->|"shares results"| node_hub

click node_notebook "https://github.com/nateraw/huggingpics/blob/main/HuggingPics.ipynb"
click node_image_data "https://github.com/nateraw/huggingpics/blob/main/huggingpics/data.py"
click node_image_folder "https://github.com/nateraw/huggingpics/blob/main/huggingpics/data.py"
click node_batching "https://github.com/nateraw/huggingpics/blob/main/huggingpics/data.py"
click node_classifier "https://github.com/nateraw/huggingpics/blob/main/huggingpics/classifier.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_notebook,node_user toneBlue
class node_image_data,node_search_api,node_image_hosts,node_image_folder,node_batching toneAmber
class node_pretrained_vit,node_classifier,node_trainer toneMint
class node_hub toneRose
```

## Components

### Notebook workflow

- [Workflow notebook](https://github.com/nateraw/huggingpics/blob/main/HuggingPics.ipynb): `HuggingPics.ipynb`

### Image data

- [Image data module](https://github.com/nateraw/huggingpics/blob/main/huggingpics/data.py): `huggingpics/data.py`
- **Image search API**
- **Image hosts**
- [Labeled image folder](https://github.com/nateraw/huggingpics/blob/main/huggingpics/data.py): `huggingpics/data.py`
- [Data loaders](https://github.com/nateraw/huggingpics/blob/main/huggingpics/data.py): `huggingpics/data.py`

### Model training

- **Pretrained ViT**
- [Lightning classifier](https://github.com/nateraw/huggingpics/blob/main/huggingpics/classifier.py): `huggingpics/classifier.py`
- **Fine-tuning**

### Model sharing

- **Hugging Face Hub**

### Other components

- **User**

## Connections

- User → Workflow notebook: opens (evidence: `README.md`)
- Workflow notebook → Image data module: configures data
- Image data module → Image search API: searches terms (evidence: `huggingpics/data.py`)
- Image data module → Image hosts: downloads images (evidence: `huggingpics/data.py`)
- Image data module → Labeled image folder: builds dataset (evidence: `huggingpics/data.py`)
- Image data module → Pretrained ViT: loads extractor (evidence: `huggingpics/data.py`)
- Image data module → Data loaders: provides batches (evidence: `huggingpics/data.py`)
- Workflow notebook → Pretrained ViT: fine-tunes
- Workflow notebook → Lightning classifier: uses classifier
- Workflow notebook → Fine-tuning: runs training
- Data loaders → Fine-tuning: supplies batches
- Lightning classifier → Fine-tuning: provides training steps
- Fine-tuning → Hugging Face Hub: publishes model
- Workflow notebook → Hugging Face Hub: shares results
