Registry / ai-ml / simple-lama-inpainting

simple-lama-inpainting

JSON →
library0.1.2pypypiunverified

A lightweight Python wrapper for LaMa image inpainting, supporting CPU and GPU inference. Current version 0.1.2, updated irregularly on PyPI.

pip install simple-lama-inpainting
INSTALL
IMPORT
SIG · SIMPLE-LAMA-INPAIN
S
simple-lama-inpainting
ai-mlpythonv0.1.2
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

SimpleLama
from simple_lama_inpainting import SimpleLama
from simple_lama_inpainting.simple_lama import SimpleLama
Old or incorrect path; the top-level import is correct since v0.1.0.

Basic usage: load image and mask (both PIL), run inpainting, save result.

from simple_lama_inpainting import SimpleLama from PIL import Image simple_lama = SimpleLama() image = Image.open('input.png') mask = Image.open('mask.png') result = simple_lama(image, mask) result.save('output.png')
lama --version
Debug
Known issues
breakingThe package requires PyTorch (>=1.9) but does not install it automatically. You must install torch separately, with the appropriate CUDA version if using GPU.
fix
pip install torch torchvision --index-url https://download.pytorch.org/whl/cu118 (adjust CUDA version as needed)
affects: >=0.1.0
gotchaThe mask must be a binary image (black/white) where white indicates the area to inpaint. Using a non-binary mask may produce incorrect results.
fix
Ensure mask is converted to binary (0/255) before passing. Use: mask = mask.point(lambda x: 255 if x > 128 else 0)
affects: >=0.1.0
gotchaThe package downloads the model weights (~250MB) on first run. If your environment has no internet access, pre-download and set environment variable LAMA_MODEL_PATH.
fix
Set LAMA_MODEL_PATH=/path/to/big-lama.pt in your environment to use a local model file.
affects: >=0.1.0
Upgrade
Version history
0.1.2latest on PyPI · released Jul 28, 2023
Audit
Dependencies
torchrequiredRequired for model inference
pillowrequiredImage handling
numpyrequiredArray operations
opencv-pythonoptionalImage processing (common but not strictly required)
Agent activity
8 hits · last 30 days
node
6
OpenAI (training)
1
Resources
simple-lama-inpainting — pip install simple-lama-inpainting · libregistry