{"id":28234114,"url":"https://github.com/leopedroso45/stable-diffusion-imagegen","last_synced_at":"2025-08-12T10:08:02.287Z","repository":{"id":214515994,"uuid":"736702411","full_name":"leopedroso45/Stable-Diffusion-ImageGen","owner":"leopedroso45","description":"A Python package to make Stable Diffusion Image Generation ridiculously easy","archived":false,"fork":false,"pushed_at":"2024-07-01T22:17:56.000Z","size":79,"stargazers_count":13,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-18T22:13:05.318Z","etag":null,"topics":["huggingface","ml","python","python3","pytorch","script","stablediffusion"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/leopedroso45.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-12-28T16:19:12.000Z","updated_at":"2025-04-27T05:50:16.000Z","dependencies_parsed_at":"2024-01-02T03:31:26.700Z","dependency_job_id":"b423d21f-374f-41e2-8198-54d59c4e0fdf","html_url":"https://github.com/leopedroso45/Stable-Diffusion-ImageGen","commit_stats":null,"previous_names":["leopedroso45/stable-diffusion-imagegen"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/leopedroso45/Stable-Diffusion-ImageGen","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leopedroso45%2FStable-Diffusion-ImageGen","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leopedroso45%2FStable-Diffusion-ImageGen/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leopedroso45%2FStable-Diffusion-ImageGen/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leopedroso45%2FStable-Diffusion-ImageGen/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/leopedroso45","download_url":"https://codeload.github.com/leopedroso45/Stable-Diffusion-ImageGen/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leopedroso45%2FStable-Diffusion-ImageGen/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259533643,"owners_count":22872427,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["huggingface","ml","python","python3","pytorch","script","stablediffusion"],"created_at":"2025-05-18T22:13:02.723Z","updated_at":"2025-06-12T21:31:09.753Z","avatar_url":"https://github.com/leopedroso45.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Easy Stable Diffusion Image Generation\n\n![Build Status](https://github.com/leopedroso45/Stable-Diffusion-ImageGen/actions/workflows/python-package.yml/badge.svg)\n[![codecov](https://codecov.io/gh/leopedroso45/Stable-Diffusion-ImageGen/branch/main/graph/badge.svg?token=YOUR_TOKEN)](https://codecov.io/gh/leopedroso45/Stable-Diffusion-ImageGen)\n![License](https://img.shields.io/github/license/leopedroso45/Stable-Diffusion-ImageGen)\n\n`sevsd` is a Python package specifically designed to make the process of generating images using Stable Diffusion models as simple as possible. The package enables image generation with just a single function call, greatly simplifying the integration of Stable Diffusion into various applications. Utilizing Hugging Face's `diffusers` library, `sevsd` provides an intuitive and flexible interface for generating images based on textual prompts. This makes it an ideal choice for building HTTP APIs, high-level services, or any application requiring AI-driven image generation.\n\n## Features\n\n- Simplified interface for Stable Diffusion image generation, enabling the creation of images with just a single function call.\n- Easy integration of Stable Diffusion model into Python applications.\n- Customizable image generation based on user-defined tasks and configurations.\n- Batch processing capabilities for handling multiple tasks efficiently.\n- Compatibility with CUDA-enabled GPUs and MPS (Apple's Metal Performance Shaders) for enhanced performance.\n\n## Requirements\n\n- Python 3.11+\n- PyTorch\n- Hugging Face `diffusers` library\n- CUDA-compatible GPU (recommended for better performance)\n\n## Installation\n\n### Install from PyPI\n\nYou can install `sevsd` directly from PyPI. This is the recommended way to install the package as it will always provide you with the latest stable version:\n\n```bash\npip install sevsd\n```\n\n### Install from Source\n\nIf you prefer to install `sevsd` from the source, for example, to get the latest changes that may not be released on PyPI yet, you can clone the repository and install it manually:\n\n```bash\ngit clone https://github.com/leopedroso45/Stable-Diffusion-ImageGen\ncd Stable-Diffusion-ImageGen\npip install .\n```\n\nNote: When installing from source, make sure you have the necessary build tools and dependencies installed on your system.\n\n## Usage\n\nImport and use `sevsd` in your Python project:\n\n```python\nfrom sevsd import do_work\n\n# Define your models and jobs\nmodels = [\n    {\n        \"name\": './model_cache/model1.safetensors',\n        \"executor\": {\n            \"labels\": [1],\n            \"num_of_exec\": 1,\n            \"cfg_scale\": 7,\n            \"inference_steps\": 100,\n        }\n    },\n    {\n        \"name\": './model_cache/model2.safetensors',\n        \"executor\": {\n            \"labels\": [2],\n            \"num_of_exec\": 2,\n            \"cfg_scale\": 6,\n            \"inference_steps\": 50,\n        }\n    },\n]\n\njobs = [\n    {\n        \"label\": 1,\n        \"prompt\": 'A scenic landscape',\n        \"negative_prompt\": \"blurred image, black and white, watermarked image\",\n    },\n    {\n        \"label\": 2,\n        \"prompt\": 'A person wearing a mask',\n        \"negative_prompt\": 'deformed anatomy, hand-drawn image, blurred image',\n    },\n]\n\ndo_work(models, jobs, './generated-images')\n```\n\nThis example demonstrates a basic usage scenario. Customize the `models` and `jobs` as needed for your application.\n\n## Components\n\n- `setup_pipeline`: Prepares the Stable Diffusion pipeline with the specified model configuration.\n- `process_task`: Processes individual tasks, generating and saving images based on job specifications.\n- `generate_image`: Handles the image generation process for each job.\n- `setup_device`: Sets up the computation device (GPU or CPU) for image generation.\n- `check_os_path`: Ensures the output path exists or creates it.\n- `check_cuda_and_clear_cache`: Manages GPU memory and cache for efficient processing.\n- `do_work`: Central function to orchestrate the processing of jobs with corresponding models.\n\n## Customization\n\nYou can customize the image generation process by adjusting the `models` and `jobs` lists. Define different prompts, model paths, execution parameters, and more to cater to diverse image styles and requirements.\n\n## Note\n\n- Ensure sufficient GPU memory if using CUDA.\n- The package is optimized for flexible handling of various job and model configurations.\n- For detailed examples and advanced usage, refer to the source code documentation.\n\n## Contributing\n\nContributions to `sevsd` are welcome! Please refer to the repository's issues and pull requests for ongoing development.\n\n## License\n\n`sevsd` is licensed under the [MIT License](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleopedroso45%2Fstable-diffusion-imagegen","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleopedroso45%2Fstable-diffusion-imagegen","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleopedroso45%2Fstable-diffusion-imagegen/lists"}