Skip to main content

A lightweight LAMA model inference wrapper

Project description

Lite Lama - A lightweight LAMA inference wrapper

from litelama import LiteLama
import requests
from PIL import Image
from io import BytesIO


def download_image(url):
    response = requests.get(url)
    return Image.open(BytesIO(response.content)).convert("RGB")


img_url = "https://raw.githubusercontent.com/CompVis/latent-diffusion/main/data/inpainting_examples/overture-creations-5sI6fQgYIuo.png"
mask_url = "https://raw.githubusercontent.com/CompVis/latent-diffusion/main/data/inpainting_examples/overture-creations-5sI6fQgYIuo_mask.png"


lama = LiteLama()
lama.to("cuda:0")
init_image = download_image(img_url).resize((512, 512))
mask_image = download_image(mask_url).resize((512, 512))

lama.predict(init_image, mask_image).save("result.png")

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

litelama-0.1.7.tar.gz (1.4 MB view details)

Uploaded Source

Built Distribution

litelama-0.1.7-py3-none-any.whl (21.9 kB view details)

Uploaded Python 3

File details

Details for the file litelama-0.1.7.tar.gz.

File metadata

  • Download URL: litelama-0.1.7.tar.gz
  • Upload date:
  • Size: 1.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.3

File hashes

Hashes for litelama-0.1.7.tar.gz
Algorithm Hash digest
SHA256 7837f38360acfd14a04ecab8bbb0dbc236514594dd0ffffe63e893a0d6531312
MD5 72f33a790817fd538ba31d32332fbc24
BLAKE2b-256 d3d84ebcfba840a00856fdc1c7e157352a1441a3cee3b405ecb7fdc20edfba93

See more details on using hashes here.

File details

Details for the file litelama-0.1.7-py3-none-any.whl.

File metadata

  • Download URL: litelama-0.1.7-py3-none-any.whl
  • Upload date:
  • Size: 21.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.3

File hashes

Hashes for litelama-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 43cdd7859185901694fc11a1b932ca34dd84d404b2d6395a018669327909a776
MD5 4f90b67547481e04f9bb14f6972580b7
BLAKE2b-256 6e59873f5cbaeae1f2b17e6d1ae6c74e1efde28783db4d7442346a77a6140673

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page