edgemind-ai 0.1.1__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.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 EdgeMind Contributors
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,333 @@
1
+ Metadata-Version: 2.4
2
+ Name: edgemind-ai
3
+ Version: 0.1.1
4
+ Summary: High-performance, self-optimizing local AI image generation engine and Python SDK
5
+ Author: EdgeMind Contributors
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/VikasPatel22/EdgeMind
8
+ Project-URL: Repository, https://github.com/VikasPatel22/EdgeMind.git
9
+ Project-URL: Issues, https://github.com/VikasPatel22/EdgeMind/issues
10
+ Keywords: ai,image-generation,stable-diffusion,diffusers,hyper-sd,cuda,mps,edge-ai
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Intended Audience :: Science/Research
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
20
+ Classifier: Topic :: Multimedia :: Graphics
21
+ Requires-Python: >=3.10
22
+ Description-Content-Type: text/markdown
23
+ License-File: LICENSE
24
+ Requires-Dist: torch>=2.1.0
25
+ Requires-Dist: diffusers>=0.27.0
26
+ Requires-Dist: transformers>=4.38.0
27
+ Requires-Dist: accelerate>=0.27.0
28
+ Requires-Dist: safetensors>=0.4.0
29
+ Requires-Dist: psutil>=5.9.0
30
+ Requires-Dist: Pillow>=10.0.0
31
+ Requires-Dist: huggingface_hub>=0.20.0
32
+ Requires-Dist: peft>=0.9.0
33
+ Requires-Dist: kornia>=0.7.1
34
+ Dynamic: license-file
35
+
36
+ # ๐Ÿš€ EdgeMind
37
+
38
+ <div align="center">
39
+
40
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
41
+ [![Python: 3.10+](https://img.shields.io/badge/Python-3.10%20%7C%203.11%20%7C%203.12-blue.svg)](https://www.python.org/)
42
+ [![PyTorch](https://img.shields.io/badge/PyTorch-2.1+-ee4c2c.svg)](https://pytorch.org/)
43
+ [![Diffusers](https://img.shields.io/badge/Diffusers-0.27+-orange.svg)](https://github.com/huggingface/diffusers)
44
+ [![Platform](https://img.shields.io/badge/Platform-Windows%20%7C%20Linux%20%7C%20macOS-lightgrey.svg)](#-platform--hardware-support)
45
+ [![Hardware](https://img.shields.io/badge/Hardware-NVIDIA%20CUDA%20%7C%20Apple%20MPS%20%7C%20AMD%20ROCm%20%7C%20CPU-success.svg)](#-platform--hardware-support)
46
+
47
+ **A high-performance, self-optimizing local AI image generation engine and Python SDK.**
48
+ Engineered to run seamlessly across any operating system, custom hardware configuration, or path setup without overflowing VRAM or system memory.
49
+
50
+ [Quickstart](#-quickstart) โ€ข [API Guide](#-python-sdk--api-guide) โ€ข [CLI Commands](#-cli-interface) โ€ข [Platform Support](#-platform--hardware-support) โ€ข [Model Setup](#-model-setup--scanning)
51
+
52
+ </div>
53
+
54
+ ---
55
+
56
+ ## โœจ Key Features
57
+
58
+ - **๐Ÿ Pure Python Module**: Seamlessly embed local image generation into Python apps, Discord bots, agent workflows, and backend services with `import edgemind`.
59
+ - **โšก 1-Step Hyper-SD Acceleration**: Generates photorealistic high-fidelity images in just **1 inference step** with zero quality loss using automatic Hyper-SD LoRA fusion.
60
+ - **๐ŸŒ Cross-Platform & Universal Paths**: Runs natively on **Windows**, **Linux**, and **macOS** (including Apple Silicon M-series). Automatically discovers models across custom directories, environment variables, Hugging Face caches, and local WebUI installations.
61
+ - **๐Ÿง  Hardware Telemetry & Dynamic Profiling**:
62
+ - Live hardware probing for CPU cores, available system RAM, and GPU VRAM.
63
+ - Automatic selection of optimization profiles:
64
+ - ๐ŸŸข **Ultra VRAM** (>16GB VRAM): Full pipeline caching and native batch processing.
65
+ - ๐Ÿ”ต **High VRAM** (8โ€“16GB VRAM): FP16 / BF16 mixed-precision acceleration.
66
+ - ๐ŸŸก **Medium VRAM** (4โ€“8GB VRAM): Automated model CPU offloading and VAE tiling.
67
+ - ๐ŸŸ  **Low VRAM / CPU** (<4GB VRAM): Sequential sub-module CPU offloading, VAE slicing, and attention slicing.
68
+ - **๐Ÿงน Zero-Leak Memory Management**: Programmatic memory purging (`client.unload()`) releasing CUDA cache, IPC handles, and system garbage collector instantly.
69
+ - **๐Ÿ–ผ๏ธ Rich Image Representation**: Output `EdgeMindImage` object provides direct `.save()`, `.show()`, raw `PIL.Image`, PNG byte stream, Base64 data URI, and embedded generation metadata.
70
+
71
+ ---
72
+
73
+ ## ๐Ÿ’ป Platform & Hardware Support
74
+
75
+ EdgeMind automatically detects your hardware architecture and applies the most efficient backend:
76
+
77
+ | Hardware Tier | Platform | Acceleration Backend | Precision Supported |
78
+ | :--- | :--- | :--- | :--- |
79
+ | **NVIDIA GPU** | Windows / Linux | CUDA (11.8, 12.1, 12.4+) | FP16, BF16, FP32 |
80
+ | **Apple Silicon (M1/M2/M3/M4)** | macOS | Metal Performance Shaders (MPS) | FP16, FP32 |
81
+ | **AMD GPU** | Linux / Windows | ROCm / DirectML | FP16, FP32 |
82
+ | **CPU Only** | All Platforms | PyTorch CPU with CPU Offload & Slicing | FP32 |
83
+
84
+ ---
85
+
86
+ ## ๐Ÿ› ๏ธ Installation & Setup
87
+
88
+ ### 1. Install PyTorch Tailored to Your Hardware
89
+
90
+ #### NVIDIA GPU (CUDA 12.1 - Recommended):
91
+ ```bash
92
+ pip install torch torchvision --index-url https://download.pytorch.org/whl/cu121
93
+ ```
94
+
95
+ #### Apple Silicon (macOS MPS) or CPU-Only:
96
+ ```bash
97
+ pip install torch torchvision
98
+ ```
99
+
100
+ ---
101
+
102
+ ### 2. Install EdgeMind
103
+
104
+ #### From PyPI:
105
+ ```bash
106
+ pip install edgemind-ai
107
+ ```
108
+
109
+ #### From Source:
110
+ ```bash
111
+ git clone https://github.com/VikasPatel22/EdgeMind.git
112
+ cd EdgeMind
113
+ pip install -e .
114
+ ```
115
+
116
+ #### Via Requirements:
117
+ ```bash
118
+ pip install -r requirements.txt
119
+ ```
120
+
121
+ ---
122
+
123
+ ## ๐Ÿš€ Quickstart
124
+
125
+ Generate an image in 3 lines of Python code:
126
+
127
+ ```python
128
+ import edgemind
129
+
130
+ # Auto-detects local hardware, best checkpoint, and 1-step LoRA
131
+ image = edgemind.generate("Cyberpunk samurai cat in neon rain, cinematic lighting, 8k", save=True)
132
+
133
+ print(f"Generated in {image.elapsed_seconds}s (Seed: {image.seed})")
134
+ print(f"Saved to: {image.saved_path}")
135
+ image.show()
136
+ ```
137
+
138
+ ---
139
+
140
+ ## ๐Ÿ“– Python SDK & API Guide
141
+
142
+ ### 1. Initialize the Engine (`edgemind.init`)
143
+
144
+ Configure custom model checkpoints, optional 1-step Hyper-SD LoRA, and memory options:
145
+
146
+ ```python
147
+ import edgemind
148
+
149
+ # Initialize client with custom paths and settings
150
+ ai = edgemind.init(
151
+ model_path="models/dreamshaper_8.safetensors", # Local checkpoint or Diffusers repo
152
+ hyper_sd_path="models/Hyper-SD15-1step-lora.safetensors", # Optional 1-step turbo LoRA
153
+ output_dir="./outputs", # Output save folder
154
+ device="auto", # "auto", "cuda", "mps", "cpu"
155
+ precision="auto", # "auto", "fp16", "bf16", "fp32"
156
+ cpu_offload=True, # Automated CPU offload
157
+ vae_tiling=True, # VAE tiling for lower VRAM
158
+ attention_slicing=True # Attention slicing
159
+ )
160
+ ```
161
+
162
+ ---
163
+
164
+ ### 2. Configure Client Defaults (`client.configure`)
165
+
166
+ Set reusable generation defaults using the fluent builder API:
167
+
168
+ ```python
169
+ ai.configure(
170
+ negative_prompt="blurry, distorted, ugly, low quality, bad anatomy",
171
+ steps=1, # 1 inference step for Hyper-SD LoRA
172
+ cfg_scale=1.0, # Recommended CFG for 1-step generation
173
+ aspect_ratio="16:9", # "1:1", "16:9", "9:16", "4:3", "3:4", "21:9"
174
+ sampler="Euler", # "Euler", "Euler A", "DPM++ 2M", "DDIM", "UniPC", "Heun"
175
+ auto_enhance=True, # Aesthetic prompt quality enhancer
176
+ quality_preset="photorealistic" # "photorealistic", "cinematic", "anime", "cyberpunk", "3d"
177
+ )
178
+ ```
179
+
180
+ ---
181
+
182
+ ### 3. Generate Single Images (`client.generate`)
183
+
184
+ ```python
185
+ image = ai.generate(
186
+ prompt="A celestial lion sculpted from galaxy nebulas, glowing starlight, 8k",
187
+ seed=42, # Explicit seed or omit for random
188
+ aspect_ratio="16:9", # Overrides client default
189
+ save=True # Automatically saves to output_dir
190
+ )
191
+ ```
192
+
193
+ ---
194
+
195
+ ### 4. Working With `EdgeMindImage`
196
+
197
+ The result returned by `generate()` provides rich native properties and export methods:
198
+
199
+ ```python
200
+ # 1. Native PIL Image
201
+ pil_img = image.image # Standard PIL.Image.Image instance
202
+
203
+ # 2. Save to custom location (with embedded generation metadata in PNG chunks)
204
+ image.save("custom_path.png")
205
+
206
+ # 3. View in OS default image viewer
207
+ image.show()
208
+
209
+ # 4. Binary PNG bytes (for file transfers, streaming, or Discord bots)
210
+ raw_bytes = image.bytes
211
+
212
+ # 5. Base64 Data URI (for web APIs or HTML rendering)
213
+ b64_uri = image.base64
214
+
215
+ # 6. NumPy array (for OpenCV or ML pipelines)
216
+ np_array = image.to_numpy()
217
+
218
+ # 7. Metadata inspection
219
+ print("Prompt:", image.prompt)
220
+ print("Seed:", image.seed)
221
+ print("Elapsed Time:", image.elapsed_seconds)
222
+ print("Model Used:", image.model)
223
+ print("Hyper-SD Active:", image.hyper_sd_active)
224
+ ```
225
+
226
+ ---
227
+
228
+ ### 5. Batch Image Generation (`client.generate_batch`)
229
+
230
+ Generate multiple image variations sequentially:
231
+
232
+ ```python
233
+ prompts = [
234
+ "Ethereal crystal castle floating above storm clouds, golden hour",
235
+ "Bioluminescent deep sea astronaut discovering ancient ruins",
236
+ "Cyberpunk neon street market in Tokyo at midnight, ultra realistic"
237
+ ]
238
+
239
+ results = ai.generate_batch(prompts, save=True, steps=1)
240
+
241
+ for img in results:
242
+ print(f"Saved: {img.saved_path} (Seed: {img.seed})")
243
+ ```
244
+
245
+ ---
246
+
247
+ ### 6. Memory Management (`client.unload`)
248
+
249
+ Explicitly flush GPU VRAM and release pipeline from system memory:
250
+
251
+ ```python
252
+ ai.unload()
253
+ ```
254
+
255
+ ---
256
+
257
+ ### 7. Inspect Hardware & Discovered Models
258
+
259
+ ```python
260
+ # Hardware specs and auto-profile
261
+ specs = ai.hardware_info
262
+ print(f"Device: {specs['device_name']}, Profile: {specs['profile']}, VRAM: {specs['vram_total_gb']}GB")
263
+
264
+ # Discovered local model checkpoints across drives
265
+ models = ai.models
266
+ for m in models:
267
+ print(f"- {m['name']} ({m['format']}) at {m['path']}")
268
+ ```
269
+
270
+ ---
271
+
272
+ ## ๐Ÿ’ป CLI Interface
273
+
274
+ EdgeMind provides a command-line interface directly from your terminal:
275
+
276
+ ```bash
277
+ # Generate image from prompt
278
+ edgemind "A neon cyberpunk samurai cat, 8k resolution" --steps 1 --output cat.png --show
279
+
280
+ # Inspect hardware and execution tier
281
+ edgemind info
282
+
283
+ # List discovered local models
284
+ edgemind models
285
+ ```
286
+
287
+ ---
288
+
289
+ ## ๐Ÿ“ Model Setup & Scanning
290
+
291
+ EdgeMind supports **`.safetensors`**, **`.ckpt`**, and **Diffusers format** folders (Stable Diffusion 1.5, SD 2.1, SDXL, SDXL Turbo, Flux, etc.).
292
+
293
+ ### Option A: Local Models Folder
294
+ Place checkpoints into `./models/`:
295
+ ```text
296
+ models/
297
+ โ”œโ”€โ”€ dreamshaper_8.safetensors
298
+ โ””โ”€โ”€ Hyper-SD15-1step-lora.safetensors
299
+ ```
300
+
301
+ ### Option B: Automatic Cross-Platform Discovery
302
+ EdgeMind automatically detects models in common installation directories across Windows, macOS, and Linux without requiring duplicate downloads:
303
+ - `~/.cache/huggingface/hub/` (Hugging Face default hub cache)
304
+ - `~/stable-diffusion-webui/models/Stable-diffusion`
305
+ - `~/Fooocus/models/checkpoints`
306
+ - `~/ComfyUI/models/checkpoints`
307
+ - Common WebUI, Fooocus, and ComfyUI checkpoint folders across system drives (Windows / Linux / macOS)
308
+
309
+ ### Option C: Custom Models Path via Environment Variable
310
+ ```bash
311
+ # Windows (PowerShell)
312
+ $env:EDGEMIND_MODELS_DIR="D:\AI_Models\Checkpoints"
313
+
314
+ # Linux / macOS
315
+ export EDGEMIND_MODELS_DIR="/mnt/data/models"
316
+ ```
317
+
318
+ ---
319
+
320
+ ## โšก 1-Step Hyper-SD LoRA Acceleration
321
+
322
+ For near-instant 1-step generation:
323
+ 1. Download `Hyper-SD15-1step-lora.safetensors` from Hugging Face:
324
+ ```bash
325
+ curl -L -o models/Hyper-SD15-1step-lora.safetensors "https://huggingface.co/ByteDance/Hyper-SD/resolve/main/Hyper-SD15-1step-lora.safetensors"
326
+ ```
327
+ 2. EdgeMind automatically detects and fuses the LoRA, configuring Euler scheduling with trailing timestep spacing for lightning inference.
328
+
329
+ ---
330
+
331
+ ## ๐Ÿ“„ License
332
+
333
+ Distributed under the **MIT License**. See [LICENSE](LICENSE) for more details.
@@ -0,0 +1,298 @@
1
+ # ๐Ÿš€ EdgeMind
2
+
3
+ <div align="center">
4
+
5
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
6
+ [![Python: 3.10+](https://img.shields.io/badge/Python-3.10%20%7C%203.11%20%7C%203.12-blue.svg)](https://www.python.org/)
7
+ [![PyTorch](https://img.shields.io/badge/PyTorch-2.1+-ee4c2c.svg)](https://pytorch.org/)
8
+ [![Diffusers](https://img.shields.io/badge/Diffusers-0.27+-orange.svg)](https://github.com/huggingface/diffusers)
9
+ [![Platform](https://img.shields.io/badge/Platform-Windows%20%7C%20Linux%20%7C%20macOS-lightgrey.svg)](#-platform--hardware-support)
10
+ [![Hardware](https://img.shields.io/badge/Hardware-NVIDIA%20CUDA%20%7C%20Apple%20MPS%20%7C%20AMD%20ROCm%20%7C%20CPU-success.svg)](#-platform--hardware-support)
11
+
12
+ **A high-performance, self-optimizing local AI image generation engine and Python SDK.**
13
+ Engineered to run seamlessly across any operating system, custom hardware configuration, or path setup without overflowing VRAM or system memory.
14
+
15
+ [Quickstart](#-quickstart) โ€ข [API Guide](#-python-sdk--api-guide) โ€ข [CLI Commands](#-cli-interface) โ€ข [Platform Support](#-platform--hardware-support) โ€ข [Model Setup](#-model-setup--scanning)
16
+
17
+ </div>
18
+
19
+ ---
20
+
21
+ ## โœจ Key Features
22
+
23
+ - **๐Ÿ Pure Python Module**: Seamlessly embed local image generation into Python apps, Discord bots, agent workflows, and backend services with `import edgemind`.
24
+ - **โšก 1-Step Hyper-SD Acceleration**: Generates photorealistic high-fidelity images in just **1 inference step** with zero quality loss using automatic Hyper-SD LoRA fusion.
25
+ - **๐ŸŒ Cross-Platform & Universal Paths**: Runs natively on **Windows**, **Linux**, and **macOS** (including Apple Silicon M-series). Automatically discovers models across custom directories, environment variables, Hugging Face caches, and local WebUI installations.
26
+ - **๐Ÿง  Hardware Telemetry & Dynamic Profiling**:
27
+ - Live hardware probing for CPU cores, available system RAM, and GPU VRAM.
28
+ - Automatic selection of optimization profiles:
29
+ - ๐ŸŸข **Ultra VRAM** (>16GB VRAM): Full pipeline caching and native batch processing.
30
+ - ๐Ÿ”ต **High VRAM** (8โ€“16GB VRAM): FP16 / BF16 mixed-precision acceleration.
31
+ - ๐ŸŸก **Medium VRAM** (4โ€“8GB VRAM): Automated model CPU offloading and VAE tiling.
32
+ - ๐ŸŸ  **Low VRAM / CPU** (<4GB VRAM): Sequential sub-module CPU offloading, VAE slicing, and attention slicing.
33
+ - **๐Ÿงน Zero-Leak Memory Management**: Programmatic memory purging (`client.unload()`) releasing CUDA cache, IPC handles, and system garbage collector instantly.
34
+ - **๐Ÿ–ผ๏ธ Rich Image Representation**: Output `EdgeMindImage` object provides direct `.save()`, `.show()`, raw `PIL.Image`, PNG byte stream, Base64 data URI, and embedded generation metadata.
35
+
36
+ ---
37
+
38
+ ## ๐Ÿ’ป Platform & Hardware Support
39
+
40
+ EdgeMind automatically detects your hardware architecture and applies the most efficient backend:
41
+
42
+ | Hardware Tier | Platform | Acceleration Backend | Precision Supported |
43
+ | :--- | :--- | :--- | :--- |
44
+ | **NVIDIA GPU** | Windows / Linux | CUDA (11.8, 12.1, 12.4+) | FP16, BF16, FP32 |
45
+ | **Apple Silicon (M1/M2/M3/M4)** | macOS | Metal Performance Shaders (MPS) | FP16, FP32 |
46
+ | **AMD GPU** | Linux / Windows | ROCm / DirectML | FP16, FP32 |
47
+ | **CPU Only** | All Platforms | PyTorch CPU with CPU Offload & Slicing | FP32 |
48
+
49
+ ---
50
+
51
+ ## ๐Ÿ› ๏ธ Installation & Setup
52
+
53
+ ### 1. Install PyTorch Tailored to Your Hardware
54
+
55
+ #### NVIDIA GPU (CUDA 12.1 - Recommended):
56
+ ```bash
57
+ pip install torch torchvision --index-url https://download.pytorch.org/whl/cu121
58
+ ```
59
+
60
+ #### Apple Silicon (macOS MPS) or CPU-Only:
61
+ ```bash
62
+ pip install torch torchvision
63
+ ```
64
+
65
+ ---
66
+
67
+ ### 2. Install EdgeMind
68
+
69
+ #### From PyPI:
70
+ ```bash
71
+ pip install edgemind-ai
72
+ ```
73
+
74
+ #### From Source:
75
+ ```bash
76
+ git clone https://github.com/VikasPatel22/EdgeMind.git
77
+ cd EdgeMind
78
+ pip install -e .
79
+ ```
80
+
81
+ #### Via Requirements:
82
+ ```bash
83
+ pip install -r requirements.txt
84
+ ```
85
+
86
+ ---
87
+
88
+ ## ๐Ÿš€ Quickstart
89
+
90
+ Generate an image in 3 lines of Python code:
91
+
92
+ ```python
93
+ import edgemind
94
+
95
+ # Auto-detects local hardware, best checkpoint, and 1-step LoRA
96
+ image = edgemind.generate("Cyberpunk samurai cat in neon rain, cinematic lighting, 8k", save=True)
97
+
98
+ print(f"Generated in {image.elapsed_seconds}s (Seed: {image.seed})")
99
+ print(f"Saved to: {image.saved_path}")
100
+ image.show()
101
+ ```
102
+
103
+ ---
104
+
105
+ ## ๐Ÿ“– Python SDK & API Guide
106
+
107
+ ### 1. Initialize the Engine (`edgemind.init`)
108
+
109
+ Configure custom model checkpoints, optional 1-step Hyper-SD LoRA, and memory options:
110
+
111
+ ```python
112
+ import edgemind
113
+
114
+ # Initialize client with custom paths and settings
115
+ ai = edgemind.init(
116
+ model_path="models/dreamshaper_8.safetensors", # Local checkpoint or Diffusers repo
117
+ hyper_sd_path="models/Hyper-SD15-1step-lora.safetensors", # Optional 1-step turbo LoRA
118
+ output_dir="./outputs", # Output save folder
119
+ device="auto", # "auto", "cuda", "mps", "cpu"
120
+ precision="auto", # "auto", "fp16", "bf16", "fp32"
121
+ cpu_offload=True, # Automated CPU offload
122
+ vae_tiling=True, # VAE tiling for lower VRAM
123
+ attention_slicing=True # Attention slicing
124
+ )
125
+ ```
126
+
127
+ ---
128
+
129
+ ### 2. Configure Client Defaults (`client.configure`)
130
+
131
+ Set reusable generation defaults using the fluent builder API:
132
+
133
+ ```python
134
+ ai.configure(
135
+ negative_prompt="blurry, distorted, ugly, low quality, bad anatomy",
136
+ steps=1, # 1 inference step for Hyper-SD LoRA
137
+ cfg_scale=1.0, # Recommended CFG for 1-step generation
138
+ aspect_ratio="16:9", # "1:1", "16:9", "9:16", "4:3", "3:4", "21:9"
139
+ sampler="Euler", # "Euler", "Euler A", "DPM++ 2M", "DDIM", "UniPC", "Heun"
140
+ auto_enhance=True, # Aesthetic prompt quality enhancer
141
+ quality_preset="photorealistic" # "photorealistic", "cinematic", "anime", "cyberpunk", "3d"
142
+ )
143
+ ```
144
+
145
+ ---
146
+
147
+ ### 3. Generate Single Images (`client.generate`)
148
+
149
+ ```python
150
+ image = ai.generate(
151
+ prompt="A celestial lion sculpted from galaxy nebulas, glowing starlight, 8k",
152
+ seed=42, # Explicit seed or omit for random
153
+ aspect_ratio="16:9", # Overrides client default
154
+ save=True # Automatically saves to output_dir
155
+ )
156
+ ```
157
+
158
+ ---
159
+
160
+ ### 4. Working With `EdgeMindImage`
161
+
162
+ The result returned by `generate()` provides rich native properties and export methods:
163
+
164
+ ```python
165
+ # 1. Native PIL Image
166
+ pil_img = image.image # Standard PIL.Image.Image instance
167
+
168
+ # 2. Save to custom location (with embedded generation metadata in PNG chunks)
169
+ image.save("custom_path.png")
170
+
171
+ # 3. View in OS default image viewer
172
+ image.show()
173
+
174
+ # 4. Binary PNG bytes (for file transfers, streaming, or Discord bots)
175
+ raw_bytes = image.bytes
176
+
177
+ # 5. Base64 Data URI (for web APIs or HTML rendering)
178
+ b64_uri = image.base64
179
+
180
+ # 6. NumPy array (for OpenCV or ML pipelines)
181
+ np_array = image.to_numpy()
182
+
183
+ # 7. Metadata inspection
184
+ print("Prompt:", image.prompt)
185
+ print("Seed:", image.seed)
186
+ print("Elapsed Time:", image.elapsed_seconds)
187
+ print("Model Used:", image.model)
188
+ print("Hyper-SD Active:", image.hyper_sd_active)
189
+ ```
190
+
191
+ ---
192
+
193
+ ### 5. Batch Image Generation (`client.generate_batch`)
194
+
195
+ Generate multiple image variations sequentially:
196
+
197
+ ```python
198
+ prompts = [
199
+ "Ethereal crystal castle floating above storm clouds, golden hour",
200
+ "Bioluminescent deep sea astronaut discovering ancient ruins",
201
+ "Cyberpunk neon street market in Tokyo at midnight, ultra realistic"
202
+ ]
203
+
204
+ results = ai.generate_batch(prompts, save=True, steps=1)
205
+
206
+ for img in results:
207
+ print(f"Saved: {img.saved_path} (Seed: {img.seed})")
208
+ ```
209
+
210
+ ---
211
+
212
+ ### 6. Memory Management (`client.unload`)
213
+
214
+ Explicitly flush GPU VRAM and release pipeline from system memory:
215
+
216
+ ```python
217
+ ai.unload()
218
+ ```
219
+
220
+ ---
221
+
222
+ ### 7. Inspect Hardware & Discovered Models
223
+
224
+ ```python
225
+ # Hardware specs and auto-profile
226
+ specs = ai.hardware_info
227
+ print(f"Device: {specs['device_name']}, Profile: {specs['profile']}, VRAM: {specs['vram_total_gb']}GB")
228
+
229
+ # Discovered local model checkpoints across drives
230
+ models = ai.models
231
+ for m in models:
232
+ print(f"- {m['name']} ({m['format']}) at {m['path']}")
233
+ ```
234
+
235
+ ---
236
+
237
+ ## ๐Ÿ’ป CLI Interface
238
+
239
+ EdgeMind provides a command-line interface directly from your terminal:
240
+
241
+ ```bash
242
+ # Generate image from prompt
243
+ edgemind "A neon cyberpunk samurai cat, 8k resolution" --steps 1 --output cat.png --show
244
+
245
+ # Inspect hardware and execution tier
246
+ edgemind info
247
+
248
+ # List discovered local models
249
+ edgemind models
250
+ ```
251
+
252
+ ---
253
+
254
+ ## ๐Ÿ“ Model Setup & Scanning
255
+
256
+ EdgeMind supports **`.safetensors`**, **`.ckpt`**, and **Diffusers format** folders (Stable Diffusion 1.5, SD 2.1, SDXL, SDXL Turbo, Flux, etc.).
257
+
258
+ ### Option A: Local Models Folder
259
+ Place checkpoints into `./models/`:
260
+ ```text
261
+ models/
262
+ โ”œโ”€โ”€ dreamshaper_8.safetensors
263
+ โ””โ”€โ”€ Hyper-SD15-1step-lora.safetensors
264
+ ```
265
+
266
+ ### Option B: Automatic Cross-Platform Discovery
267
+ EdgeMind automatically detects models in common installation directories across Windows, macOS, and Linux without requiring duplicate downloads:
268
+ - `~/.cache/huggingface/hub/` (Hugging Face default hub cache)
269
+ - `~/stable-diffusion-webui/models/Stable-diffusion`
270
+ - `~/Fooocus/models/checkpoints`
271
+ - `~/ComfyUI/models/checkpoints`
272
+ - Common WebUI, Fooocus, and ComfyUI checkpoint folders across system drives (Windows / Linux / macOS)
273
+
274
+ ### Option C: Custom Models Path via Environment Variable
275
+ ```bash
276
+ # Windows (PowerShell)
277
+ $env:EDGEMIND_MODELS_DIR="D:\AI_Models\Checkpoints"
278
+
279
+ # Linux / macOS
280
+ export EDGEMIND_MODELS_DIR="/mnt/data/models"
281
+ ```
282
+
283
+ ---
284
+
285
+ ## โšก 1-Step Hyper-SD LoRA Acceleration
286
+
287
+ For near-instant 1-step generation:
288
+ 1. Download `Hyper-SD15-1step-lora.safetensors` from Hugging Face:
289
+ ```bash
290
+ curl -L -o models/Hyper-SD15-1step-lora.safetensors "https://huggingface.co/ByteDance/Hyper-SD/resolve/main/Hyper-SD15-1step-lora.safetensors"
291
+ ```
292
+ 2. EdgeMind automatically detects and fuses the LoRA, configuring Euler scheduling with trailing timestep spacing for lightning inference.
293
+
294
+ ---
295
+
296
+ ## ๐Ÿ“„ License
297
+
298
+ Distributed under the **MIT License**. See [LICENSE](LICENSE) for more details.
@@ -0,0 +1,22 @@
1
+ """
2
+ EdgeMind โ€” High-Performance Local AI Image Generation Engine & SDK
3
+ """
4
+
5
+ from edgemind.client import EdgeMind, EdgeMindImage, init, generate, unload
6
+ from edgemind.telemetry import get_hardware_specs
7
+ from edgemind.model_manager import scan_models, find_hyper_sd_lora
8
+
9
+ __version__ = "0.1.1"
10
+ __license__ = "MIT"
11
+
12
+ __all__ = [
13
+ "EdgeMind",
14
+ "EdgeMindImage",
15
+ "init",
16
+ "generate",
17
+ "unload",
18
+ "get_hardware_specs",
19
+ "scan_models",
20
+ "find_hyper_sd_lora",
21
+ "__version__",
22
+ ]