# apple/pico-banana-400k architecture

> Architecture diagram of the GitHub repository apple/pico-banana-400k, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-11-08). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/apple/pico-banana-400k
- Repository: https://github.com/apple/pico-banana-400k

## Overview

##### Project type and purpose
- Type: This is an open-source dataset repository (“Pico-Banana-400K”) for text-guided image editing.
- Purpose: Provide ~400K text–image–edit triplets plus associated manifests and a small helper script to map Open Images URLs to local files.

##### File structure
- Top-level files only; no nested code modules or services.
- LICENSE_DATA, CODE_OF_CONDUCT.md, CONTRIBUTING.md, README.md – documentation.
- map_openimage_url_to_local.py – a single Python script for URL→local path mapping.
- No “frontend” or “backend” directories; this is a data-centric repository with one utility script.

##### README for additional insights
- Two-stage pipeline:
b) Editing + Self-Evaluation (Nano-Banana for edits; Gemini-2.5-Pro for quality scoring)
- Data staging: Open Images tar files are downloaded from AWS S3, unpacked, and mapped via the script.
- Distribution: Final dataset manifests and JSONL files published on Apple’s public CDN.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "External Systems"
        S3["AWS S3 (Open Images)"]:::external
        CDN["Apple Public CDN"]:::external
    end

    S3 -->|"tar.gz files & metadata"| Download["Download & Extract\n(tar → openimage_source_images)"]:::stage
    Download -->|"images folder"| LocalScript["map_openimage_url_to_local.py"]:::utility
    LocalScript -->|"local image paths"| InstrGenSource["Source Images"]:::stage

    subgraph "Instruction Generation"
        Instr1["Gemini-2.5-Flash"]:::stage
        Instr2["Qwen-2.5-Instruct-7B"]:::stage
    end

    InstrGenSource --> Instr1
    InstrGenSource --> Instr2
    Instr1 -->|"instructions"| CombinedInstr["Combined Instructions"]:::stage
    Instr2 --> CombinedInstr

    CombinedInstr -->|"instructions + source images"| Editing["Nano-Banana Model"]:::stage
    Editing -->|"edited images"| Eval["Self-Evaluation\n(Gemini-2.5-Pro)"]:::stage

    Eval -->|"pass cases"| Assembly["Dataset Assembly & Manifests"]:::stage
    Eval -->|"fail cases"| Discard["Discards / Review"]:::stage

    Assembly -->|"JSONL manifests"| CDN

    subgraph "Project Documentation"
        README["README.md"]:::utility
        CONTRIBUTING["CONTRIBUTING.md"]:::utility
        CODE_OF_CONDUCT["CODE_OF_CONDUCT.md"]:::utility
        LICENSE_DATA["LICENSE_DATA"]:::utility
    end

    click LocalScript "https://github.com/apple/pico-banana-400k/blob/main/map_openimage_url_to_local.py"
    click README "https://github.com/apple/pico-banana-400k/blob/main/README.md"
    click CONTRIBUTING "https://github.com/apple/pico-banana-400k/blob/main/CONTRIBUTING.md"
    click CODE_OF_CONDUCT "https://github.com/apple/pico-banana-400k/blob/main/CODE_OF_CONDUCT.md"
    click LICENSE_DATA "https://github.com/apple/pico-banana-400k/tree/main/LICENSE_DATA"

    classDef external fill:#fde68a,stroke:#f59e0b,stroke-width:2px
    classDef stage fill:#bfdbfe,stroke:#3b82f6,stroke-width:2px
    classDef utility fill:#d1fae5,stroke:#10b981,stroke-width:2px
```
