|
Download README.md from Djanghao/Widget2Code-Data-V4: direct link, hf CLI and curl.
- Browser
- Download file 5.52 kB
-
https://huggingface.co/datasets/Djanghao/Widget2Code-Data-V4/resolve/main/README.md
- Command line
-
hf download hf://datasets/Djanghao/Widget2Code-Data-V4/README.md
-
curl -L -o README.md https://huggingface.co/datasets/Djanghao/Widget2Code-Data-V4/resolve/main/README.md
5.52 kB
| license: bsl-1.0 | |
| pretty_name: Widget2Code Data V4.1 | |
| task_categories: | |
| - image-to-text | |
| tags: | |
| - screenshot-to-code | |
| - react | |
| - jsx | |
| - multimodal | |
| # Widget2Code Data V4.1 | |
| Widget2Code Data V4.1 contains UI screenshots for training and evaluation, plus | |
| renderable JSX reference examples. Prompt-ready image information and reusable | |
| ground-truth evaluation features are stored directly in each screenshot's | |
| `metadata.json`. | |
| V4.1 is a backward-compatible label-quality patch. It keeps the `train/`, `test/`, and | |
| `sft-v4/` paths stable, while repairing six train references that omitted or miscolored a major | |
| background. Git tag `v4.0.0` preserves the pre-patch dataset and `v4.1.0` identifies this release; | |
| consumers should pin one of those tags or an exact commit rather than a moving branch. | |
| ## Dataset layout | |
| | directory | samples | contents | | |
| | --- | ---: | --- | | |
| | `train/` | 1,822 | training screenshots and canonical metadata | | |
| | `test/` | 1,000 | evaluation screenshots and canonical metadata | | |
| | `sft-v4/train/` | 1,822 | JSX references and their renders, linked to `train/` | | |
| | `sft-v4/test/` | 1,000 | JSX references and their renders, linked to `test/` | | |
| The canonical screenshot pools use this two-file layout: | |
| ```text | |
| train/image_0004/ | |
| test/image_0001/ | |
| ├── image.png | |
| └── metadata.json | |
| ``` | |
| The SFT reference pools do not duplicate the target screenshots: | |
| ```text | |
| sft-v4/train/image_0004/ | |
| sft-v4/test/image_0001/ | |
| ├── code.jsx | |
| ├── rendered.png | |
| └── metadata.json | |
| ``` | |
| An SFT sample's `metadata.json` contains `source_split: train` or | |
| `source_split: test`. Combine that split with the same sample ID to locate its | |
| target screenshot. `rendered.png` is the output of `code.jsx`; it is not the | |
| target image. The test references are generated examples, not ground-truth | |
| evaluation labels, and normal evaluation reads only `test/`. | |
| ## Screenshot metadata | |
| Each `train/` and `test/` metadata file has this shape: | |
| ```jsonc | |
| { | |
| "id": "image_0004", | |
| "split": "train", | |
| "sha256": "...", // SHA-256 of image.png | |
| "category": "tools", // null when not labelled | |
| "has_chart": null, // null when not labelled | |
| "eval": { | |
| "layout": { "margin": [], "mask_empty": false, "bbox_ar": 0.0, "area_ratio": 0.0, "n_comp": 0 }, | |
| "legibility": { "text": "...", "contrast": 0.0, "contrast_local": 0.0 }, | |
| "style": { "hue_hist": [], "sat_hist": [], "polarity": [] }, | |
| "fill": { "black": {}, "white": {} } | |
| }, | |
| "side_info": { | |
| "dims": [976, 668], | |
| "ocr": "- `\"Pesquisar\"` at (16.5%, 10.0%) of widget, font-height ≈ 7.2% of widget height", | |
| "palette": "Target widget palette (top-4, after AA-fringe consolidation):\n #353A38 64.63%\n ..." | |
| } | |
| } | |
| ``` | |
| `side_info` is the complete prompt-ready representation derived from | |
| `image.png`: exact `[width, height]`, formatted OCR output, and the formatted | |
| dominant palette. Consumers should read these values directly; there are no | |
| `dims.txt`, `ocr.txt`, or `palette.txt` sidecars. | |
| `eval` caches the features that depend only on the ground-truth screenshot: | |
| geometry/layout, OCR text and contrast, color/style, and missing-prediction fill | |
| scores. A benchmark run can reuse these values for every prediction instead of | |
| recomputing the ground-truth side. Pairwise metrics such as SSIM and LPIPS still | |
| require the prediction image. | |
| ## SFT metadata | |
| Each `sft-v4` metadata file identifies the canonical target and records | |
| generation provenance: | |
| ```jsonc | |
| { | |
| "source_split": "train", | |
| "generation": { | |
| "model": "gemini-3.1-pro-preview", | |
| "variant": "policy-repaired", | |
| "code_sha256": "...", | |
| "render_ok": true, | |
| "rendered_sha256": "..." | |
| } | |
| } | |
| ``` | |
| Additional prompt, renderer, and validation fields are retained where they were | |
| recorded. The six V4.1 repairs use `variant: policy-repaired-v4.1` and add | |
| `repair_revision: v4.1.0` plus `repair_reason: restore-major-background`. All 2,822 references | |
| have a successful render. | |
| Every `rendered.png` is the output of `houstonzhang/w2c-render:1.3.1` under the | |
| `m2` contract, and `rendered_sha256` is its checksum. That renderer draws the | |
| same source the same way twice, which earlier ones did not: Chromium reused a | |
| tile from a previous frame, so about one chart render in two hundred came back | |
| a different picture, and a chart that did not disable its own animation was | |
| screenshotted at whichever frame the clock allowed. Re-rendering the references | |
| is therefore a check, not a coin flip: | |
| ```bash | |
| W2C_RENDER_MODE=m2 docker/run.sh 16 # from the widget2code-render checkout | |
| python scripts/verify_references.py --split sft-v4/train | |
| ``` | |
| ## Rebuilding prompt side information | |
| The canonical metadata was prepared with the Widget2Code benchmark 1.2.0 CPU | |
| container. On the 96-vCPU reference host, 64 workers was the measured best | |
| setting: | |
| ```bash | |
| for split in train test; do | |
| docker run --rm --user "$(id -u):$(id -g)" -e HOME=/tmp \ | |
| -v "$PWD/$split:/data" \ | |
| houstonzhang/w2c-bench:1.2.0 widget2code-sideinfo \ | |
| /data --out /data --workers 64 --force | |
| done | |
| ``` | |
| CPU output is canonical. GPU OCR follows a different numeric path and is not | |
| guaranteed to produce byte-identical OCR text. | |
| ## Download | |
| ```python | |
| from huggingface_hub import snapshot_download | |
| snapshot_download( | |
| repo_id="Djanghao/Widget2Code-Data-V4", | |
| repo_type="dataset", | |
| revision="v4.1.0", | |
| local_dir="Widget2Code-Data-V4", | |
| ) | |
| ``` | |
| Files are stored raw and per sample. Training code can assemble its preferred | |
| record format after download. | |