Metadata-Version: 2.5
Name: bhooai-nexus-ai
Version: 0.2.0
Summary: BhooAI Nexus AI — FastAPI library (greenfield) + image service (Pillow + Real-ESRGAN)
Requires-Python: >=3.11
Requires-Dist: fastapi>=0.115
Requires-Dist: httpx>=0.27
Requires-Dist: numpy>=1.24
Requires-Dist: pillow>=10.1
Requires-Dist: pydantic-settings>=2.0
Requires-Dist: pydantic>=2.0
Requires-Dist: python-multipart>=0.0.9
Requires-Dist: uvicorn[standard]>=0.30
Provides-Extra: dev
Requires-Dist: httpx; extra == 'dev'
Requires-Dist: pillow>=10.1; extra == 'dev'
Requires-Dist: pytest-asyncio>=0.24; extra == 'dev'
Requires-Dist: pytest>=8; extra == 'dev'
Provides-Extra: images
Requires-Dist: pillow-avif-plugin>=1.4; extra == 'images'
Provides-Extra: realesrgan
Requires-Dist: basicsr>=1.4.2; extra == 'realesrgan'
Requires-Dist: gfpgan>=1.3.8; extra == 'realesrgan'
Requires-Dist: realesrgan>=0.3.0; extra == 'realesrgan'
Requires-Dist: torch>=2.0; extra == 'realesrgan'
Requires-Dist: torchvision>=0.17; extra == 'realesrgan'
Description-Content-Type: text/markdown

# bhooai-nexus-ai

Greenfield Python library for BhooAI Nexus AI gateway + image service (Pillow + Real-ESRGAN). Contract-first from `contracts/ai-openapi.yaml`.

```bash
pip install -e ./libraries/python            # core (Pillow included)
pip install -e "./libraries/python[images]"  # + avif
pip install -e "./libraries/python[realesrgan]" # + Real-ESRGAN super-resolution (torch)
pytest
uvicorn bhooai_nexus.server:app --port 8000  # or python -m bhooai_nexus.server
```

## Images — resize / upscale / quality

Library:

```py
from bhooai_nexus.images import resize, upscale, generate_variants
out, info = resize(data, width=256, height=256, fit="cover", format="webp", quality=80)
out, info = upscale(data, scale=2, algorithm="realesrgan")  # fallback to lanczos if not installed
variants = generate_variants(data, sizes={"thumb":150,"small":480,"medium":1280,"large":2048}, formats=["webp"])
```

HTTP (single server, same port 8000):

```
POST /images/health
POST /images/resize   {b64, width, height, fit, format, quality}
POST /images/upscale  {b64, scale, algorithm}
POST /images/transform {b64, width, height, fit, format, quality, scale}
POST /images/variants/json {b64, sizes:{thumb:150}, formats:["webp"], quality:80}
```

Node auto-generates `storage.imageTransform.sizes` variants on `put()` via `NEXUS_IMAGES_URL` (default 127.0.0.1:8000); fallback to original if unreachable.
Bridge: `new PythonBridge({baseUrl}).images.variants({b64, sizes})`.
