ollamadiffuser 1.0.0__tar.gz → 1.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.
Files changed (43) hide show
  1. ollamadiffuser-1.1.1/CHANGELOG.md +141 -0
  2. ollamadiffuser-1.1.1/PKG-INFO +470 -0
  3. ollamadiffuser-1.1.1/README.md +404 -0
  4. {ollamadiffuser-1.0.0 → ollamadiffuser-1.1.1}/ollamadiffuser/api/server.py +147 -2
  5. {ollamadiffuser-1.0.0 → ollamadiffuser-1.1.1}/ollamadiffuser/cli/main.py +325 -25
  6. {ollamadiffuser-1.0.0 → ollamadiffuser-1.1.1}/ollamadiffuser/core/inference/engine.py +180 -9
  7. {ollamadiffuser-1.0.0 → ollamadiffuser-1.1.1}/ollamadiffuser/core/models/manager.py +136 -2
  8. ollamadiffuser-1.1.1/ollamadiffuser/core/utils/controlnet_preprocessors.py +317 -0
  9. {ollamadiffuser-1.0.0 → ollamadiffuser-1.1.1}/ollamadiffuser/core/utils/download_utils.py +209 -60
  10. ollamadiffuser-1.1.1/ollamadiffuser/ui/templates/index.html +873 -0
  11. ollamadiffuser-1.1.1/ollamadiffuser/ui/web.py +359 -0
  12. ollamadiffuser-1.1.1/ollamadiffuser.egg-info/PKG-INFO +470 -0
  13. {ollamadiffuser-1.0.0 → ollamadiffuser-1.1.1}/ollamadiffuser.egg-info/SOURCES.txt +1 -0
  14. {ollamadiffuser-1.0.0 → ollamadiffuser-1.1.1}/ollamadiffuser.egg-info/requires.txt +3 -1
  15. {ollamadiffuser-1.0.0 → ollamadiffuser-1.1.1}/pyproject.toml +29 -5
  16. {ollamadiffuser-1.0.0 → ollamadiffuser-1.1.1}/requirements.txt +4 -2
  17. {ollamadiffuser-1.0.0 → ollamadiffuser-1.1.1}/setup.py +5 -3
  18. ollamadiffuser-1.0.0/CHANGELOG.md +0 -65
  19. ollamadiffuser-1.0.0/PKG-INFO +0 -493
  20. ollamadiffuser-1.0.0/README.md +0 -438
  21. ollamadiffuser-1.0.0/ollamadiffuser/ui/templates/index.html +0 -496
  22. ollamadiffuser-1.0.0/ollamadiffuser/ui/web.py +0 -278
  23. ollamadiffuser-1.0.0/ollamadiffuser.egg-info/PKG-INFO +0 -493
  24. {ollamadiffuser-1.0.0 → ollamadiffuser-1.1.1}/LICENSE +0 -0
  25. {ollamadiffuser-1.0.0 → ollamadiffuser-1.1.1}/MANIFEST.in +0 -0
  26. {ollamadiffuser-1.0.0 → ollamadiffuser-1.1.1}/ollamadiffuser/__init__.py +0 -0
  27. {ollamadiffuser-1.0.0 → ollamadiffuser-1.1.1}/ollamadiffuser/__main__.py +0 -0
  28. {ollamadiffuser-1.0.0 → ollamadiffuser-1.1.1}/ollamadiffuser/api/__init__.py +0 -0
  29. {ollamadiffuser-1.0.0 → ollamadiffuser-1.1.1}/ollamadiffuser/cli/__init__.py +0 -0
  30. {ollamadiffuser-1.0.0 → ollamadiffuser-1.1.1}/ollamadiffuser/core/__init__.py +0 -0
  31. {ollamadiffuser-1.0.0 → ollamadiffuser-1.1.1}/ollamadiffuser/core/config/__init__.py +0 -0
  32. {ollamadiffuser-1.0.0 → ollamadiffuser-1.1.1}/ollamadiffuser/core/config/settings.py +0 -0
  33. {ollamadiffuser-1.0.0 → ollamadiffuser-1.1.1}/ollamadiffuser/core/inference/__init__.py +0 -0
  34. {ollamadiffuser-1.0.0 → ollamadiffuser-1.1.1}/ollamadiffuser/core/models/__init__.py +0 -0
  35. {ollamadiffuser-1.0.0 → ollamadiffuser-1.1.1}/ollamadiffuser/core/utils/__init__.py +0 -0
  36. {ollamadiffuser-1.0.0 → ollamadiffuser-1.1.1}/ollamadiffuser/core/utils/lora_manager.py +0 -0
  37. {ollamadiffuser-1.0.0 → ollamadiffuser-1.1.1}/ollamadiffuser/ui/__init__.py +0 -0
  38. {ollamadiffuser-1.0.0 → ollamadiffuser-1.1.1}/ollamadiffuser/utils/__init__.py +0 -0
  39. {ollamadiffuser-1.0.0 → ollamadiffuser-1.1.1}/ollamadiffuser.egg-info/dependency_links.txt +0 -0
  40. {ollamadiffuser-1.0.0 → ollamadiffuser-1.1.1}/ollamadiffuser.egg-info/entry_points.txt +0 -0
  41. {ollamadiffuser-1.0.0 → ollamadiffuser-1.1.1}/ollamadiffuser.egg-info/not-zip-safe +0 -0
  42. {ollamadiffuser-1.0.0 → ollamadiffuser-1.1.1}/ollamadiffuser.egg-info/top_level.txt +0 -0
  43. {ollamadiffuser-1.0.0 → ollamadiffuser-1.1.1}/setup.cfg +0 -0
