ollamadiffuser 1.0.0__tar.gz → 1.1.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.
Files changed (43) hide show
  1. ollamadiffuser-1.1.0/CHANGELOG.md +141 -0
  2. ollamadiffuser-1.1.0/PKG-INFO +485 -0
  3. ollamadiffuser-1.1.0/README.md +419 -0
  4. {ollamadiffuser-1.0.0 → ollamadiffuser-1.1.0}/ollamadiffuser/api/server.py +147 -2
  5. {ollamadiffuser-1.0.0 → ollamadiffuser-1.1.0}/ollamadiffuser/cli/main.py +270 -11
  6. {ollamadiffuser-1.0.0 → ollamadiffuser-1.1.0}/ollamadiffuser/core/inference/engine.py +180 -9
  7. {ollamadiffuser-1.0.0 → ollamadiffuser-1.1.0}/ollamadiffuser/core/models/manager.py +136 -2
  8. ollamadiffuser-1.1.0/ollamadiffuser/core/utils/controlnet_preprocessors.py +317 -0
  9. {ollamadiffuser-1.0.0 → ollamadiffuser-1.1.0}/ollamadiffuser/core/utils/download_utils.py +40 -20
  10. ollamadiffuser-1.1.0/ollamadiffuser/ui/templates/index.html +873 -0
  11. ollamadiffuser-1.1.0/ollamadiffuser/ui/web.py +359 -0
  12. ollamadiffuser-1.1.0/ollamadiffuser.egg-info/PKG-INFO +485 -0
  13. {ollamadiffuser-1.0.0 → ollamadiffuser-1.1.0}/ollamadiffuser.egg-info/SOURCES.txt +1 -0
  14. {ollamadiffuser-1.0.0 → ollamadiffuser-1.1.0}/ollamadiffuser.egg-info/requires.txt +3 -1
  15. {ollamadiffuser-1.0.0 → ollamadiffuser-1.1.0}/pyproject.toml +29 -5
  16. {ollamadiffuser-1.0.0 → ollamadiffuser-1.1.0}/requirements.txt +4 -2
  17. {ollamadiffuser-1.0.0 → ollamadiffuser-1.1.0}/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.0}/LICENSE +0 -0
  25. {ollamadiffuser-1.0.0 → ollamadiffuser-1.1.0}/MANIFEST.in +0 -0
  26. {ollamadiffuser-1.0.0 → ollamadiffuser-1.1.0}/ollamadiffuser/__init__.py +0 -0
  27. {ollamadiffuser-1.0.0 → ollamadiffuser-1.1.0}/ollamadiffuser/__main__.py +0 -0
  28. {ollamadiffuser-1.0.0 → ollamadiffuser-1.1.0}/ollamadiffuser/api/__init__.py +0 -0
  29. {ollamadiffuser-1.0.0 → ollamadiffuser-1.1.0}/ollamadiffuser/cli/__init__.py +0 -0
  30. {ollamadiffuser-1.0.0 → ollamadiffuser-1.1.0}/ollamadiffuser/core/__init__.py +0 -0
  31. {ollamadiffuser-1.0.0 → ollamadiffuser-1.1.0}/ollamadiffuser/core/config/__init__.py +0 -0
  32. {ollamadiffuser-1.0.0 → ollamadiffuser-1.1.0}/ollamadiffuser/core/config/settings.py +0 -0
  33. {ollamadiffuser-1.0.0 → ollamadiffuser-1.1.0}/ollamadiffuser/core/inference/__init__.py +0 -0
  34. {ollamadiffuser-1.0.0 → ollamadiffuser-1.1.0}/ollamadiffuser/core/models/__init__.py +0 -0
  35. {ollamadiffuser-1.0.0 → ollamadiffuser-1.1.0}/ollamadiffuser/core/utils/__init__.py +0 -0
  36. {ollamadiffuser-1.0.0 → ollamadiffuser-1.1.0}/ollamadiffuser/core/utils/lora_manager.py +0 -0
  37. {ollamadiffuser-1.0.0 → ollamadiffuser-1.1.0}/ollamadiffuser/ui/__init__.py +0 -0
  38. {ollamadiffuser-1.0.0 → ollamadiffuser-1.1.0}/ollamadiffuser/utils/__init__.py +0 -0
  39. {ollamadiffuser-1.0.0 → ollamadiffuser-1.1.0}/ollamadiffuser.egg-info/dependency_links.txt +0 -0
  40. {ollamadiffuser-1.0.0 → ollamadiffuser-1.1.0}/ollamadiffuser.egg-info/entry_points.txt +0 -0
  41. {ollamadiffuser-1.0.0 → ollamadiffuser-1.1.0}/ollamadiffuser.egg-info/not-zip-safe +0 -0
  42. {ollamadiffuser-1.0.0 → ollamadiffuser-1.1.0}/ollamadiffuser.egg-info/top_level.txt +0 -0
  43. {ollamadiffuser-1.0.0 → ollamadiffuser-1.1.0}/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,485 @@
