Skip to content

Commit e41152b

Browse files
committed
v1.0.0
1 parent f0678ea commit e41152b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+9393
-4529
lines changed

.github/workflows/build.yml

Lines changed: 0 additions & 57 deletions
This file was deleted.

.github/workflows/ci.yml

Lines changed: 0 additions & 45 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
build-windows:
13+
runs-on: windows-latest
14+
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v4
18+
19+
- name: Setup Node.js
20+
uses: actions/setup-node@v4
21+
with:
22+
node-version: "22"
23+
cache: "npm"
24+
25+
- name: Setup Python
26+
uses: actions/setup-python@v4
27+
with:
28+
python-version: "3.12"
29+
30+
- name: Install uv
31+
uses: astral-sh/setup-uv@v4
32+
with:
33+
enable-cache: true
34+
35+
- name: Install frontend dependencies
36+
run: npm ci
37+
38+
- name: Install backend dependencies
39+
run: |
40+
cd backend
41+
uv sync
42+
shell: pwsh
43+
44+
- name: Get version
45+
id: get_version
46+
run: |
47+
$version = (Get-Content package.json | ConvertFrom-Json).version
48+
echo "version=$version" >> $env:GITHUB_OUTPUT
49+
shell: pwsh
50+
51+
- name: Lint
52+
run: npm run lint
53+
54+
- name: Build and package
55+
run: npm run make
56+
57+
- name: Zip installer folder
58+
run: |
59+
Compress-Archive -Path "out/make/squirrel.windows/x64/*" -DestinationPath "out/TrainKit-Windows-Installer.zip"
60+
shell: pwsh
61+
62+
- name: Create Release
63+
uses: softprops/action-gh-release@v2
64+
with:
65+
tag_name: ${{ github.ref_name }}
66+
name: TrainKit ${{ github.ref_name }}
67+
draft: false
68+
prerelease: false
69+
files: |
70+
out/TrainKit-Windows-Installer.zip
71+
out/make/zip/win32/x64/TrainKit-win32-x64-${{ steps.get_version.outputs.version }}.zip
72+
body: |
73+
## TrainKit ${{ github.ref_name }}
74+
75+
### Downloads
76+
- **TrainKit-Windows-Installer.zip** - Windows installer (extract, run Setup.exe)
77+
- **TrainKit-win32-x64-${{ steps.get_version.outputs.version }}.zip** - Portable version (extract, run TrainKit.exe)
78+
79+
### Requirements
80+
- [uv](https://docs.astral.sh/uv/) must be installed for first-time setup
81+
- Python 3.12 will be automatically downloaded during setup

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ downloads/
113113
eggs/
114114
.eggs/
115115
lib/
116+
!/src/lib/
116117
lib64/
117118
parts/
118119
sdist/

README.md

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
<p align="center">
2+
<img src="https://i.ibb.co/SXZsB2fk/icon.png" alt="TrainKit Logo">
3+
</p>
4+
5+
<h1 align="center">TrainKit</h1>
6+
7+
<p align="center">
8+
A dataset preparation toolkit for AI image training
9+
</p>
10+
11+
<p align="center">
12+
<a href="https://github.com/LightCyan01/TrainKit/blob/master/LICENSE">
13+
<img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="License">
14+
</a>
15+
<a href="https://github.com/LightCyan01/TrainKit/releases">
16+
<img src="https://img.shields.io/github/v/release/LightCyan01/TrainKit?include_prereleases" alt="Release">
17+
</a>
18+
<img src="https://img.shields.io/badge/platform-Windows-lightgrey" alt="Platform">
19+
<img src="https://img.shields.io/badge/Electron-39-47848F?logo=electron" alt="Electron">
20+
<img src="https://img.shields.io/badge/Python-3.12-3776AB?logo=python&logoColor=white" alt="Python">
21+
<img src="https://img.shields.io/badge/PyTorch-2.7-EE4C2C?logo=pytorch&logoColor=white" alt="PyTorch">
22+
</p>
23+
24+
---
25+
26+
## About
27+
28+
TrainKit streamlines the tedious process of preparing image datasets for AI model training.
29+
It provides GPU-accelerated tools for captioning, upscaling, and organizing your images wrapped in a modern desktop interface.
30+
31+
## Features
32+
33+
- **🖼️ Image Captioning** — Generate captions using local LLaVA-based models (e.g., JoyCaption) with customizable prompts
34+
- **⬆️ Image Upscaling** — Upscale images using [Spandrel](https://github.com/chaiNNer-org/spandrel) supported architectures
35+
- **📁 Batch Renaming** — Rename and organize image files with flexible naming patterns.
36+
37+
## Requirements
38+
39+
- **Windows 10/11**
40+
- **NVIDIA GPU** (8GB+ VRAM recommended for captioning)
41+
- **Python 3.12**
42+
- **Node.js 18+**
43+
44+
## Installation
45+
46+
### From Release
47+
48+
Download the latest release from the [Releases](https://github.com/LightCyan01/TrainKit/releases) page.
49+
50+
### From Source
51+
52+
```bash
53+
# Clone the repository
54+
git clone https://github.com/LightCyan01/TrainKit.git
55+
cd TrainKit
56+
57+
# Install frontend dependencies
58+
npm install
59+
60+
# Install backend dependencies
61+
cd backend
62+
uv sync
63+
64+
# Start the app
65+
npm start
66+
```
67+
68+
## Usage
69+
70+
1. **Launch TrainKit** — The backend server starts automatically
71+
2. **Select a panel** — Choose Caption, Upscale, or Rename from the sidebar
72+
3. **Configure paths** — Set your input folder, output folder, and model path
73+
4. **Start processing** — Click the action button and monitor progress in the logs panel
74+
75+
### Captioning
76+
77+
TrainKit supports LLaVA-based captioning models.
78+
79+
### Upscaling
80+
81+
TrainKit uses [Spandrel](https://github.com/chaiNNer-org/spandrel) for upscaling. See the [full list of supported architectures](https://github.com/chaiNNer-org/spandrel?tab=readme-ov-file#model-architecture-support).
82+
83+
## Development
84+
85+
```bash
86+
# Start in development mode
87+
npm start
88+
89+
# Build for production
90+
npm run make
91+
```
92+
93+
## Roadmap
94+
95+
- [ ] NCNN support
96+
- [ ] Additional captioning model architectures
97+
- [ ] Image tagging
98+
99+
## Contributing
100+
101+
Contributions are welcome! Please open an issue first to discuss what you would like to change.
102+
103+
## License
104+
105+
TrainKit is licensed under the MIT license. See the [LICENSE](LICENSE) file for details.

backend/.python-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.10
1+
3.12

backend/.setup_complete

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2026-01-26T09:17:17.575Z

backend/config/image_formats.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
from typing import Dict, Set, List
22

33
SUPPORTED_INPUT_EXTENSIONS: Set[str] = {
4-
'.png', '.jpg', '.bmp', '.tiff', '.webp'
4+
'.png', '.jpg', '.jpeg', '.bmp', '.webp'
55
}
66

77
SUPPORTED_OUTPUT_FORMATS: Dict[str, Dict[str, str]] = {
88
"jpg": {"name": "JPEG", "extension": ".jpg", "pil_format": "JPEG"},
99
"png": {"name": "PNG", "extension": ".png", "pil_format": "PNG"},
1010
"bmp": {"name": "Bitmap", "extension": ".bmp", "pil_format": "BMP"},
11-
"tiff": {"name": "TIFF", "extension": ".tiff", "pil_format": "TIFF"},
1211
"webp": {"name": "WebP", "extension": ".webp", "pil_format": "WEBP"}
1312
}
1413

1514
def get_supported_format() -> List[Dict[str, str]]:
1615
return [
17-
{"value": key, "label":info["name"], "extension": info["extension"]}
16+
{"value": key, "label": info["name"], "extension": info["extension"]}
1817
for key, info in SUPPORTED_OUTPUT_FORMATS.items()
1918
]

backend/core/__init__.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
from .websocket import ConnectionManager
2+
from .dependencies import get_connection_manager, get_service_manager, get_rename_service
3+
from .exceptions import (
4+
TrainKitException,
5+
ModelLoadError,
6+
ProcessingError,
7+
InvalidPathError,
8+
trainkit_exception_handler,
9+
)
10+
11+
__all__ = [
12+
"ConnectionManager",
13+
"get_connection_manager",
14+
"get_service_manager",
15+
"get_rename_service",
16+
"TrainKitException",
17+
"ModelLoadError",
18+
"ProcessingError",
19+
"InvalidPathError",
20+
"trainkit_exception_handler",
21+
]

backend/core/dependencies.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
from .websocket import ConnectionManager
2+
from service.service_manager import ServiceManager
3+
from service.image_rename import RenameService
4+
5+
def get_connection_manager() -> ConnectionManager:
6+
return ConnectionManager.get_instance()
7+
8+
def get_service_manager() -> ServiceManager:
9+
return ServiceManager.get_instance()
10+
11+
def get_rename_service() -> RenameService:
12+
return RenameService()
13+
14+
# future ncnn integration point:
15+
# def get_upscale_backend(backend: str = "pytorch"):
16+
# if backend == "ncnn":
17+
# from service.ncnn_upscale import NCNNUpscaleService
18+
# return NCNNUpscaleService.get_instance()
19+
# return get_service_manager()

0 commit comments

Comments
 (0)