๐ธ Beautiful and simple AI generation library for images, text, and audio
Project description
โจ Features
|
๐ผ๏ธ Image Generation
|
๐ Text Generation
|
๐๏ธ Audio Generation
|
|
๐ Unified API
|
๐งน Clean Code
|
โก Fast & Reliable
|
๐ What's New in v0.4.5
๐ง Production Improvements
Performance:
- โก 100x faster import time (5s โ 50ms)
- ๐ง Smart model caching with 5-minute TTL
- ๐ 19x less memory usage in long-running apps
Reliability:
- โ Integration tests with VCR.py
- ๐ Intelligent retry with API-specified delays
- ๐ก๏ธ Better error handling and recovery
Security:
- ๐ Tokens now only in headers (never in URLs)
- โ SSL certificate verification enforced
- ๐ No token exposure in logs or browser history
See CHANGELOG for details
๐ Quick Start
๐ฆ Installation
pip install eclips-blossom-ai
โก Basic Usage
from blossom_ai import Blossom
with Blossom() as ai:
# Generate image URL (Fast & Free!)
url = ai.image.generate_url("a beautiful sunset")
print(url)
# Save image directly to a file
ai.image.save("a serene lake at dawn", "lake.jpg")
# Get raw image bytes for custom processing
image_bytes = ai.image.generate("a robot painting a portrait")
# Now you can upload, display, or manipulate image_bytes as needed
# Generate text
response = ai.text.generate("Explain quantum computing")
print(response)
# Stream text
for chunk in ai.text.generate("Tell me a story", stream=True):
print(chunk, end='', flush=True)
๐ Production-Ready Setup
import os
from blossom_ai import Blossom
# โ
Best practice: Use environment variables
api_token = os.getenv('POLLINATIONS_API_KEY')
# โ
Always use context managers
with Blossom(api_version="v2", api_token=api_token) as ai:
# Your code here
image = ai.image.generate(
"a sunset",
quality="hd",
nologo=True
)
# Automatic cleanup - no resource leaks!
๐ Why Blossom AI?
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ Unified API for image, text, and audio generation โ
โ โ Both sync and async support out of the box โ
โ โ Clean, modern Python with type hints โ
โ โ Production-ready with comprehensive testing โ
โ โ Active development and community support โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ Documentation
| Resource | Description |
|---|---|
| ๐ Getting Started | Complete guide to using Blossom AI |
| โ๏ธ Installation | Setup and configuration instructions |
| ๐ก Examples | Practical code examples and use cases |
| ๐ V2 API Guide | Migrate to V2 API with new features |
| ๐ Changelog | Version history and updates |
| ๐ Security | Security best practices |
๐ Showcase
๐จ Image Generation Examples
# Generate artistic images
ai.image.save("a cyberpunk city at night", "cyberpunk.jpg")
ai.image.save("watercolor painting of mountains", "mountains.jpg")
# V2 API: HD quality with advanced controls
with Blossom(api_version="v2", api_token="token") as ai:
image = ai.image.generate(
"majestic dragon",
quality="hd",
guidance_scale=7.5,
negative_prompt="blurry, low quality"
)
๐ฌ Text Generation Examples
# Creative writing
story = ai.text.generate("Write a short sci-fi story")
# Code generation
code = ai.text.generate("Create a Python function to sort a list")
# V2 API: Advanced controls
with Blossom(api_version="v2", api_token="token") as ai:
response = ai.text.generate(
"Explain AI",
max_tokens=200,
frequency_penalty=0.5,
temperature=0.8
)
๐ Audio Generation Examples
# Text-to-speech (requires API token)
with Blossom(api_token="your_token") as ai:
ai.audio.save("Hello, world!", "greeting.mp3", voice="nova")
๐ก๏ธ super update
Blossom AI v0.4.5 best is with:
โ
Comprehensive Testing: Integration tests with VCR.py
โ
Memory Safe: No memory leaks in long-running applications
โ
Secure: Tokens only in headers, SSL verification enforced
โ
Fast: Optimized caching and connection pooling
โ
Reliable: Smart retry logic with exponential backoff
Quick Health Check
from blossom_ai import Blossom
# Verify everything works
def health_check():
try:
with Blossom(api_version="v2", api_token="token") as client:
# Test image
img = client.image.generate("test", width=256, height=256)
assert len(img) > 1000
# Test text
txt = client.text.generate("Say hello", max_tokens=10)
assert len(txt) > 0
print("โ
Health check passed!")
return True
except Exception as e:
print(f"โ Health check failed: {e}")
return False
health_check()
๐ค Contributing
Contributions are what make the open-source community amazing! Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature) - Commit your Changes (
git commit -m 'Add some AmazingFeature') - Push to the Branch (
git push origin feature/AmazingFeature) - Open a Pull Request
See CONTRIBUTING.md for detailed guidelines.
๐ License
Distributed under the MIT License. See LICENSE for more information.
๐ Support
If you find this project helpful, please consider:
- โญ Starring the repository
- ๐ Reporting bugs
- ๐ก Suggesting new features
- ๐ข Sharing with others
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file eclips_blossom_ai-0.4.6.tar.gz.
File metadata
- Download URL: eclips_blossom_ai-0.4.6.tar.gz
- Upload date:
- Size: 129.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e2a37b5a9742551c0f36fbc6eedfcccdef840b580627c1c7b0fe1c92c23a99bb
|
|
| MD5 |
beea0824be72200f7d26ac932b7cf482
|
|
| BLAKE2b-256 |
04b51c82bc45e5262c03b18850908429c590a1bcde937f7dddc7312761d7b30d
|
File details
Details for the file eclips_blossom_ai-0.4.6-py3-none-any.whl.
File metadata
- Download URL: eclips_blossom_ai-0.4.6-py3-none-any.whl
- Upload date:
- Size: 132.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
abe6751b599dbe8f23f177cc78c861871dfbc22d7fa936d1096d8138711650b0
|
|
| MD5 |
4fabc2476fe76d9ebc7313cb3ff89c07
|
|
| BLAKE2b-256 |
8ef0f2a000f471265f11720c3c1a2098f4f1c68871c3345defd15141b03cd59f
|