1
+ Metadata-Version: 2.4
2
+ Name: ollamadiffuser
3
+ Version: 1.1.0
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
+ ## Local AI Image Generation with OllamaDiffuser
74
+
75
+ **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.
76
+
77
+ 🌐 **Website**: [ollamadiffuser.com](https://www.ollamadiffuser.com/) | 📦 **PyPI**: [pypi.org/project/ollamadiffuser](https://pypi.org/project/ollamadiffuser/)
78
+
79
+ ---
80
+
81
+ ## ✨ Features
82
+
83
+ - **🚀 Fast Startup**: Instant application launch with lazy loading architecture
84
+ - **🎛️ ControlNet Support**: Precise image generation control with 10+ control types
85
+ - **🔄 LoRA Integration**: Dynamic LoRA loading and management
86
+ - **🌐 Multiple Interfaces**: CLI, Python API, Web UI, and REST API
87
+ - **📦 Model Management**: Easy installation and switching between models
88
+ - **⚡ Performance Optimized**: Memory-efficient with GPU acceleration
89
+ - **🎨 Professional Results**: High-quality image generation with fine-tuned control
90
+
91
+ ## 🚀 Quick Start
92
+
93
+ ### Option 1: Install from PyPI (Recommended)
94
+ ```bash
95
+ # Install from PyPI
96
+ pip install ollamadiffuser
97
+
98
+ # Pull and run a model (4-command setup)
99
+ ollamadiffuser pull flux.1-schnell
100
+ ollamadiffuser run flux.1-schnell
101
+
102
+ # Generate via API
103
+ curl -X POST http://localhost:8000/api/generate \
104
+ -H "Content-Type: application/json" \
105
+ -d '{"prompt": "A beautiful sunset"}' \
106
+ --output image.png
107
+ ```
108
+
109
+ ### Option 2: Development Installation
110
+ ```bash
111
+ # Clone the repository
112
+ git clone https://github.com/yourusername/ollamadiffuser.git
113
+ cd ollamadiffuser
114
+
115
+ # Install dependencies
116
+ pip install -e .
117
+ ```
118
+
119
+ ### Basic Usage
120
+ ```bash
121
+ # Install a model
122
+ ollamadiffuser pull stable-diffusion-1.5
123
+
124
+ # Load the model
125
+ ollamadiffuser load stable-diffusion-1.5
126
+
127
+ # Generate an image
128
+ ollamadiffuser generate "a beautiful sunset over mountains"
129
+
130
+ # Start web interface
131
+ ollamadiffuser --mode ui
132
+ ```
133
+
134
+ ### ControlNet Quick Start
135
+ ```bash
136
+ # Install ControlNet model
137
+ ollamadiffuser pull controlnet-canny-sd15
138
+
139
+ # Load ControlNet model
140
+ ollamadiffuser load controlnet-canny-sd15
141
+
142
+ # Generate with control image
143
+ curl -X POST http://localhost:8000/api/generate/controlnet \
144
+ -F "prompt=a beautiful landscape" \
145
+ -F "control_image=@your_image.jpg"
146
+ ```
147
+
148
+ ---
149
+
150
+ ## 🎯 Supported Models
151
+
152
+ Choose from a variety of state-of-the-art image generation models:
153
+
154
+ | Model | License | Quality | Speed | Commercial Use |
155
+ |-------|---------|---------|-------|----------------|
156
+ | **FLUX.1-schnell** | Apache 2.0 | High | **4 steps** (12x faster) | ✅ Commercial OK |
157
+ | **FLUX.1-dev** | Non-commercial | High | 50 steps | ❌ Non-commercial |
158
+ | **Stable Diffusion 3.5** | CreativeML | Medium | 28 steps | ⚠️ Check License |
159
+ | **Stable Diffusion 1.5** | CreativeML | Fast | Lightweight | ⚠️ Check License |
160
+
161
+ ### Why Choose FLUX.1-schnell?
162
+ - **Apache 2.0 license** - Perfect for commercial use
163
+ - **4-step generation** - Lightning fast results
164
+ - **Commercial OK** - Use in your business
165
+
166
+ ---
167
+
168
+ ## 🎛️ ControlNet Features
169
+
170
+ ### ⚡ Lazy Loading Architecture
171
+ **New in v1.1.0**: ControlNet preprocessors use intelligent lazy loading:
172
+
173
+ - **Instant Startup**: `ollamadiffuser --help` runs immediately without downloading models
174
+ - **On-Demand Loading**: Preprocessors initialize only when actually needed
175
+ - **Automatic Initialization**: Seamless loading when uploading control images
176
+ - **User Control**: Manual initialization available for pre-loading
177
+
178
+ ### Available Control Types
179
+ - **Canny Edge Detection**: Structural control with edge maps
180
+ - **Depth Estimation**: 3D structure control with depth maps
181
+ - **OpenPose**: Human pose and body position control
182
+ - **Scribble/Sketch**: Artistic control with hand-drawn inputs
183
+ - **Advanced Types**: HED, MLSD, Normal, Lineart, Anime Lineart, Content Shuffle
184
+
185
+ ### ControlNet Models
186
+ ```bash
187
+ # SD 1.5 ControlNet Models
188
+ ollamadiffuser pull controlnet-canny-sd15
189
+ ollamadiffuser pull controlnet-depth-sd15
190
+ ollamadiffuser pull controlnet-openpose-sd15
191
+ ollamadiffuser pull controlnet-scribble-sd15
192
+
193
+ # SDXL ControlNet Models
194
+ ollamadiffuser pull controlnet-canny-sdxl
195
+ ollamadiffuser pull controlnet-depth-sdxl
196
+ ```
197
+
198
+ ## 🔄 LoRA Support
199
+
200
+ ### Dynamic LoRA Management
201
+ ```bash
202
+ # Download LoRA from Hugging Face
203
+ ollamadiffuser lora pull "openfree/flux-chatgpt-ghibli-lora"
204
+
205
+ # Load LoRA with custom strength
206
+ ollamadiffuser lora load ghibli --scale 1.2
207
+
208
+ # Unload LoRA
209
+ ollamadiffuser lora unload
210
+ ```
211
+
212
+ ### Web UI LoRA Integration
213
+ - **Easy Download**: Enter Hugging Face repository ID
214
+ - **Strength Control**: Adjust LoRA influence with sliders
215
+ - **Real-time Loading**: Load/unload LoRAs without restarting
216
+ - **Alias Support**: Create custom names for your LoRAs
217
+
218
+ ## 🌐 Multiple Interfaces
219
+
220
+ ### Command Line Interface
221
+ ```bash
222
+ # Generate with advanced parameters
223
+ ollamadiffuser generate \
224
+ "a futuristic cityscape" \
225
+ --negative-prompt "blurry, low quality" \
226
+ --steps 30 \
227
+ --guidance 7.5 \
228
+ --width 1024 \
229
+ --height 1024
230
+ ```
231
+
232
+ ### Web UI
233
+ ```bash
234
+ # Start web interface
235
+ ollamadiffuser --mode ui
236
+ # Open http://localhost:8001
237
+ ```
238
+
239
+ Features:
240
+ - **Responsive Design**: Works on desktop and mobile
241
+ - **Real-time Status**: Model and LoRA loading indicators
242
+ - **ControlNet Integration**: File upload with preprocessing
243
+ - **Parameter Controls**: Intuitive sliders and inputs
244
+
245
+ ### REST API
246
+ ```bash
247
+ # Start API server
248
+ ollamadiffuser --mode api
249
+
250
+ # Generate image
251
+ curl -X POST http://localhost:8000/api/generate \
252
+ -H "Content-Type: application/json" \
253
+ -d '{"prompt": "a beautiful landscape", "width": 1024, "height": 1024}'
254
+ ```
255
+
256
+ ### Python API
257
+ ```python
258
+ from ollamadiffuser.core.models.manager import model_manager
259
+
260
+ # Load model
261
+ model_manager.load_model("stable-diffusion-1.5")
262
+ engine = model_manager.loaded_model
263
+
264
+ # Generate image
265
+ image = engine.generate_image(
266
+ prompt="a beautiful sunset",
267
+ width=1024,
268
+ height=1024
269
+ )
270
+ image.save("output.jpg")
271
+ ```
272
+
273
+ ## 📦 Supported Models
274
+
275
+ ### Base Models
276
+ - **Stable Diffusion 1.5**: Classic, reliable, fast
277
+ - **Stable Diffusion XL**: High-resolution, detailed
278
+ - **Stable Diffusion 3**: Latest architecture
279
+ - **FLUX.1**: State-of-the-art quality
280
+
281
+ ### ControlNet Models
282
+ - **SD 1.5 ControlNet**: 4 control types (canny, depth, openpose, scribble)
283
+ - **SDXL ControlNet**: 2 control types (canny, depth)
284
+
285
+ ### LoRA Support
286
+ - **Hugging Face Integration**: Direct download from HF Hub
287
+ - **Local LoRA Files**: Support for local .safetensors files
288
+ - **Dynamic Loading**: Load/unload without model restart
289
+ - **Strength Control**: Adjustable influence (0.1-2.0)
290
+
291
+ ## ⚙️ Configuration
292
+
293
+ ### Model Configuration
294
+ Models are automatically configured with optimal settings:
295
+ - **Memory Optimization**: Attention slicing, CPU offloading
296
+ - **Device Detection**: Automatic CUDA/MPS/CPU selection
297
+ - **Precision Handling**: FP16/BF16 support for efficiency
298
+ - **Safety Features**: NSFW filter bypass for creative freedom
299
+
300
+ ### Performance Tuning
301
+ ```bash
302
+ # Enable verbose logging
303
+ ollamadiffuser -v generate "test prompt"
304
+
305
+ # Check system status
306
+ ollamadiffuser status
307
+
308
+ # Monitor memory usage
309
+ ollamadiffuser info
310
+ ```
311
+
312
+ ## 🔧 Advanced Usage
313
+
314
+ ### ControlNet Parameters
315
+ ```python
316
+ # Fine-tune ControlNet behavior
317
+ image = engine.generate_image(
318
+ prompt="architectural masterpiece",
319
+ control_image=control_img,
320
+ controlnet_conditioning_scale=1.2, # Strength (0.0-2.0)
321
+ control_guidance_start=0.0, # When to start (0.0-1.0)
322
+ control_guidance_end=1.0 # When to end (0.0-1.0)
323
+ )
324
+ ```
325
+
326
+ ### Batch Processing
327
+ ```python
328
+ from ollamadiffuser.core.utils.controlnet_preprocessors import controlnet_preprocessor
329
+
330
+ # Pre-initialize for faster processing
331
+ controlnet_preprocessor.initialize()
332
+
333
+ # Process multiple images
334
+ for image_path in image_list:
335
+ control_img = controlnet_preprocessor.preprocess(image, "canny")
336
+ result = engine.generate_image(prompt, control_image=control_img)
337
+ result.save(f"output_{i}.jpg")
338
+ ```
339
+
340
+ ### API Integration
341
+ ```python
342
+ import requests
343
+
344
+ # Initialize ControlNet preprocessors
345
+ response = requests.post("http://localhost:8000/api/controlnet/initialize")
346
+
347
+ # Check available preprocessors
348
+ response = requests.get("http://localhost:8000/api/controlnet/preprocessors")
349
+ print(response.json()["available_types"])
350
+
351
+ # Generate with file upload
352
+ with open("control.jpg", "rb") as f:
353
+ response = requests.post(
354
+ "http://localhost:8000/api/generate/controlnet",
355
+ data={"prompt": "beautiful landscape"},
356
+ files={"control_image": f}
357
+ )
358
+ ```
359
+
360
+ ## 📚 Documentation & Guides
361
+
362
+ - **[ControlNet Guide](CONTROLNET_GUIDE.md)**: Comprehensive ControlNet usage and examples
363
+ - **[LoRA Guide](LORA_GUIDE.md)**: LoRA management and best practices
364
+ - **[API Reference](API_REFERENCE.md)**: Complete API documentation
365
+ - **[Website Documentation](https://www.ollamadiffuser.com/)**: Complete tutorials and guides
366
+
367
+ ## 🚀 Performance & Hardware
368
+
369
+ ### Minimum Requirements
370
+ - **RAM**: 8GB system RAM
371
+ - **Storage**: 10GB free space
372
+ - **Python**: 3.8+
373
+
374
+ ### Recommended Hardware
375
+ - **GPU**: 8GB+ VRAM (NVIDIA/AMD)
376
+ - **RAM**: 16GB+ system RAM
377
+ - **Storage**: SSD with 50GB+ free space
378
+
379
+ ### Supported Platforms
380
+ - **CUDA**: NVIDIA GPUs (recommended)
381
+ - **MPS**: Apple Silicon (M1/M2/M3)
382
+ - **CPU**: All platforms (slower but functional)
383
+
384
+ ## 🔧 Troubleshooting
385
+
386
+ ### Common Issues
387
+
388
+ #### Slow Startup
389
+ If you experience slow startup, ensure you're using the latest version with lazy loading:
390
+ ```bash
391
+ git pull origin main
392
+ pip install -e .
393
+ ```
394
+
395
+ #### ControlNet Not Working
396
+ ```bash
397
+ # Check preprocessor status
398
+ python -c "
399
+ from ollamadiffuser.core.utils.controlnet_preprocessors import controlnet_preprocessor
400
+ print('Available:', controlnet_preprocessor.is_available())
401
+ print('Initialized:', controlnet_preprocessor.is_initialized())
402
+ "
403
+
404
+ # Manual initialization
405
+ curl -X POST http://localhost:8000/api/controlnet/initialize
406
+ ```
407
+
408
+ #### Memory Issues
409
+ ```bash
410
+ # Use smaller image sizes
411
+ ollamadiffuser generate "test" --width 512 --height 512
412
+
413
+ # Enable CPU offloading (automatic)
414
+ # Close other applications
415
+ # Use basic preprocessors instead of advanced ones
416
+ ```
417
+
418
+ ### Debug Mode
419
+ ```bash
420
+ # Enable verbose logging
421
+ ollamadiffuser -v run model-name
422
+
423
+ # Check system information
424
+ ollamadiffuser info
425
+
426
+ # Validate installation
427
+ ollamadiffuser doctor
428
+ ```
429
+
430
+ ## 🤝 Contributing
431
+
432
+ We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details.
433
+
434
+ ### Development Setup
435
+ ```bash
436
+ # Clone repository
437
+ git clone https://github.com/yourusername/ollamadiffuser.git
438
+ cd ollamadiffuser
439
+
440
+ # Install in development mode
441
+ pip install -e ".[dev]"
442
+
443
+ # Run tests
444
+ pytest tests/
445
+
446
+ # Run linting
447
+ flake8 ollamadiffuser/
448
+ black ollamadiffuser/
449
+ ```
450
+
451
+ ## 🤝 Community & Support
452
+
453
+ ### Quick Actions
454
+
455
+ - **🐛 [Report a Bug](https://github.com/ollamadiffuser/ollamadiffuser/issues)** - Found an issue? Let us know
456
+ - **💡 [Feature Request](https://github.com/ollamadiffuser/ollamadiffuser/issues)** - Have an idea? Share it with us
457
+ - **💬 [Join Discussions](https://github.com/ollamadiffuser/ollamadiffuser/discussions)** - Community discussion
458
+ - **⭐ [Star on GitHub](https://github.com/ollamadiffuser/ollamadiffuser)** - Show your support
459
+
460
+ ### Community Driven
461
+
462
+ OllamaDiffuser is an open-source project that thrives on community feedback. Every suggestion, bug report, and contribution helps make it better for everyone.
463
+
464
+ **Open Source** • **Community Driven** • **Actively Maintained**
465
+
466
+ ## 📄 License
467
+
468
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
469
+
470
+ ## 🙏 Acknowledgments
471
+
472
+ - **Stability AI**: For Stable Diffusion models
473
+ - **Hugging Face**: For model hosting and diffusers library
474
+ - **ControlNet Team**: For ControlNet architecture
475
+ - **Community**: For feedback and contributions
476
+
477
+ ## 📞 Support
478
+
479
+ - **Documentation**: [Full documentation](docs/)
480
+ - **Issues**: [GitHub Issues](https://github.com/yourusername/ollamadiffuser/issues)
481
+ - **Discussions**: [GitHub Discussions](https://github.com/yourusername/ollamadiffuser/discussions)
482
+
483
+ ---
484
+
485
+ **Ready to get started?** Install from PyPI: `pip install ollamadiffuser` or visit [ollamadiffuser.com](https://www.ollamadiffuser.com/) 🎨✨