@@ -0,0 +1,141 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [1.1.0] - 2024-12-XX
9
+
10
+ ### 🚀 Major Features Added
11
+
12
+ #### ⚡ Lazy Loading Architecture
13
+ - **Instant Startup**: Application now starts immediately without downloading ControlNet models
14
+ - **On-Demand Loading**: ControlNet preprocessors initialize only when actually needed
15
+ - **Performance Boost**: `ollamadiffuser --help` runs in milliseconds instead of 30+ seconds
16
+ - **Memory Efficient**: No unnecessary model downloads for users who don't use ControlNet
17
+
18
+ #### 🎛️ Complete ControlNet Integration
19
+ - **6 ControlNet Models**: SD 1.5 and SDXL variants (canny, depth, openpose, scribble)
20
+ - **10 Control Types**: canny, depth, openpose, hed, mlsd, normal, lineart, lineart_anime, shuffle, scribble
21
+ - **Advanced Preprocessors**: Full controlnet-aux integration with graceful fallbacks
22
+ - **Web UI Integration**: File upload, preprocessing, and side-by-side result display
23
+ - **REST API Support**: Complete API endpoints for ControlNet generation and preprocessing
24
+
25
+ #### 🔄 Enhanced LoRA Management
26
+ - **Web UI Integration**: Download LoRAs directly from Hugging Face in the browser
27
+ - **Alias Support**: Create custom names for your LoRAs
28
+ - **Strength Control**: Adjust LoRA influence with intuitive sliders
29
+ - **Real-time Loading**: Load/unload LoRAs without restarting the application
30
+
31
+ ### 🛠️ Technical Improvements
32
+
33
+ #### ControlNet Preprocessor Manager
34
+ - **Lazy Initialization**: `ControlNetPreprocessorManager` with `is_initialized()`, `is_available()`, `initialize()` methods
35
+ - **Automatic Fallback**: Basic OpenCV processors when advanced ones fail
36
+ - **Error Handling**: Robust validation and graceful degradation
37
+ - **Status Tracking**: Real-time initialization and availability status
38
+
39
+ #### Web UI Enhancements
40
+ - **ControlNet Section**: Dedicated controls with status indicators
41
+ - **Initialization Button**: Manual preprocessor initialization for faster processing
42
+ - **File Upload**: Drag-and-drop control image upload with validation
43
+ - **Responsive Design**: Mobile-friendly interface with adaptive layouts
44
+ - **Real-time Status**: Live model, LoRA, and ControlNet status indicators
45
+
46
+ #### API Improvements
47
+ - **New Endpoints**: `/api/controlnet/initialize`, `/api/controlnet/preprocessors`, `/api/controlnet/preprocess`
48
+ - **File Upload Support**: Multipart form data handling for control images
49
+ - **Status Endpoints**: Check ControlNet availability and initialization status
50
+ - **Error Handling**: Comprehensive error responses with helpful messages
51
+
52
+ ### 📦 Dependencies Updated
53
+ - **controlnet-aux**: Added `>=0.0.7` for advanced preprocessing capabilities
54
+ - **opencv-python**: Added `>=4.8.0` for basic image processing fallbacks
55
+ - **diffusers**: Updated to `>=0.26.0` for ControlNet compatibility
56
+
57
+ ### 🎨 User Experience Improvements
58
+
59
+ #### Startup Performance
60
+ - **Before**: 30+ seconds startup time, 1GB+ automatic downloads
61
+ - **After**: Instant startup, downloads only when needed
62
+ - **User Control**: Choose when to initialize ControlNet preprocessors
63
+
64
+ #### Web UI Experience
65
+ - **Status Indicators**: Clear visual feedback for all system states
66
+ - **Progressive Loading**: Initialize components as needed
67
+ - **Error Messages**: Helpful guidance for common issues
68
+ - **Mobile Support**: Responsive design works on all devices
69
+
70
+ #### CLI Experience
71
+ - **Fast Commands**: All CLI commands run instantly
72
+ - **Lazy Loading**: ControlNet models load only when generating
73
+ - **Status Commands**: Check system state without triggering downloads
74
+
75
+ ### 🔧 Configuration Changes
76
+ - **setup.py**: Added ControlNet dependencies
77
+ - **pyproject.toml**: Updated dependency specifications
78
+ - **Model Registry**: Enhanced with ControlNet model definitions
79
+
80
+ ### 📚 Documentation Updates
81
+ - **CONTROLNET_GUIDE.md**: Comprehensive 400+ line guide with examples
82
+ - **README.md**: Updated with lazy loading features and ControlNet quick start
83
+ - **API Documentation**: Complete endpoint reference with examples
84
+
85
+ ### 🐛 Bug Fixes
86
+ - **Startup Crashes**: Fixed 404 errors from non-existent model repositories
87
+ - **Memory Leaks**: Improved cleanup of ControlNet preprocessors
88
+ - **Device Compatibility**: Better handling of CPU/GPU device switching
89
+ - **Error Handling**: More graceful failure modes with helpful messages
90
+
91
+ ### ⚠️ Breaking Changes
92
+ - **Import Behavior**: `controlnet_preprocessors` module no longer auto-initializes
93
+ - **API Changes**: Some ControlNet endpoints require explicit initialization
94
+
95
+ ### 🔄 Migration Guide
96
+ For users upgrading from v1.0.x:
97
+
98
+ 1. **No Action Required**: Lazy loading is automatic and transparent
99
+ 2. **Web UI**: ControlNet preprocessors initialize automatically when uploading images
100
+ 3. **API Users**: Call `/api/controlnet/initialize` for faster subsequent processing
101
+ 4. **Python API**: Use `controlnet_preprocessor.initialize()` for batch processing
102
+
103
+ ### 🎯 Performance Metrics
104
+ - **Startup Time**: Reduced from 30+ seconds to <1 second
105
+ - **Memory Usage**: Reduced baseline memory footprint by ~2GB
106
+ - **First Generation**: Slightly slower due to lazy loading, then normal speed
107
+ - **Subsequent Generations**: Same performance as before
108
+
109
+ ## [1.0.0] - 2024-11-XX
110
+
111
+ ### Added
112
+ - Initial release with core functionality
113
+ - Support for Stable Diffusion 1.5, SDXL, SD3, and FLUX models
114
+ - Basic LoRA support
115
+ - CLI interface
116
+ - REST API server
117
+ - Web UI interface
118
+ - Model management system
119
+
120
+ ### Features
121
+ - Model downloading and management
122
+ - Image generation with various parameters
123
+ - Multiple interface options (CLI, API, Web UI)
124
+ - Hardware optimization (CUDA, MPS, CPU)
125
+ - Safety checker bypass for creative freedom
126
+
127
+ ---
128
+
129
+ ## Development Notes
130
+
131
+ ### Version Numbering
132
+ - **Major** (X.0.0): Breaking changes, major feature additions
133
+ - **Minor** (1.X.0): New features, significant improvements
134
+ - **Patch** (1.1.X): Bug fixes, minor improvements
135
+
136
+ ### Release Process
137
+ 1. Update version in `__init__.py`
138
+ 2. Update CHANGELOG.md with new features
139
+ 3. Update documentation
140
+ 4. Create release tag
141
+ 5. Deploy to package repositories
@@ -0,0 +1,470 @@
1
+ Metadata-Version: 2.4
2
+ Name: ollamadiffuser
3
+ Version: 1.1.1
4
+ Summary: 🎨 Local AI Image Generation with Ollama-style CLI for Stable Diffusion, FLUX.1, and LoRA support
5
+ Home-page: https://github.com/ollamadiffuser/ollamadiffuser
6
+ Author: OllamaDiffuser Team
7
+ Author-email: OllamaDiffuser Team <ollamadiffuser@gmail.com>
8
+ License: MIT
9
+ Project-URL: Homepage, https://www.ollamadiffuser.com/
10
+ Project-URL: Website, https://www.ollamadiffuser.com/
11
+ Project-URL: Repository, https://github.com/ollamadiffuser/ollamadiffuser
12
+ Project-URL: Issues, https://github.com/ollamadiffuser/ollamadiffuser/issues
13
+ Project-URL: Documentation, https://www.ollamadiffuser.com/
14
+ Project-URL: Bug Reports, https://github.com/ollamadiffuser/ollamadiffuser/issues
15
+ Project-URL: Feature Requests, https://github.com/ollamadiffuser/ollamadiffuser/issues
16
+ Project-URL: Source Code, https://github.com/ollamadiffuser/ollamadiffuser
17
+ Keywords: diffusion,image-generation,ai,machine-learning,lora,ollama,stable-diffusion,flux,local-ai,controlnet,web-ui,cli
18
+ Classifier: Development Status :: 4 - Beta
19
+ Classifier: Intended Audience :: Developers
20
+ Classifier: Intended Audience :: End Users/Desktop
21
+ Classifier: License :: OSI Approved :: MIT License
22
+ Classifier: Operating System :: OS Independent
23
+ Classifier: Programming Language :: Python :: 3
24
+ Classifier: Programming Language :: Python :: 3.10
25
+ Classifier: Programming Language :: Python :: 3.11
26
+ Classifier: Programming Language :: Python :: 3.12
27
+ Classifier: Programming Language :: Python :: 3.13
28
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
29
+ Classifier: Topic :: Multimedia :: Graphics
30
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
31
+ Classifier: Environment :: Console
32
+ Classifier: Environment :: Web Environment
33
+ Requires-Python: >=3.10
34
+ Description-Content-Type: text/markdown
35
+ License-File: LICENSE
36
+ Requires-Dist: torch>=2.1.0
37
+ Requires-Dist: diffusers>=0.26.0
38
+ Requires-Dist: transformers>=4.35.0
39
+ Requires-Dist: accelerate>=0.25.0
40
+ Requires-Dist: fastapi>=0.104.0
41
+ Requires-Dist: uvicorn>=0.23.0
42
+ Requires-Dist: huggingface-hub>=0.16.0
43
+ Requires-Dist: Pillow>=9.0.0
44
+ Requires-Dist: click>=8.0.0
45
+ Requires-Dist: rich>=13.0.0
46
+ Requires-Dist: pydantic>=2.0.0
47
+ Requires-Dist: protobuf>=3.20.0
48
+ Requires-Dist: sentencepiece>=0.1.99
49
+ Requires-Dist: safetensors>=0.3.0
50
+ Requires-Dist: python-multipart>=0.0.0
51
+ Requires-Dist: psutil>=5.9.0
52
+ Requires-Dist: jinja2>=3.0.0
53
+ Requires-Dist: peft>=0.10.0
54
+ Requires-Dist: controlnet-aux>=0.0.7
55
+ Requires-Dist: opencv-python>=4.8.0
56
+ Provides-Extra: dev
57
+ Requires-Dist: pytest>=7.0.0; extra == "dev"
58
+ Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
59
+ Requires-Dist: black>=23.0.0; extra == "dev"
60
+ Requires-Dist: isort>=5.12.0; extra == "dev"
61
+ Requires-Dist: flake8>=6.0.0; extra == "dev"
62
+ Dynamic: author
63
+ Dynamic: home-page
64
+ Dynamic: license-file
65
+ Dynamic: requires-python
66
+
67
+ # OllamaDiffuser 🎨
68
+
69
+ [![PyPI version](https://badge.fury.io/py/ollamadiffuser.svg)](https://badge.fury.io/py/ollamadiffuser)
70
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
71
+ [![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/)
72
+
73
+
74
+ ## Local AI Image Generation with OllamaDiffuser
75
+
76
+ **OllamaDiffuser** simplifies local deployment of **Stable Diffusion**, **FLUX.1**, and other AI image generation models. An intuitive **local SD** tool inspired by **Ollama's** simplicity - perfect for **local diffuser** workflows with CLI, web UI, and LoRA support.
77
+
78
+ 🌐 **Website**: [ollamadiffuser.com](https://www.ollamadiffuser.com/) | 📦 **PyPI**: [pypi.org/project/ollamadiffuser](https://pypi.org/project/ollamadiffuser/)
79
+
80
+ ---
81
+
82
+ ## ✨ Features
83
+
84
+ - **🚀 Fast Startup**: Instant application launch with lazy loading architecture
85
+ - **🎛️ ControlNet Support**: Precise image generation control with 10+ control types
86
+ - **🔄 LoRA Integration**: Dynamic LoRA loading and management
87
+ - **🌐 Multiple Interfaces**: CLI, Python API, Web UI, and REST API
88
+ - **📦 Model Management**: Easy installation and switching between models
89
+ - **⚡ Performance Optimized**: Memory-efficient with GPU acceleration
90
+ - **🎨 Professional Results**: High-quality image generation with fine-tuned control
91
+
92
+ ## 🚀 Quick Start
93
+
94
+ ### Option 1: Install from PyPI (Recommended)
95
+ ```bash
96
+ # Install from PyPI
97
+ pip install ollamadiffuser
98
+
99
+ # Pull and run a model (4-command setup)
100
+ ollamadiffuser pull flux.1-schnell
101
+ ollamadiffuser run flux.1-schnell
102
+
103
+ # Generate via API
104
+ curl -X POST http://localhost:8000/api/generate \
105
+ -H "Content-Type: application/json" \
106
+ -d '{"prompt": "A beautiful sunset"}' \
107
+ --output image.png
108
+ ```
109
+
110
+ ### Option 2: Development Installation
111
+ ```bash
112
+ # Clone the repository
113
+ git clone https://github.com/ollamadiffuser/ollamadiffuser.git
114
+ cd ollamadiffuser
115
+
116
+ # Install dependencies
117
+ pip install -e .
118
+ ```
119
+
120
+ ### Basic Usage
121
+ ```bash
122
+ # Install a model
123
+ ollamadiffuser pull stable-diffusion-1.5
124
+
125
+ # Run the model (loads and starts API server)
126
+ ollamadiffuser run stable-diffusion-1.5
127
+
128
+ # Generate an image via API
129
+ curl -X POST http://localhost:8000/api/generate \
130
+ -H "Content-Type: application/json" \
131
+ -d '{"prompt": "a beautiful sunset over mountains"}' \
132
+ --output image.png
133
+
134
+ # Start web interface
135
+ ollamadiffuser --mode ui
136
+
137
+ open http://localhost:8001 in your browser
138
+ ```
139
+
140
+ ### ControlNet Quick Start
141
+ ```bash
142
+ # Install ControlNet model
143
+ ollamadiffuser pull controlnet-canny-sd15
144
+
145
+ # Run ControlNet model (loads and starts API server)
146
+ ollamadiffuser run controlnet-canny-sd15
147
+
148
+ # Generate with control image
149
+ curl -X POST http://localhost:8000/api/generate/controlnet \
150
+ -F "prompt=a beautiful landscape" \
151
+ -F "control_image=@your_image.jpg"
152
+ ```
153
+
154
+ ---
155
+
156
+ ## 🎯 Supported Models
157
+
158
+ Choose from a variety of state-of-the-art image generation models:
159
+
160
+ | Model | License | Quality | Speed | Commercial Use |
161
+ |-------|---------|---------|-------|----------------|
162
+ | **FLUX.1-schnell** | Apache 2.0 | High | **4 steps** (12x faster) | ✅ Commercial OK |
163
+ | **FLUX.1-dev** | Non-commercial | High | 50 steps | ❌ Non-commercial |
164
+ | **Stable Diffusion 3.5** | CreativeML | Medium | 28 steps | ⚠️ Check License |
165
+ | **Stable Diffusion 1.5** | CreativeML | Fast | Lightweight | ⚠️ Check License |
166
+
167
+ ### Why Choose FLUX.1-schnell?
168
+ - **Apache 2.0 license** - Perfect for commercial use
169
+ - **4-step generation** - Lightning fast results
170
+ - **Commercial OK** - Use in your business
171
+
172
+ ---
173
+
174
+ ## 🎛️ ControlNet Features
175
+
176
+ ### ⚡ Lazy Loading Architecture
177
+ **New in v1.1.0**: ControlNet preprocessors use intelligent lazy loading:
178
+
179
+ - **Instant Startup**: `ollamadiffuser --help` runs immediately without downloading models
180
+ - **On-Demand Loading**: Preprocessors initialize only when actually needed
181
+ - **Automatic Initialization**: Seamless loading when uploading control images
182
+ - **User Control**: Manual initialization available for pre-loading
183
+
184
+ ### Available Control Types
185
+ - **Canny Edge Detection**: Structural control with edge maps
186
+ - **Depth Estimation**: 3D structure control with depth maps
187
+ - **OpenPose**: Human pose and body position control
188
+ - **Scribble/Sketch**: Artistic control with hand-drawn inputs
189
+ - **Advanced Types**: HED, MLSD, Normal, Lineart, Anime Lineart, Content Shuffle
190
+
191
+ ### ControlNet Models
192
+ ```bash
193
+ # SD 1.5 ControlNet Models
194
+ ollamadiffuser pull controlnet-canny-sd15
195
+ ollamadiffuser pull controlnet-depth-sd15
196
+ ollamadiffuser pull controlnet-openpose-sd15
197
+ ollamadiffuser pull controlnet-scribble-sd15
198
+
199
+ # SDXL ControlNet Models
200
+ ollamadiffuser pull controlnet-canny-sdxl
201
+ ollamadiffuser pull controlnet-depth-sdxl
202
+ ```
203
+
204
+ ## 🔄 LoRA Support
205
+
206
+ ### Dynamic LoRA Management
207
+ ```bash
208
+ # Download LoRA from Hugging Face
209
+ ollamadiffuser lora pull "openfree/flux-chatgpt-ghibli-lora"
210
+
211
+ # Load LoRA with custom strength
212
+ ollamadiffuser lora load ghibli --scale 1.2
213
+
214
+ # Unload LoRA
215
+ ollamadiffuser lora unload
216
+ ```
217
+
218
+ ### Web UI LoRA Integration
219
+ - **Easy Download**: Enter Hugging Face repository ID
220
+ - **Strength Control**: Adjust LoRA influence with sliders
221
+ - **Real-time Loading**: Load/unload LoRAs without restarting
222
+ - **Alias Support**: Create custom names for your LoRAs
223
+
224
+ ## 🌐 Multiple Interfaces
225
+
226
+ ### Command Line Interface
227
+ ```bash
228
+ # Pull and run a model
229
+ ollamadiffuser pull stable-diffusion-1.5
230
+ ollamadiffuser run stable-diffusion-1.5
231
+
232
+ # In another terminal, generate images via API
233
+ curl -X POST http://localhost:8000/api/generate \
234
+ -H "Content-Type: application/json" \
235
+ -d '{
236
+ "prompt": "a futuristic cityscape",
237
+ "negative_prompt": "blurry, low quality",
238
+ "num_inference_steps": 30,
239
+ "guidance_scale": 7.5,
240
+ "width": 1024,
241
+ "height": 1024
242
+ }' \
243
+ --output image.png
244
+ ```
245
+
246
+ ### Web UI
247
+ ```bash
248
+ # Start web interface
249
+ ollamadiffuser --mode ui
250
+ Open http://localhost:8001
251
+ ```
252
+
253
+ Features:
254
+ - **Responsive Design**: Works on desktop and mobile
255
+ - **Real-time Status**: Model and LoRA loading indicators
256
+ - **ControlNet Integration**: File upload with preprocessing
257
+ - **Parameter Controls**: Intuitive sliders and inputs
258
+
259
+ ### REST API
260
+ ```bash
261
+ # Start API server
262
+ ollamadiffuser --mode api
263
+
264
+ ollamadiffuser load stable-diffusion-1.5
265
+
266
+ # Generate image
267
+ curl -X POST http://localhost:8000/api/generate \
268
+ -H "Content-Type: application/json" \
269
+ -d '{"prompt": "a beautiful landscape", "width": 1024, "height": 1024}'
270
+ ```
271
+
272
+ ### Python API
273
+ ```python
274
+ from ollamadiffuser.core.models.manager import model_manager
275
+
276
+ # Load model
277
+ success = model_manager.load_model("stable-diffusion-1.5")
278
+ if success:
279
+ engine = model_manager.loaded_model
280
+
281
+ # Generate image
282
+ image = engine.generate_image(
283
+ prompt="a beautiful sunset",
284
+ width=1024,
285
+ height=1024
286
+ )
287
+ image.save("output.jpg")
288
+ else:
289
+ print("Failed to load model")
290
+ ```
291
+
292
+ ## 📦 Supported Models
293
+
294
+ ### Base Models
295
+ - **Stable Diffusion 1.5**: Classic, reliable, fast
296
+ - **Stable Diffusion XL**: High-resolution, detailed
297
+ - **Stable Diffusion 3**: Latest architecture
298
+ - **FLUX.1**: State-of-the-art quality
299
+
300
+ ### ControlNet Models
301
+ - **SD 1.5 ControlNet**: 4 control types (canny, depth, openpose, scribble)
302
+ - **SDXL ControlNet**: 2 control types (canny, depth)
303
+
304
+ ### LoRA Support
305
+ - **Hugging Face Integration**: Direct download from HF Hub
306
+ - **Local LoRA Files**: Support for local .safetensors files
307
+ - **Dynamic Loading**: Load/unload without model restart
308
+ - **Strength Control**: Adjustable influence (0.1-2.0)
309
+
310
+ ## ⚙️ Configuration
311
+
312
+ ### Model Configuration
313
+ Models are automatically configured with optimal settings:
314
+ - **Memory Optimization**: Attention slicing, CPU offloading
315
+ - **Device Detection**: Automatic CUDA/MPS/CPU selection
316
+ - **Precision Handling**: FP16/BF16 support for efficiency
317
+ - **Safety Features**: NSFW filter bypass for creative freedom
318
+
319
+ ## 🔧 Advanced Usage
320
+
321
+ ### ControlNet Parameters
322
+ ```python
323
+ # Fine-tune ControlNet behavior
324
+ image = engine.generate_image(
325
+ prompt="architectural masterpiece",
326
+ control_image=control_img,
327
+ controlnet_conditioning_scale=1.2, # Strength (0.0-2.0)
328
+ control_guidance_start=0.0, # When to start (0.0-1.0)
329
+ control_guidance_end=1.0 # When to end (0.0-1.0)
330
+ )
331
+ ```
332
+
333
+ ### Batch Processing
334
+ ```python
335
+ from ollamadiffuser.core.utils.controlnet_preprocessors import controlnet_preprocessor
336
+
337
+ # Pre-initialize for faster processing
338
+ controlnet_preprocessor.initialize()
339
+
340
+ # Process multiple images
341
+ prompt = "beautiful landscape" # Define the prompt
342
+ for i, image_path in enumerate(image_list):
343
+ control_img = controlnet_preprocessor.preprocess(image_path, "canny")
344
+ result = engine.generate_image(prompt, control_image=control_img)
345
+ result.save(f"output_{i}.jpg")
346
+ ```
347
+
348
+ ### API Integration
349
+ ```python
350
+ import requests
351
+
352
+ # Initialize ControlNet preprocessors
353
+ response = requests.post("http://localhost:8000/api/controlnet/initialize")
354
+
355
+ # Check available preprocessors
356
+ response = requests.get("http://localhost:8000/api/controlnet/preprocessors")
357
+ print(response.json()["available_types"])
358
+
359
+ # Generate with file upload
360
+ with open("control.jpg", "rb") as f:
361
+ response = requests.post(
362
+ "http://localhost:8000/api/generate/controlnet",
363
+ data={"prompt": "beautiful landscape"},
364
+ files={"control_image": f}
365
+ )
366
+ ```
367
+
368
+ ## 📚 Documentation & Guides
369
+
370
+ - **[ControlNet Guide](CONTROLNET_GUIDE.md)**: Comprehensive ControlNet usage and examples
371
+ - **[Website Documentation](https://www.ollamadiffuser.com/)**: Complete tutorials and guides
372
+
373
+ ## 🚀 Performance & Hardware
374
+
375
+ ### Minimum Requirements
376
+ - **RAM**: 8GB system RAM
377
+ - **Storage**: 10GB free space
378
+ - **Python**: 3.8+
379
+
380
+ ### Recommended Hardware
381
+ - **GPU**: 8GB+ VRAM (NVIDIA/AMD)
382
+ - **RAM**: 16GB+ system RAM
383
+ - **Storage**: SSD with 50GB+ free space
384
+
385
+ ### Supported Platforms
386
+ - **CUDA**: NVIDIA GPUs (recommended)
387
+ - **MPS**: Apple Silicon (M1/M2/M3)
388
+ - **CPU**: All platforms (slower but functional)
389
+
390
+ ## 🔧 Troubleshooting
391
+
392
+ ### Common Issues
393
+
394
+ #### Slow Startup
395
+ If you experience slow startup, ensure you're using the latest version with lazy loading:
396
+ ```bash
397
+ git pull origin main
398
+ pip install -e .
399
+ ```
400
+
401
+ #### ControlNet Not Working
402
+ ```bash
403
+ # Check preprocessor status
404
+ python -c "
405
+ from ollamadiffuser.core.utils.controlnet_preprocessors import controlnet_preprocessor
406
+ print('Available:', controlnet_preprocessor.is_available())
407
+ print('Initialized:', controlnet_preprocessor.is_initialized())
408
+ "
409
+
410
+ # Manual initialization
411
+ curl -X POST http://localhost:8000/api/controlnet/initialize
412
+ ```
413
+
414
+ #### Memory Issues
415
+ ```bash
416
+ # Use smaller image sizes via API
417
+ curl -X POST http://localhost:8000/api/generate \
418
+ -H "Content-Type: application/json" \
419
+ -d '{"prompt": "test", "width": 512, "height": 512}' \
420
+ --output test.png
421
+
422
+ # CPU offloading is automatic
423
+ # Close other applications to free memory
424
+ # Use basic preprocessors instead of advanced ones
425
+ ```
426
+
427
+ ### Debug Mode
428
+ ```bash
429
+ # Enable verbose logging
430
+ ollamadiffuser --verbose run model-name
431
+ ```
432
+
433
+ ## 🤝 Contributing
434
+
435
+ We welcome contributions! Please check the GitHub repository for contribution guidelines.
436
+
437
+ ## 🤝 Community & Support
438
+
439
+ ### Quick Actions
440
+
441
+ - **🐛 [Report a Bug](https://github.com/ollamadiffuser/ollamadiffuser/issues)** - Found an issue? Let us know
442
+ - **💡 [Feature Request](https://github.com/ollamadiffuser/ollamadiffuser/issues)** - Have an idea? Share it with us
443
+ - **💬 [Join Discussions](https://github.com/ollamadiffuser/ollamadiffuser/discussions)** - Community discussion
444
+ - **⭐ [Star on GitHub](https://github.com/ollamadiffuser/ollamadiffuser)** - Show your support
445
+
446
+ ### Community Driven
447
+
448
+ OllamaDiffuser is an open-source project that thrives on community feedback. Every suggestion, bug report, and contribution helps make it better for everyone.
449
+
450
+ **Open Source** • **Community Driven** • **Actively Maintained**
451
+
452
+ ## 📄 License
453
+
454
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
455
+
456
+ ## 🙏 Acknowledgments
457
+
458
+ - **Stability AI**: For Stable Diffusion models
459
+ - **Hugging Face**: For model hosting and diffusers library
460
+ - **ControlNet Team**: For ControlNet architecture
461
+ - **Community**: For feedback and contributions
462
+
463
+ ## 📞 Support
464
+
465
+ - **Issues**: [GitHub Issues](https://github.com/ollamadiffuser/ollamadiffuser/issues)
466
+ - **Discussions**: [GitHub Discussions](https://github.com/ollamadiffuser/ollamadiffuser/discussions)
467
+
468
+ ---
469
+
470
+ **Ready to get started?** Install from PyPI: `pip install ollamadiffuser` or visit [ollamadiffuser.com](https://www.ollamadiffuser.com/) 🎨✨