termux-diffusion 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- termux_diffusion-1.0.0/LICENSE +21 -0
- termux_diffusion-1.0.0/PKG-INFO +199 -0
- termux_diffusion-1.0.0/README.md +168 -0
- termux_diffusion-1.0.0/pyproject.toml +54 -0
- termux_diffusion-1.0.0/setup.cfg +4 -0
- termux_diffusion-1.0.0/setup.py +63 -0
- termux_diffusion-1.0.0/termux_diffusion/__init__.py +74 -0
- termux_diffusion-1.0.0/termux_diffusion/cli.py +112 -0
- termux_diffusion-1.0.0/termux_diffusion/core.py +240 -0
- termux_diffusion-1.0.0/termux_diffusion/exceptions.py +35 -0
- termux_diffusion-1.0.0/termux_diffusion/hub.py +332 -0
- termux_diffusion-1.0.0/termux_diffusion/installer.py +206 -0
- termux_diffusion-1.0.0/termux_diffusion/platform.py +220 -0
- termux_diffusion-1.0.0/termux_diffusion/py.typed +1 -0
- termux_diffusion-1.0.0/termux_diffusion.egg-info/PKG-INFO +199 -0
- termux_diffusion-1.0.0/termux_diffusion.egg-info/SOURCES.txt +21 -0
- termux_diffusion-1.0.0/termux_diffusion.egg-info/dependency_links.txt +1 -0
- termux_diffusion-1.0.0/termux_diffusion.egg-info/entry_points.txt +4 -0
- termux_diffusion-1.0.0/termux_diffusion.egg-info/top_level.txt +1 -0
- termux_diffusion-1.0.0/tests/test_core.py +27 -0
- termux_diffusion-1.0.0/tests/test_hub.py +80 -0
- termux_diffusion-1.0.0/tests/test_installer.py +30 -0
- termux_diffusion-1.0.0/tests/test_platform.py +51 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 uno-km (쌩초보코딩단)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: termux-diffusion
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Production On-Device AI Image Generation Framework for Android Termux & Samsung Galaxy (Dual-Engine Python & Node.js)
|
|
5
|
+
Home-page: https://github.com/uno-km/termux-diffusion
|
|
6
|
+
Author: uno-km (쌩초보코딩단)
|
|
7
|
+
Author-email: "uno-km (쌩초보코딩단)" <hosequelbo@gmail.com>
|
|
8
|
+
License: MIT
|
|
9
|
+
Project-URL: Homepage, https://github.com/uno-km/termux-diffusion
|
|
10
|
+
Project-URL: Documentation, https://uno-km.github.io/termux-diffusion/
|
|
11
|
+
Project-URL: npm Package, https://www.npmjs.com/package/termux-diffusion
|
|
12
|
+
Project-URL: Bug Tracker, https://github.com/uno-km/termux-diffusion/issues
|
|
13
|
+
Project-URL: Source, https://github.com/uno-km/termux-diffusion
|
|
14
|
+
Keywords: stable-diffusion,diffusion,termux,android,samsung-galaxy,edge-ai,on-device-ai,image-generation,gguf,arm64,bionic-libc,snapdragon,exynos,text-to-image,txt2img,mobile-ai,quantization,generative-ai,vulkan,opencl,offline-ai,private-ai,ai-art,comfyui-alternative,webui-alternative
|
|
15
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
16
|
+
Classifier: Intended Audience :: Developers
|
|
17
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
18
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
19
|
+
Classifier: Operating System :: Android
|
|
20
|
+
Classifier: Programming Language :: Python :: 3
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
25
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
26
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
27
|
+
Classifier: Topic :: Multimedia :: Graphics
|
|
28
|
+
Requires-Python: >=3.8
|
|
29
|
+
Description-Content-Type: text/markdown
|
|
30
|
+
License-File: LICENSE
|
|
31
|
+
|
|
32
|
+
# Termux-Diffusion
|
|
33
|
+
|
|
34
|
+
**Production On-Device AI Image Generation Framework for Android Termux & Samsung Galaxy**
|
|
35
|
+
*Dual-Engine Architecture (Python & Node.js / TypeScript) with Native Bionic ARM64 Tensor Acceleration*
|
|
36
|
+
|
|
37
|
+
[](https://pypi.org/project/termux-diffusion/)
|
|
38
|
+
[](https://www.npmjs.com/package/termux-diffusion)
|
|
39
|
+
[](https://pypi.org/project/termux-diffusion/)
|
|
40
|
+
[](https://www.npmjs.com/package/termux-diffusion)
|
|
41
|
+
[-green.svg)](https://github.com/uno-km/termux-diffusion)
|
|
42
|
+
[](LICENSE)
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## 1. System Overview
|
|
47
|
+
|
|
48
|
+
`termux-diffusion` is an enterprise-grade, on-device AI text-to-image synthesis pipeline designed specifically for Android Termux environments and Samsung Galaxy hardware.
|
|
49
|
+
|
|
50
|
+
Unlike desktop-centric WebUI ports that require heavy containerization (e.g., PRoot Linux / Ubuntu) or suffer from memory exhaustion under the Android Low Memory Killer (LMK), `termux-diffusion` executes directly against native Android Bionic `libc` with ARM64 NEON SIMD vectorization and GGML quantized tensor weights.
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## 2. Automated Bootstrap & Installation
|
|
55
|
+
|
|
56
|
+
### Option A: One-Line Zero-Touch Bootstrap (Recommended)
|
|
57
|
+
|
|
58
|
+
Run the platform bootstrap script in Termux to automatically verify toolchains, storage permissions, and native engine binaries:
|
|
59
|
+
|
|
60
|
+
#### Python Runtime
|
|
61
|
+
```bash
|
|
62
|
+
curl -sL https://raw.githubusercontent.com/uno-km/termux-diffusion/main/docs/install.sh | bash
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
#### Node.js / TypeScript Runtime
|
|
66
|
+
```bash
|
|
67
|
+
curl -sL https://raw.githubusercontent.com/uno-km/termux-diffusion/main/docs/install-node.sh | bash
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
### Option B: Package Manager Installation
|
|
73
|
+
|
|
74
|
+
#### Python (PyPI)
|
|
75
|
+
```bash
|
|
76
|
+
pip install termux-diffusion && termux-diffusion-install
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
#### Node.js (npm)
|
|
80
|
+
```bash
|
|
81
|
+
npm install -g termux-diffusion && npx termux-diffusion install
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
## 3. Core Architectural Capabilities
|
|
87
|
+
|
|
88
|
+
* **Zero-PRoot Native Bionic Execution:** Executes natively on ARM64 without container overhead, achieving maximum memory efficiency.
|
|
89
|
+
* **Integrated Model Hub:** Built-in streaming downloader with automatic checksum verification and cache persistence.
|
|
90
|
+
* **Power & WakeLock Management (`TermuxWakeLock`):** Automatically holds Android CPU WakeLock during inference, preventing kernel suspension when the screen turns off.
|
|
91
|
+
* **Low-Memory & LMK Guard:** Inspects physical memory and Android zRAM (Samsung RAM Plus) before allocating tensor weight buffers.
|
|
92
|
+
* **Samsung Gallery Integration:** Automatically persists generated outputs to `~/storage/pictures/TermuxDiffusion/` and triggers `android.intent.action.MEDIA_SCANNER_SCAN_FILE` for instant indexing in Samsung Gallery.
|
|
93
|
+
* **big.LITTLE Core Affinity Tuning:** Auto-detects Exynos (e.g., 1380, 1480, 2400) and Snapdragon cluster topologies to maintain high sustained clock rates without thermal throttling.
|
|
94
|
+
* **Hardware Compute Selection:** Explicit compute backend targeting via `device="cpu"` or `device="gpu"`.
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
## 4. Built-in Model Hub Presets
|
|
99
|
+
|
|
100
|
+
| Preset | Model & Quantization | Size | Latency Baseline (Exynos 1380) | Recommended Workload |
|
|
101
|
+
| :--- | :--- | :---: | :---: | :--- |
|
|
102
|
+
| **`"realistic"`** | Realistic Vision V6.0 B1 (Q4_K) | 1.62 GB | ~25 min (10 steps) | High-fidelity photorealism (portraits, skin textures, lighting) |
|
|
103
|
+
| **`"speed"`** | Stable Diffusion 1.5 Base (Q4_1) | 1.59 GB | ~15 min (10 steps) | General-purpose drafting and composition |
|
|
104
|
+
| **`"sdxs"`** | SDXS 512-0.9 Mobile (Q4_0) | **450 MB** | **~2.5 min (2 steps)** | Ultra-low latency mobile prototyping |
|
|
105
|
+
| **`"turbo"`** | SD Turbo (Q4_0) | 1.20 GB | ~4 min (1 step) | Single-step real-time inference |
|
|
106
|
+
| **`"anime"`** | DreamShaper 8 (Q4_K) | 1.65 GB | ~20 min (10 steps) | 2D / 2.5D stylized illustration and animation art |
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
## 5. Usage & Integration
|
|
111
|
+
|
|
112
|
+
### Python API
|
|
113
|
+
|
|
114
|
+
```python
|
|
115
|
+
from termux_diffusion import generate
|
|
116
|
+
|
|
117
|
+
result = generate(
|
|
118
|
+
prompt="RAW photo, portrait of a happy smiling young Korean man in his 30s wearing glasses and hoodie, working on laptop, photorealistic, cinematic",
|
|
119
|
+
model="realistic",
|
|
120
|
+
device="cpu",
|
|
121
|
+
steps=10,
|
|
122
|
+
cfg_scale=4.0,
|
|
123
|
+
output="developer.png"
|
|
124
|
+
)
|
|
125
|
+
|
|
126
|
+
print(f"Output Path: {result.path}")
|
|
127
|
+
print(f"Android MediaStore: {result.gallery_path}")
|
|
128
|
+
print(f"Elapsed Time: {result.elapsed_sec:.2f}s")
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### Node.js / TypeScript API
|
|
132
|
+
|
|
133
|
+
```javascript
|
|
134
|
+
const { generate } = require('termux-diffusion');
|
|
135
|
+
|
|
136
|
+
async function main() {
|
|
137
|
+
const result = await generate({
|
|
138
|
+
prompt: 'cyberpunk cat with neon collar in rainy alley, 8k, photorealistic',
|
|
139
|
+
model: 'speed',
|
|
140
|
+
device: 'cpu',
|
|
141
|
+
steps: 10,
|
|
142
|
+
output: 'cyber_cat.png'
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
console.log(`Output Path: ${result.path}`);
|
|
146
|
+
console.log(`Android MediaStore: ${result.galleryPath}`);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
main().catch(console.error);
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
---
|
|
153
|
+
|
|
154
|
+
## 6. Custom Models & Hugging Face Resolution
|
|
155
|
+
|
|
156
|
+
### 1. Direct Hugging Face Repository Identifier
|
|
157
|
+
Pass any repository ID and `.gguf` filename. The framework resolves, streams, caches, and executes the weights:
|
|
158
|
+
```python
|
|
159
|
+
generate(
|
|
160
|
+
"1girl, anime masterpiece, vibrant colors",
|
|
161
|
+
model="second-state/DreamShaper-8-GGUF/dreamshaper-8-Q4_k.gguf"
|
|
162
|
+
)
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
### 2. Local File Reference
|
|
166
|
+
```python
|
|
167
|
+
generate(
|
|
168
|
+
"fantasy landscape at sunrise",
|
|
169
|
+
model="~/storage/downloads/custom_model.gguf"
|
|
170
|
+
)
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
### 3. Alias Registration (`register_model`)
|
|
174
|
+
```python
|
|
175
|
+
from termux_diffusion import register_model, generate
|
|
176
|
+
|
|
177
|
+
register_model("waifu", repo_id="second-state/DreamShaper-8-GGUF", filename="dreamshaper-8-Q4_k.gguf")
|
|
178
|
+
generate("anime portrait", model="waifu")
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
---
|
|
182
|
+
|
|
183
|
+
## 7. Pre-flight Diagnostic Tool
|
|
184
|
+
|
|
185
|
+
Verify system packages, architecture, available memory, and native engine status:
|
|
186
|
+
|
|
187
|
+
```bash
|
|
188
|
+
# Python
|
|
189
|
+
termux-diffusion-doctor
|
|
190
|
+
|
|
191
|
+
# Node.js
|
|
192
|
+
npx termux-diffusion doctor
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
---
|
|
196
|
+
|
|
197
|
+
## 8. License
|
|
198
|
+
|
|
199
|
+
Released under the **MIT License**. Maintained by **uno-km**.
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
# Termux-Diffusion
|
|
2
|
+
|
|
3
|
+
**Production On-Device AI Image Generation Framework for Android Termux & Samsung Galaxy**
|
|
4
|
+
*Dual-Engine Architecture (Python & Node.js / TypeScript) with Native Bionic ARM64 Tensor Acceleration*
|
|
5
|
+
|
|
6
|
+
[](https://pypi.org/project/termux-diffusion/)
|
|
7
|
+
[](https://www.npmjs.com/package/termux-diffusion)
|
|
8
|
+
[](https://pypi.org/project/termux-diffusion/)
|
|
9
|
+
[](https://www.npmjs.com/package/termux-diffusion)
|
|
10
|
+
[-green.svg)](https://github.com/uno-km/termux-diffusion)
|
|
11
|
+
[](LICENSE)
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## 1. System Overview
|
|
16
|
+
|
|
17
|
+
`termux-diffusion` is an enterprise-grade, on-device AI text-to-image synthesis pipeline designed specifically for Android Termux environments and Samsung Galaxy hardware.
|
|
18
|
+
|
|
19
|
+
Unlike desktop-centric WebUI ports that require heavy containerization (e.g., PRoot Linux / Ubuntu) or suffer from memory exhaustion under the Android Low Memory Killer (LMK), `termux-diffusion` executes directly against native Android Bionic `libc` with ARM64 NEON SIMD vectorization and GGML quantized tensor weights.
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## 2. Automated Bootstrap & Installation
|
|
24
|
+
|
|
25
|
+
### Option A: One-Line Zero-Touch Bootstrap (Recommended)
|
|
26
|
+
|
|
27
|
+
Run the platform bootstrap script in Termux to automatically verify toolchains, storage permissions, and native engine binaries:
|
|
28
|
+
|
|
29
|
+
#### Python Runtime
|
|
30
|
+
```bash
|
|
31
|
+
curl -sL https://raw.githubusercontent.com/uno-km/termux-diffusion/main/docs/install.sh | bash
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
#### Node.js / TypeScript Runtime
|
|
35
|
+
```bash
|
|
36
|
+
curl -sL https://raw.githubusercontent.com/uno-km/termux-diffusion/main/docs/install-node.sh | bash
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
### Option B: Package Manager Installation
|
|
42
|
+
|
|
43
|
+
#### Python (PyPI)
|
|
44
|
+
```bash
|
|
45
|
+
pip install termux-diffusion && termux-diffusion-install
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
#### Node.js (npm)
|
|
49
|
+
```bash
|
|
50
|
+
npm install -g termux-diffusion && npx termux-diffusion install
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## 3. Core Architectural Capabilities
|
|
56
|
+
|
|
57
|
+
* **Zero-PRoot Native Bionic Execution:** Executes natively on ARM64 without container overhead, achieving maximum memory efficiency.
|
|
58
|
+
* **Integrated Model Hub:** Built-in streaming downloader with automatic checksum verification and cache persistence.
|
|
59
|
+
* **Power & WakeLock Management (`TermuxWakeLock`):** Automatically holds Android CPU WakeLock during inference, preventing kernel suspension when the screen turns off.
|
|
60
|
+
* **Low-Memory & LMK Guard:** Inspects physical memory and Android zRAM (Samsung RAM Plus) before allocating tensor weight buffers.
|
|
61
|
+
* **Samsung Gallery Integration:** Automatically persists generated outputs to `~/storage/pictures/TermuxDiffusion/` and triggers `android.intent.action.MEDIA_SCANNER_SCAN_FILE` for instant indexing in Samsung Gallery.
|
|
62
|
+
* **big.LITTLE Core Affinity Tuning:** Auto-detects Exynos (e.g., 1380, 1480, 2400) and Snapdragon cluster topologies to maintain high sustained clock rates without thermal throttling.
|
|
63
|
+
* **Hardware Compute Selection:** Explicit compute backend targeting via `device="cpu"` or `device="gpu"`.
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## 4. Built-in Model Hub Presets
|
|
68
|
+
|
|
69
|
+
| Preset | Model & Quantization | Size | Latency Baseline (Exynos 1380) | Recommended Workload |
|
|
70
|
+
| :--- | :--- | :---: | :---: | :--- |
|
|
71
|
+
| **`"realistic"`** | Realistic Vision V6.0 B1 (Q4_K) | 1.62 GB | ~25 min (10 steps) | High-fidelity photorealism (portraits, skin textures, lighting) |
|
|
72
|
+
| **`"speed"`** | Stable Diffusion 1.5 Base (Q4_1) | 1.59 GB | ~15 min (10 steps) | General-purpose drafting and composition |
|
|
73
|
+
| **`"sdxs"`** | SDXS 512-0.9 Mobile (Q4_0) | **450 MB** | **~2.5 min (2 steps)** | Ultra-low latency mobile prototyping |
|
|
74
|
+
| **`"turbo"`** | SD Turbo (Q4_0) | 1.20 GB | ~4 min (1 step) | Single-step real-time inference |
|
|
75
|
+
| **`"anime"`** | DreamShaper 8 (Q4_K) | 1.65 GB | ~20 min (10 steps) | 2D / 2.5D stylized illustration and animation art |
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
## 5. Usage & Integration
|
|
80
|
+
|
|
81
|
+
### Python API
|
|
82
|
+
|
|
83
|
+
```python
|
|
84
|
+
from termux_diffusion import generate
|
|
85
|
+
|
|
86
|
+
result = generate(
|
|
87
|
+
prompt="RAW photo, portrait of a happy smiling young Korean man in his 30s wearing glasses and hoodie, working on laptop, photorealistic, cinematic",
|
|
88
|
+
model="realistic",
|
|
89
|
+
device="cpu",
|
|
90
|
+
steps=10,
|
|
91
|
+
cfg_scale=4.0,
|
|
92
|
+
output="developer.png"
|
|
93
|
+
)
|
|
94
|
+
|
|
95
|
+
print(f"Output Path: {result.path}")
|
|
96
|
+
print(f"Android MediaStore: {result.gallery_path}")
|
|
97
|
+
print(f"Elapsed Time: {result.elapsed_sec:.2f}s")
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### Node.js / TypeScript API
|
|
101
|
+
|
|
102
|
+
```javascript
|
|
103
|
+
const { generate } = require('termux-diffusion');
|
|
104
|
+
|
|
105
|
+
async function main() {
|
|
106
|
+
const result = await generate({
|
|
107
|
+
prompt: 'cyberpunk cat with neon collar in rainy alley, 8k, photorealistic',
|
|
108
|
+
model: 'speed',
|
|
109
|
+
device: 'cpu',
|
|
110
|
+
steps: 10,
|
|
111
|
+
output: 'cyber_cat.png'
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
console.log(`Output Path: ${result.path}`);
|
|
115
|
+
console.log(`Android MediaStore: ${result.galleryPath}`);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
main().catch(console.error);
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
## 6. Custom Models & Hugging Face Resolution
|
|
124
|
+
|
|
125
|
+
### 1. Direct Hugging Face Repository Identifier
|
|
126
|
+
Pass any repository ID and `.gguf` filename. The framework resolves, streams, caches, and executes the weights:
|
|
127
|
+
```python
|
|
128
|
+
generate(
|
|
129
|
+
"1girl, anime masterpiece, vibrant colors",
|
|
130
|
+
model="second-state/DreamShaper-8-GGUF/dreamshaper-8-Q4_k.gguf"
|
|
131
|
+
)
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### 2. Local File Reference
|
|
135
|
+
```python
|
|
136
|
+
generate(
|
|
137
|
+
"fantasy landscape at sunrise",
|
|
138
|
+
model="~/storage/downloads/custom_model.gguf"
|
|
139
|
+
)
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
### 3. Alias Registration (`register_model`)
|
|
143
|
+
```python
|
|
144
|
+
from termux_diffusion import register_model, generate
|
|
145
|
+
|
|
146
|
+
register_model("waifu", repo_id="second-state/DreamShaper-8-GGUF", filename="dreamshaper-8-Q4_k.gguf")
|
|
147
|
+
generate("anime portrait", model="waifu")
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
## 7. Pre-flight Diagnostic Tool
|
|
153
|
+
|
|
154
|
+
Verify system packages, architecture, available memory, and native engine status:
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
# Python
|
|
158
|
+
termux-diffusion-doctor
|
|
159
|
+
|
|
160
|
+
# Node.js
|
|
161
|
+
npx termux-diffusion doctor
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
---
|
|
165
|
+
|
|
166
|
+
## 8. License
|
|
167
|
+
|
|
168
|
+
Released under the **MIT License**. Maintained by **uno-km**.
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "termux-diffusion"
|
|
7
|
+
version = "1.0.0"
|
|
8
|
+
description = "Production On-Device AI Image Generation Framework for Android Termux & Samsung Galaxy (Dual-Engine Python & Node.js)"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.8"
|
|
11
|
+
license = { text = "MIT" }
|
|
12
|
+
authors = [
|
|
13
|
+
{ name = "uno-km (쌩초보코딩단)", email = "hosequelbo@gmail.com" }
|
|
14
|
+
]
|
|
15
|
+
keywords = [
|
|
16
|
+
"stable-diffusion",
|
|
17
|
+
"diffusion",
|
|
18
|
+
"termux",
|
|
19
|
+
"android",
|
|
20
|
+
"samsung-galaxy",
|
|
21
|
+
"edge-ai",
|
|
22
|
+
"on-device-ai",
|
|
23
|
+
"image-generation",
|
|
24
|
+
"gguf",
|
|
25
|
+
"arm64",
|
|
26
|
+
"bionic-libc",
|
|
27
|
+
"snapdragon",
|
|
28
|
+
"exynos",
|
|
29
|
+
"text-to-image",
|
|
30
|
+
"txt2img",
|
|
31
|
+
"mobile-ai",
|
|
32
|
+
"quantization",
|
|
33
|
+
"generative-ai",
|
|
34
|
+
"vulkan",
|
|
35
|
+
"opencl",
|
|
36
|
+
"offline-ai",
|
|
37
|
+
"private-ai",
|
|
38
|
+
"ai-art",
|
|
39
|
+
"comfyui-alternative",
|
|
40
|
+
"webui-alternative"
|
|
41
|
+
]
|
|
42
|
+
dynamic = ["classifiers"]
|
|
43
|
+
|
|
44
|
+
[project.urls]
|
|
45
|
+
Homepage = "https://github.com/uno-km/termux-diffusion"
|
|
46
|
+
Documentation = "https://uno-km.github.io/termux-diffusion/"
|
|
47
|
+
"npm Package" = "https://www.npmjs.com/package/termux-diffusion"
|
|
48
|
+
"Bug Tracker" = "https://github.com/uno-km/termux-diffusion/issues"
|
|
49
|
+
"Source" = "https://github.com/uno-km/termux-diffusion"
|
|
50
|
+
|
|
51
|
+
[project.scripts]
|
|
52
|
+
termux-diffusion = "termux_diffusion.cli:main"
|
|
53
|
+
termux-diffusion-install = "termux_diffusion.cli:run_install_cli"
|
|
54
|
+
termux-diffusion-doctor = "termux_diffusion.cli:run_doctor_cli"
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import os
|
|
2
|
+
from setuptools import find_packages, setup
|
|
3
|
+
|
|
4
|
+
here = os.path.abspath(os.path.dirname(__file__))
|
|
5
|
+
|
|
6
|
+
long_description = ""
|
|
7
|
+
readme_path = os.path.join(here, "README.md")
|
|
8
|
+
if os.path.exists(readme_path):
|
|
9
|
+
with open(readme_path, encoding="utf-8") as f:
|
|
10
|
+
long_description = f.read()
|
|
11
|
+
|
|
12
|
+
setup(
|
|
13
|
+
name="termux-diffusion",
|
|
14
|
+
version="1.0.0",
|
|
15
|
+
description="Production On-Device AI Image Generation Framework for Android Termux & Samsung Galaxy (Dual-Engine Python & Node.js)",
|
|
16
|
+
long_description=long_description,
|
|
17
|
+
long_description_content_type="text/markdown",
|
|
18
|
+
author="uno-km (쌩초보코딩단)",
|
|
19
|
+
author_email="hosequelbo@gmail.com",
|
|
20
|
+
url="https://github.com/uno-km/termux-diffusion",
|
|
21
|
+
project_urls={
|
|
22
|
+
"Documentation": "https://uno-km.github.io/termux-diffusion/",
|
|
23
|
+
"npm Package": "https://www.npmjs.com/package/termux-diffusion",
|
|
24
|
+
"Bug Tracker": "https://github.com/uno-km/termux-diffusion/issues",
|
|
25
|
+
"Source": "https://github.com/uno-km/termux-diffusion",
|
|
26
|
+
},
|
|
27
|
+
keywords=[
|
|
28
|
+
"stable-diffusion", "diffusion", "termux", "android", "samsung-galaxy",
|
|
29
|
+
"edge-ai", "on-device-ai", "image-generation", "gguf", "arm64",
|
|
30
|
+
"bionic-libc", "snapdragon", "exynos", "text-to-image", "txt2img",
|
|
31
|
+
"mobile-ai", "quantization", "generative-ai", "vulkan", "opencl",
|
|
32
|
+
"offline-ai", "private-ai", "ai-art", "comfyui-alternative", "webui-alternative"
|
|
33
|
+
],
|
|
34
|
+
packages=find_packages(),
|
|
35
|
+
package_data={
|
|
36
|
+
"termux_diffusion": ["py.typed"],
|
|
37
|
+
},
|
|
38
|
+
include_package_data=True,
|
|
39
|
+
python_requires=">=3.8",
|
|
40
|
+
install_requires=[],
|
|
41
|
+
entry_points={
|
|
42
|
+
"console_scripts": [
|
|
43
|
+
"termux-diffusion = termux_diffusion.cli:main",
|
|
44
|
+
"termux-diffusion-install = termux_diffusion.cli:run_install_cli",
|
|
45
|
+
"termux-diffusion-doctor = termux_diffusion.cli:run_doctor_cli",
|
|
46
|
+
],
|
|
47
|
+
},
|
|
48
|
+
classifiers=[
|
|
49
|
+
"Development Status :: 5 - Production/Stable",
|
|
50
|
+
"Intended Audience :: Developers",
|
|
51
|
+
"License :: OSI Approved :: MIT License",
|
|
52
|
+
"Operating System :: POSIX :: Linux",
|
|
53
|
+
"Operating System :: Android",
|
|
54
|
+
"Programming Language :: Python :: 3",
|
|
55
|
+
"Programming Language :: Python :: 3.8",
|
|
56
|
+
"Programming Language :: Python :: 3.9",
|
|
57
|
+
"Programming Language :: Python :: 3.10",
|
|
58
|
+
"Programming Language :: Python :: 3.11",
|
|
59
|
+
"Programming Language :: Python :: 3.12",
|
|
60
|
+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
61
|
+
"Topic :: Multimedia :: Graphics",
|
|
62
|
+
],
|
|
63
|
+
)
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"""termux-diffusion: On-Device AI Image Generation Framework for Android Termux & Samsung Galaxy."""
|
|
2
|
+
|
|
3
|
+
from .core import GenerationResult, async_generate, generate
|
|
4
|
+
from .exceptions import (
|
|
5
|
+
InferenceTimeoutError,
|
|
6
|
+
ModelDownloadError,
|
|
7
|
+
ModelNotFoundError,
|
|
8
|
+
OOMRiskError,
|
|
9
|
+
PlatformNotSupportedError,
|
|
10
|
+
ProvisioningError,
|
|
11
|
+
TermuxDiffusionError,
|
|
12
|
+
)
|
|
13
|
+
from .hub import (
|
|
14
|
+
DEFAULT_PRESETS,
|
|
15
|
+
clear_cache,
|
|
16
|
+
download_model,
|
|
17
|
+
get_cache_dir,
|
|
18
|
+
is_model_cached,
|
|
19
|
+
list_cached_models,
|
|
20
|
+
list_presets,
|
|
21
|
+
register_model,
|
|
22
|
+
resolve_model_path,
|
|
23
|
+
set_cache_dir,
|
|
24
|
+
)
|
|
25
|
+
from .installer import locate_sd_cli, provision_engine, run_doctor
|
|
26
|
+
from .platform import (
|
|
27
|
+
TermuxWakeLock,
|
|
28
|
+
check_memory_safety,
|
|
29
|
+
export_to_android_gallery,
|
|
30
|
+
get_galaxy_gallery_dir,
|
|
31
|
+
get_memory_info,
|
|
32
|
+
get_optimal_thread_count,
|
|
33
|
+
is_android_termux,
|
|
34
|
+
is_arm64,
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
__version__ = "1.0.0"
|
|
38
|
+
__author__ = "uno-km (쌩초보코딩단)"
|
|
39
|
+
__license__ = "MIT"
|
|
40
|
+
|
|
41
|
+
__all__ = [
|
|
42
|
+
"__version__",
|
|
43
|
+
"generate",
|
|
44
|
+
"async_generate",
|
|
45
|
+
"GenerationResult",
|
|
46
|
+
"download_model",
|
|
47
|
+
"resolve_model_path",
|
|
48
|
+
"register_model",
|
|
49
|
+
"set_cache_dir",
|
|
50
|
+
"get_cache_dir",
|
|
51
|
+
"is_model_cached",
|
|
52
|
+
"list_cached_models",
|
|
53
|
+
"clear_cache",
|
|
54
|
+
"list_presets",
|
|
55
|
+
"DEFAULT_PRESETS",
|
|
56
|
+
"locate_sd_cli",
|
|
57
|
+
"provision_engine",
|
|
58
|
+
"run_doctor",
|
|
59
|
+
"is_android_termux",
|
|
60
|
+
"is_arm64",
|
|
61
|
+
"check_memory_safety",
|
|
62
|
+
"get_memory_info",
|
|
63
|
+
"get_optimal_thread_count",
|
|
64
|
+
"get_galaxy_gallery_dir",
|
|
65
|
+
"export_to_android_gallery",
|
|
66
|
+
"TermuxWakeLock",
|
|
67
|
+
"TermuxDiffusionError",
|
|
68
|
+
"PlatformNotSupportedError",
|
|
69
|
+
"ModelNotFoundError",
|
|
70
|
+
"ModelDownloadError",
|
|
71
|
+
"ProvisioningError",
|
|
72
|
+
"OOMRiskError",
|
|
73
|
+
"InferenceTimeoutError",
|
|
74
|
+
]
|