๐ธ Beautiful and simple AI generation library for images, text, and audio
Project description
๐ธ Blossom AI
๐ Quick Start โข ๐ Documentation โข ๐ฅ๏ธ CLI Interface โข ๐ก Examples โข ๐ Changelog
โจ Features
|
๐ผ๏ธ HD Image Generation
|
๐ฌ Advanced Text Generation
|
๐๏ธ Vision & Multimodal
|
|
๐ฅ๏ธ CLI Interface
|
๐ Production Ready
|
โก Fast & Secure
|
๐ What's New in v0.5.0
๐๏ธ Vision Support (NEW!)
Analyze images with AI:
- ๐ Image analysis from URLs or local files
- ๐จ Multiple images in one request
- ๐ Adjustable detail levels (low/auto/high)
- ๐ค Works with vision-capable models
from blossom_ai import Blossom, MessageBuilder
with Blossom(api_token="token") as client:
messages = [
MessageBuilder.image(
role="user",
text="What's in this image?",
image_url="https://example.com/image.jpg",
detail="high"
)
]
response = client.text.chat(messages, model="openai")
print(response)
๐จ Enhanced Image Generation
Advanced image controls:
- ๐ฏ Quality levels:
low,medium,high,hd - ๐จ Guidance scale control (1.0-20.0)
- ๐ซ Negative prompts for better control
- ๐ Transparent background support
- ๐ผ๏ธ Image-to-image transformation
- โก Fast URL generation (no download needed)
with Blossom(api_token="token") as client:
# HD quality with advanced controls
image = client.image.generate(
"majestic dragon",
quality="hd",
guidance_scale=7.5,
negative_prompt="blurry, low quality",
width=1920,
height=1080
)
๐ Advanced Text Features
Powerful text generation:
- ๐ ๏ธ Function calling / Tool use
- ๐ Structured JSON output
- โ๏ธ Advanced parameters:
max_tokens,frequency_penalty,presence_penalty,top_p - ๐ Improved streaming with SSE
- ๐ก๏ธ Extended temperature range (0-2)
- ๐ฌ Multi-turn conversations
with Blossom(api_token="token") as client:
response = client.text.generate(
"Explain quantum computing",
max_tokens=500,
temperature=0.8,
frequency_penalty=0.5,
json_mode=True
)
๐ Quick Start
๐ฆ Installation
pip install eclips-blossom-ai
๐ฅ๏ธ CLI Interface
Perfect for quick testing and learning:
# Launch interactive menu
python -m blossom_ai.utils.cli
# Quick commands
python -m blossom_ai.utils.cli --image "a beautiful sunset" --output sunset.png
python -m blossom_ai.utils.cli --text "Explain quantum computing"
# Set API token (optional for some features)
export POLLINATIONS_API_KEY="your_token"
python -m blossom_ai.utils.cli
Interactive Menu:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ๐ธ BLOSSOM AI CLI ๐ธ โ
โ Simple interface for AI generation โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
1. ๐ผ๏ธ Generate Image
2. ๐ฌ Generate Text
3. ๐๏ธ Analyze Image (Vision)
4. โน๏ธ Show Available Models
5. ๐ช Exit
๐ Full CLI Documentation โ
โก Python Library
from blossom_ai import Blossom
import os
api_token = os.getenv('POLLINATIONS_API_KEY')
# Simple usage
with Blossom(api_token=api_token) as ai:
# Generate image URL
url = ai.image.generate_url("a beautiful sunset")
print(url)
# Save image directly
ai.image.save("a serene lake at dawn", "lake.jpg")
# Generate text
response = ai.text.generate("Explain quantum computing")
print(response)
# Stream text in real-time
for chunk in ai.text.generate("Tell me a story", stream=True):
print(chunk, end='', flush=True)
๐ฏ With API Token (Advanced Features)
import os
from blossom_ai import Blossom
# โ
Best practice: Use environment variables
api_token = os.getenv('POLLINATIONS_API_KEY')
with Blossom(api_token=api_token) as client:
# HD image with advanced controls
image = client.image.generate(
"majestic dragon",
quality="hd",
guidance_scale=7.5,
negative_prompt="blurry, low quality",
width=1920,
height=1080
)
# Advanced text generation
response = client.text.generate(
"Explain AI",
max_tokens=200,
frequency_penalty=0.5,
temperature=0.8
)
# Vision analysis (requires token)
from blossom_ai import MessageBuilder
messages = [
MessageBuilder.image(
role="user",
text="Describe this image",
image_url="https://example.com/photo.jpg"
)
]
analysis = client.text.chat(messages, model="openai")
print(analysis)
# Automatic cleanup - no resource leaks!
๐ Why Blossom AI?
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ CLI Interface for quick terminal access โ
โ โ Vision & multimodal support (images + text) โ
โ โ HD image generation with advanced controls โ
โ โ Function calling and structured outputs โ
โ โ Both sync and async support out of the box โ
โ โ Clean, modern Python with type hints โ
โ โ Production-ready with comprehensive testing โ
โ โ Smart caching and optimization utilities โ
โ โ Secure: tokens in headers only, SSL enforced โ
โ โ Active development and community support โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ฏ Choose Your Style
๐ฅ๏ธ CLI (Terminal)Perfect for:
python -m blossom_ai.utils.cli \
--image "sunset" \
--output sunset.png
|
๐ Library (Python)Perfect for:
from blossom_ai import Blossom
with Blossom() as ai:
ai.image.save("sunset", "sunset.png")
|
๐ Documentation
| Resource | Description |
|---|---|
| ๐ Getting Started | Complete guide to using Blossom AI |
| ๐ฅ๏ธ CLI Interface | Terminal interface documentation |
| ๐๏ธ Vision Guide | Vision and multimodal features |
| ๐จ Image Generation | HD images with advanced controls |
| ๐ฌ Text Generation | Advanced text generation features |
| โ๏ธ Installation | Setup and configuration |
| ๐ก Examples | Practical code examples |
| ๐ Web Apps | Build FastAPI/Flask applications |
| ๐ Changelog | Version history and updates |
| ๐ Security | Security best practices |
๐ Showcase
๐จ Image Generation Examples
CLI:
# Quick generation
python -m blossom_ai.utils.cli --image "cyberpunk city" --output city.png
# HD quality with custom size
python -m blossom_ai.utils.cli \
--image "mountain landscape" \
--width 1920 \
--height 1080 \
--quality hd \
--output landscape.png
Python:
# Simple and fast
with Blossom() as ai:
ai.image.save("a cyberpunk city at night", "cyberpunk.jpg")
ai.image.save("watercolor painting of mountains", "mountains.jpg")
# HD quality with advanced controls
with Blossom(api_token="token") as ai:
image = ai.image.generate(
"majestic dragon breathing fire",
quality="hd",
guidance_scale=7.5,
negative_prompt="blurry, low quality, distorted",
width=1920,
height=1080,
seed=42 # Reproducible results
)
๐ฌ Text Generation Examples
CLI:
# Quick text generation
python -m blossom_ai.utils.cli --text "Write a haiku about AI"
# With streaming for real-time output
python -m blossom_ai.utils.cli --text "Tell me a story" --stream
Python:
# Creative writing
story = ai.text.generate("Write a short sci-fi story about time travel")
# Code generation
code = ai.text.generate("Create a Python function to sort a list")
# Advanced controls
response = ai.text.generate(
"Explain quantum computing for beginners",
max_tokens=500,
temperature=0.8,
frequency_penalty=0.5,
stream=True # Real-time streaming
)
# Structured JSON output
json_data = ai.text.generate(
"List 5 programming languages with their use cases",
json_mode=True
)
๐๏ธ Vision Analysis Examples (NEW!)
Python:
from blossom_ai import Blossom, MessageBuilder
with Blossom(api_token="token") as ai:
# Analyze image from URL
messages = [
MessageBuilder.image(
role="user",
text="What's in this image? Describe in detail.",
image_url="https://example.com/photo.jpg",
detail="high"
)
]
analysis = ai.text.chat(messages, model="openai")
print(analysis)
# Analyze local image
messages = [
MessageBuilder.image(
role="user",
text="Identify the objects in this image",
image_path="/path/to/image.jpg",
detail="auto"
)
]
result = ai.text.chat(messages, model="openai")
# Compare multiple images
messages = [
MessageBuilder.image(
role="user",
text="Compare these two images",
image_url="https://example.com/image1.jpg"
),
{
"role": "user",
"content": [
{"type": "text", "text": "And this second image:"},
{
"type": "image_url",
"image_url": {
"url": "https://example.com/image2.jpg",
"detail": "high"
}
}
]
}
]
comparison = ai.text.chat(messages, model="openai")
๐ง Shell Automation Examples
#!/bin/bash
# Generate multiple images in parallel
for i in {1..5}; do
python -m blossom_ai.utils.cli \
--image "abstract art style $i" \
--output "art_$i.png" &
done
wait
# Batch text processing
questions=(
"What is AI?"
"Explain machine learning"
"What is deep learning?"
)
for q in "${questions[@]}"; do
echo "Q: $q"
python -m blossom_ai.utils.cli --text "$q"
echo "---"
done
# Vision analysis pipeline
for img in *.jpg; do
echo "Analyzing: $img"
python -c "
from blossom_ai import Blossom, MessageBuilder
with Blossom(api_token='token') as ai:
messages = [MessageBuilder.image('user', 'Describe', image_path='$img')]
print(ai.text.chat(messages, model='openai'))
"
done
๐ก๏ธ Production Ready
Blossom AI v0.5.0 is battle-tested with:
โ
Vision Support: Analyze images with AI models
โ
HD Image Generation: Up to 2048x2048 with quality controls
โ
Advanced Text Features: Function calling, JSON mode, streaming
โ
CLI Interface: Quick terminal access for testing and automation
โ
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
def health_check():
"""Verify everything works"""
try:
with Blossom(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
# Test vision
from blossom_ai import MessageBuilder
messages = [
MessageBuilder.image(
"user",
"What's this?",
image_url="https://pollinations.ai/p/test"
)
]
vision = client.text.chat(messages, model="openai")
assert len(vision) > 0
print("โ
Health check passed!")
return True
except Exception as e:
print(f"โ Health check failed: {e}")
return False
health_check()
๐จ Advanced Features
๐ง Reasoning ModuleEnhance prompts with structured thinking: from blossom_ai.utils import ReasoningEnhancer
enhancer = ReasoningEnhancer()
enhanced = enhancer.enhance(
"Design a microservices architecture",
level="high",
mode="auto"
)
|
โก Caching ModuleCache responses for better performance: from blossom_ai.utils import cached
@cached(ttl=3600)
def generate_text(prompt):
with Blossom() as ai:
return ai.text.generate(prompt)
|
๐ File ReaderProcess files for AI prompts: from blossom_ai.utils import read_file_for_prompt
content = read_file_for_prompt(
"code.py",
max_length=8000,
truncate_if_needed=True
)
|
๐ Web ApplicationsBuild REST APIs with FastAPI/Flask: from fastapi import FastAPI
app = FastAPI()
@app.post("/generate")
async def generate(prompt: str):
async with Blossom() as ai:
return await ai.text.generate(prompt)
|
๐ View Full Documentation โ
๐ค 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.5.4.tar.gz.
File metadata
- Download URL: eclips_blossom_ai-0.5.4.tar.gz
- Upload date:
- Size: 178.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b1dec3fd2c75d951c3e35b9a5a6c962124300ee8e2c5aedf562a1277d9e515c3
|
|
| MD5 |
ee3c541faa57bf824242ee3503c4e2fa
|
|
| BLAKE2b-256 |
09fc43dbf21aad323cfc2a864cd10eb5179944c6bc65fca6c43e605b4a904725
|
File details
Details for the file eclips_blossom_ai-0.5.4-py3-none-any.whl.
File metadata
- Download URL: eclips_blossom_ai-0.5.4-py3-none-any.whl
- Upload date:
- Size: 184.9 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 |
b60faacdcb7f02bfa032173f94dbc3485460a3b2d28d5fe9ceeadf831fd59795
|
|
| MD5 |
55435685a41824a1b108ab8dd8a85565
|
|
| BLAKE2b-256 |
e7b938c37b724db9a656b723bb0fd3648221ad816db37d53a6d122ed707ef41b
|