From a73e2a531f54c693763c61f611f453add42e5c8d Mon Sep 17 00:00:00 2001 From: Qing Date: Fri, 5 Jan 2024 15:19:23 +0800 Subject: [PATCH] rename to iopaint --- .gitignore | 2 +- README.md | 76 +----------------- {lama_cleaner => iopaint}/__init__.py | 2 +- {lama_cleaner => iopaint}/api.py | 18 ++--- {lama_cleaner => iopaint}/batch_processing.py | 6 +- {lama_cleaner => iopaint}/benchmark.py | 4 +- {lama_cleaner => iopaint}/cli.py | 16 ++-- {lama_cleaner => iopaint}/const.py | 0 {lama_cleaner => iopaint}/download.py | 12 +-- .../file_manager/__init__.py | 0 .../file_manager/file_manager.py | 0 .../file_manager/storage_backends.py | 0 .../file_manager/utils.py | 0 {lama_cleaner => iopaint}/helper.py | 10 +-- {lama_cleaner => iopaint}/installer.py | 0 {lama_cleaner => iopaint}/model/__init__.py | 0 {lama_cleaner => iopaint}/model/base.py | 8 +- {lama_cleaner => iopaint}/model/controlnet.py | 10 +-- .../model/ddim_sampler.py | 2 +- {lama_cleaner => iopaint}/model/fcf.py | 8 +- .../model/helper/controlnet_preprocess.py | 0 .../model/helper/cpu_text_encoder.py | 2 +- .../model/helper/g_diffuser_bot.py | 0 .../model/instruct_pix2pix.py | 4 +- {lama_cleaner => iopaint}/model/kandinsky.py | 6 +- {lama_cleaner => iopaint}/model/lama.py | 6 +- {lama_cleaner => iopaint}/model/ldm.py | 12 +-- {lama_cleaner => iopaint}/model/manga.py | 6 +- {lama_cleaner => iopaint}/model/mat.py | 8 +- {lama_cleaner => iopaint}/model/mi_gan.py | 6 +- {lama_cleaner => iopaint}/model/opencv2.py | 4 +- .../model/paint_by_example.py | 6 +- .../model/plms_sampler.py | 2 +- .../model/power_paint/__init__.py | 0 .../model/power_paint/pipeline_powerpaint.py | 0 .../pipeline_powerpaint_controlnet.py | 0 .../model/power_paint/power_paint.py | 8 +- .../model/power_paint/powerpaint_tokenizer.py | 2 +- {lama_cleaner => iopaint}/model/sd.py | 8 +- {lama_cleaner => iopaint}/model/sdxl.py | 6 +- {lama_cleaner => iopaint}/model/utils.py | 2 +- {lama_cleaner => iopaint}/model/zits.py | 6 +- {lama_cleaner => iopaint}/model_info.py | 6 +- {lama_cleaner => iopaint}/model_manager.py | 12 +-- {lama_cleaner => iopaint}/plugins/__init__.py | 0 .../plugins/anime_seg.py | 6 +- .../plugins/base_plugin.py | 2 +- .../plugins/gfpgan_plugin.py | 6 +- {lama_cleaner => iopaint}/plugins/gfpganer.py | 0 .../plugins/interactive_seg.py | 8 +- .../plugins/realesrgan.py | 8 +- .../plugins/remove_bg.py | 4 +- .../plugins/restoreformer.py | 6 +- .../plugins/segment_anything/__init__.py | 0 .../plugins/segment_anything/build_sam.py | 2 +- .../segment_anything/modeling/__init__.py | 0 .../segment_anything/modeling/common.py | 0 .../modeling/image_encoder.py | 0 .../segment_anything/modeling/mask_decoder.py | 0 .../modeling/prompt_encoder.py | 0 .../plugins/segment_anything/modeling/sam.py | 0 .../segment_anything/modeling/tiny_vit_sam.py | 0 .../segment_anything/modeling/transformer.py | 0 .../plugins/segment_anything/predictor.py | 0 .../segment_anything/utils/__init__.py | 0 .../segment_anything/utils/transforms.py | 0 {lama_cleaner => iopaint}/runtime.py | 4 +- {lama_cleaner => iopaint}/schema.py | 2 +- {lama_cleaner => iopaint}/tests/.gitignore | 0 {lama_cleaner => iopaint}/tests/__init__.py | 0 .../tests/anime_test.png | Bin {lama_cleaner => iopaint}/tests/bunny.jpeg | Bin {lama_cleaner => iopaint}/tests/cat.png | Bin .../tests/icc_profile_test.jpg | Bin .../tests/icc_profile_test.png | Bin {lama_cleaner => iopaint}/tests/image.png | Bin {lama_cleaner => iopaint}/tests/mask.png | Bin .../tests/overture-creations-5sI6fQgYIuo.png | Bin ...verture-creations-5sI6fQgYIuo_all_mask.png | 0 .../overture-creations-5sI6fQgYIuo_mask.png | Bin ...erture-creations-5sI6fQgYIuo_mask_blur.png | Bin .../tests/png_parameter_test.png | Bin .../tests/test_adjust_mask.py | 4 +- .../tests/test_controlnet.py | 8 +- .../tests/test_instruct_pix2pix.py | 6 +- .../tests/test_load_img.py | 4 +- {lama_cleaner => iopaint}/tests/test_model.py | 6 +- .../tests/test_model_md5.py | 4 +- .../tests/test_model_switch.py | 4 +- .../tests/test_outpainting.py | 8 +- .../tests/test_paint_by_example.py | 6 +- .../tests/test_plugins.py | 10 +-- .../tests/test_save_exif.py | 2 +- .../tests/test_sd_model.py | 6 +- {lama_cleaner => iopaint}/tests/test_sdxl.py | 8 +- {lama_cleaner => iopaint}/tests/utils.py | 4 +- {lama_cleaner => iopaint}/web_config.py | 2 +- main.py | 2 +- publish.sh | 2 + requirements.txt | 1 - setup.py | 12 +-- 101 files changed, 180 insertions(+), 253 deletions(-) rename {lama_cleaner => iopaint}/__init__.py (89%) rename {lama_cleaner => iopaint}/api.py (97%) rename {lama_cleaner => iopaint}/batch_processing.py (96%) rename {lama_cleaner => iopaint}/benchmark.py (96%) rename {lama_cleaner => iopaint}/cli.py (93%) rename {lama_cleaner => iopaint}/const.py (100%) rename {lama_cleaner => iopaint}/download.py (94%) rename {lama_cleaner => iopaint}/file_manager/__init__.py (100%) rename {lama_cleaner => iopaint}/file_manager/file_manager.py (100%) rename {lama_cleaner => iopaint}/file_manager/storage_backends.py (100%) rename {lama_cleaner => iopaint}/file_manager/utils.py (100%) rename {lama_cleaner => iopaint}/helper.py (97%) rename {lama_cleaner => iopaint}/installer.py (100%) rename {lama_cleaner => iopaint}/model/__init__.py (100%) rename {lama_cleaner => iopaint}/model/base.py (98%) rename {lama_cleaner => iopaint}/model/controlnet.py (94%) rename {lama_cleaner => iopaint}/model/ddim_sampler.py (98%) rename {lama_cleaner => iopaint}/model/fcf.py (99%) rename {lama_cleaner => iopaint}/model/helper/controlnet_preprocess.py (100%) rename {lama_cleaner => iopaint}/model/helper/cpu_text_encoder.py (94%) rename {lama_cleaner => iopaint}/model/helper/g_diffuser_bot.py (100%) rename {lama_cleaner => iopaint}/model/instruct_pix2pix.py (95%) rename {lama_cleaner => iopaint}/model/kandinsky.py (92%) rename {lama_cleaner => iopaint}/model/lama.py (92%) rename {lama_cleaner => iopaint}/model/ldm.py (97%) rename {lama_cleaner => iopaint}/model/manga.py (94%) rename {lama_cleaner => iopaint}/model/mat.py (99%) rename {lama_cleaner => iopaint}/model/mi_gan.py (96%) rename {lama_cleaner => iopaint}/model/opencv2.py (87%) rename {lama_cleaner => iopaint}/model/paint_by_example.py (94%) rename {lama_cleaner => iopaint}/model/plms_sampler.py (99%) rename {lama_cleaner => iopaint}/model/power_paint/__init__.py (100%) rename {lama_cleaner => iopaint}/model/power_paint/pipeline_powerpaint.py (100%) rename {lama_cleaner => iopaint}/model/power_paint/pipeline_powerpaint_controlnet.py (100%) rename {lama_cleaner => iopaint}/model/power_paint/power_paint.py (93%) rename {lama_cleaner => iopaint}/model/power_paint/powerpaint_tokenizer.py (99%) rename {lama_cleaner => iopaint}/model/sd.py (93%) rename {lama_cleaner => iopaint}/model/sdxl.py (94%) rename {lama_cleaner => iopaint}/model/utils.py (99%) rename {lama_cleaner => iopaint}/model/zits.py (98%) rename {lama_cleaner => iopaint}/model_info.py (94%) rename {lama_cleaner => iopaint}/model_manager.py (95%) rename {lama_cleaner => iopaint}/plugins/__init__.py (100%) rename {lama_cleaner => iopaint}/plugins/anime_seg.py (98%) rename {lama_cleaner => iopaint}/plugins/base_plugin.py (92%) rename {lama_cleaner => iopaint}/plugins/gfpgan_plugin.py (93%) rename {lama_cleaner => iopaint}/plugins/gfpganer.py (100%) rename {lama_cleaner => iopaint}/plugins/interactive_seg.py (90%) rename {lama_cleaner => iopaint}/plugins/realesrgan.py (94%) rename {lama_cleaner => iopaint}/plugins/remove_bg.py (92%) rename {lama_cleaner => iopaint}/plugins/restoreformer.py (91%) rename {lama_cleaner => iopaint}/plugins/segment_anything/__init__.py (100%) rename {lama_cleaner => iopaint}/plugins/segment_anything/build_sam.py (98%) rename {lama_cleaner => iopaint}/plugins/segment_anything/modeling/__init__.py (100%) rename {lama_cleaner => iopaint}/plugins/segment_anything/modeling/common.py (100%) rename {lama_cleaner => iopaint}/plugins/segment_anything/modeling/image_encoder.py (100%) rename {lama_cleaner => iopaint}/plugins/segment_anything/modeling/mask_decoder.py (100%) rename {lama_cleaner => iopaint}/plugins/segment_anything/modeling/prompt_encoder.py (100%) rename {lama_cleaner => iopaint}/plugins/segment_anything/modeling/sam.py (100%) rename {lama_cleaner => iopaint}/plugins/segment_anything/modeling/tiny_vit_sam.py (100%) rename {lama_cleaner => iopaint}/plugins/segment_anything/modeling/transformer.py (100%) rename {lama_cleaner => iopaint}/plugins/segment_anything/predictor.py (100%) rename {lama_cleaner => iopaint}/plugins/segment_anything/utils/__init__.py (100%) rename {lama_cleaner => iopaint}/plugins/segment_anything/utils/transforms.py (100%) rename {lama_cleaner => iopaint}/runtime.py (97%) rename {lama_cleaner => iopaint}/schema.py (99%) rename {lama_cleaner => iopaint}/tests/.gitignore (100%) rename {lama_cleaner => iopaint}/tests/__init__.py (100%) rename {lama_cleaner => iopaint}/tests/anime_test.png (100%) rename {lama_cleaner => iopaint}/tests/bunny.jpeg (100%) rename {lama_cleaner => iopaint}/tests/cat.png (100%) rename {lama_cleaner => iopaint}/tests/icc_profile_test.jpg (100%) rename {lama_cleaner => iopaint}/tests/icc_profile_test.png (100%) rename {lama_cleaner => iopaint}/tests/image.png (100%) rename {lama_cleaner => iopaint}/tests/mask.png (100%) rename {lama_cleaner => iopaint}/tests/overture-creations-5sI6fQgYIuo.png (100%) rename {lama_cleaner => iopaint}/tests/overture-creations-5sI6fQgYIuo_all_mask.png (100%) rename {lama_cleaner => iopaint}/tests/overture-creations-5sI6fQgYIuo_mask.png (100%) rename {lama_cleaner => iopaint}/tests/overture-creations-5sI6fQgYIuo_mask_blur.png (100%) rename {lama_cleaner => iopaint}/tests/png_parameter_test.png (100%) rename {lama_cleaner => iopaint}/tests/test_adjust_mask.py (83%) rename {lama_cleaner => iopaint}/tests/test_controlnet.py (92%) rename {lama_cleaner => iopaint}/tests/test_instruct_pix2pix.py (85%) rename {lama_cleaner => iopaint}/tests/test_load_img.py (83%) rename {lama_cleaner => iopaint}/tests/test_model.py (96%) rename {lama_cleaner => iopaint}/tests/test_model_md5.py (77%) rename {lama_cleaner => iopaint}/tests/test_model_switch.py (94%) rename {lama_cleaner => iopaint}/tests/test_outpainting.py (94%) rename {lama_cleaner => iopaint}/tests/test_paint_by_example.py (91%) rename {lama_cleaner => iopaint}/tests/test_plugins.py (92%) rename {lama_cleaner => iopaint}/tests/test_save_exif.py (96%) rename {lama_cleaner => iopaint}/tests/test_sd_model.py (97%) rename {lama_cleaner => iopaint}/tests/test_sdxl.py (93%) rename {lama_cleaner => iopaint}/tests/utils.py (94%) rename {lama_cleaner => iopaint}/web_config.py (99%) diff --git a/.gitignore b/.gitignore index 5fd8a3f..8b12b55 100644 --- a/.gitignore +++ b/.gitignore @@ -4,7 +4,7 @@ examples/ .idea/ .vscode/ build -!lama_cleaner/app/build +!iopaint/app/build dist/ lama_cleaner.egg-info/ venv/ diff --git a/README.md b/README.md index b69f529..b4f7833 100644 --- a/README.md +++ b/README.md @@ -1,75 +1 @@ -

- logo -

-

Lama Cleaner

-

A free and open-source inpainting tool powered by SOTA AI model.

- -

- - total download - - - version - - - Open in Colab - - - - Hugging Face Spaces - - - - python version - - - version - -

- -https://user-images.githubusercontent.com/3998421/196976498-ba1ad3ab-fa18-4c55-965f-5c6683141375.mp4 - -## Features - -- Completely free and open-source, fully self-hosted, support CPU & GPU & M1/2 -- [Windows 1-Click Installer](https://lama-cleaner-docs.vercel.app/install/windows_1click_installer) -- [Native macOS app](https://opticlean.io/) -- Multiple SOTA AI [models](https://lama-cleaner-docs.vercel.app/models) - - Erase model: LaMa/LDM/ZITS/MAT/FcF/Manga - - Erase and Replace model: Stable Diffusion/Paint by Example -- [Plugins](https://lama-cleaner-docs.vercel.app/plugins) for post-processing: - - [RemoveBG](https://github.com/danielgatis/rembg): Remove images background - - [RealESRGAN](https://github.com/xinntao/Real-ESRGAN): Super Resolution - - [GFPGAN](https://github.com/TencentARC/GFPGAN): Face Restoration - - [RestoreFormer](https://github.com/wzhouxiff/RestoreFormer): Face Restoration - - [Segment Anything](https://lama-cleaner-docs.vercel.app/plugins#interactive-segmentation): Accurate and fast interactive object segmentation -- [FileManager](https://lama-cleaner-docs.vercel.app/features/file_manager): Browse your pictures conveniently and save them directly to the output directory. -- More features at [lama-cleaner-docs](https://lama-cleaner-docs.vercel.app/) - -## Quick Start - -Lama Cleaner make it easy to use SOTA AI model in just two commands: - -```bash -# In order to use the GPU, install cuda version of pytorch first. -# pip install torch==1.13.1+cu117 torchvision==0.14.1 --extra-index-url https://download.pytorch.org/whl/cu117 -pip install lama-cleaner -lama-cleaner --model=lama --device=cpu --port=8080 -``` - -That's it, Lama Cleaner is now running at http://localhost:8080 - -See all command line arguments at [lama-cleaner-docs](https://lama-cleaner-docs.vercel.app/install/pip) - -## Development - -Only needed if you plan to modify the frontend and recompile yourself. - -### Frontend - -Frontend code are modified from [cleanup.pictures](https://github.com/initml/cleanup.pictures), You can experience their -great online services [here](https://cleanup.pictures/). - -- Install dependencies:`cd lama_cleaner/app/ && pnpm install` -- Start development server: `pnpm start` -- Build: `pnpm build` +# IOPaint \ No newline at end of file diff --git a/lama_cleaner/__init__.py b/iopaint/__init__.py similarity index 89% rename from lama_cleaner/__init__.py rename to iopaint/__init__.py index e399b60..2be8d8b 100644 --- a/lama_cleaner/__init__.py +++ b/iopaint/__init__.py @@ -10,6 +10,6 @@ warnings.simplefilter("ignore", UserWarning) def entry_point(): # To make os.environ["XDG_CACHE_HOME"] = args.model_cache_dir works for diffusers # https://github.com/huggingface/diffusers/blob/be99201a567c1ccd841dc16fb24e88f7f239c187/src/diffusers/utils/constants.py#L18 - from lama_cleaner.cli import typer_app + from iopaint.cli import typer_app typer_app() diff --git a/lama_cleaner/api.py b/iopaint/api.py similarity index 97% rename from lama_cleaner/api.py rename to iopaint/api.py index 53a33d2..eae429e 100644 --- a/lama_cleaner/api.py +++ b/iopaint/api.py @@ -21,8 +21,8 @@ from fastapi.staticfiles import StaticFiles from loguru import logger from socketio import AsyncServer -from lama_cleaner.file_manager import FileManager -from lama_cleaner.helper import ( +from iopaint.file_manager import FileManager +from iopaint.helper import ( load_img, decode_base64_to_image, pil_to_bytes, @@ -31,12 +31,12 @@ from lama_cleaner.helper import ( gen_frontend_mask, adjust_mask, ) -from lama_cleaner.model.utils import torch_gc -from lama_cleaner.model_info import ModelInfo -from lama_cleaner.model_manager import ModelManager -from lama_cleaner.plugins import build_plugins -from lama_cleaner.plugins.base_plugin import BasePlugin -from lama_cleaner.schema import ( +from iopaint.model.utils import torch_gc +from iopaint.model_info import ModelInfo +from iopaint.model_manager import ModelManager +from iopaint.plugins import build_plugins +from iopaint.plugins.base_plugin import BasePlugin +from iopaint.schema import ( GenInfoResponse, ApiConfig, ServerConfigResponse, @@ -356,7 +356,7 @@ class Api: if __name__ == "__main__": - from lama_cleaner.schema import InteractiveSegModel, RealESRGANModel + from iopaint.schema import InteractiveSegModel, RealESRGANModel app = FastAPI() api = Api( diff --git a/lama_cleaner/batch_processing.py b/iopaint/batch_processing.py similarity index 96% rename from lama_cleaner/batch_processing.py rename to iopaint/batch_processing.py index 4a3727c..a32ea48 100644 --- a/lama_cleaner/batch_processing.py +++ b/iopaint/batch_processing.py @@ -17,9 +17,9 @@ from rich.progress import ( TimeRemainingColumn, ) -from lama_cleaner.helper import pil_to_bytes -from lama_cleaner.model_manager import ModelManager -from lama_cleaner.schema import InpaintRequest +from iopaint.helper import pil_to_bytes +from iopaint.model_manager import ModelManager +from iopaint.schema import InpaintRequest def glob_images(path: Path) -> Dict[str, Path]: diff --git a/lama_cleaner/benchmark.py b/iopaint/benchmark.py similarity index 96% rename from lama_cleaner/benchmark.py rename to iopaint/benchmark.py index d8bcbbb..0205c60 100644 --- a/lama_cleaner/benchmark.py +++ b/iopaint/benchmark.py @@ -9,8 +9,8 @@ import nvidia_smi import psutil import torch -from lama_cleaner.model_manager import ModelManager -from lama_cleaner.schema import InpaintRequest, HDStrategy, SDSampler +from iopaint.model_manager import ModelManager +from iopaint.schema import InpaintRequest, HDStrategy, SDSampler try: torch._C._jit_override_can_fuse_on_cpu(False) diff --git a/lama_cleaner/cli.py b/iopaint/cli.py similarity index 93% rename from lama_cleaner/cli.py rename to iopaint/cli.py index 0615a1e..6804bf0 100644 --- a/lama_cleaner/cli.py +++ b/iopaint/cli.py @@ -6,16 +6,16 @@ from fastapi import FastAPI from loguru import logger from typer import Option -from lama_cleaner.const import * -from lama_cleaner.download import cli_download_model, scan_models -from lama_cleaner.runtime import setup_model_dir, dump_environment_info, check_device +from iopaint.const import * +from iopaint.download import cli_download_model, scan_models +from iopaint.runtime import setup_model_dir, dump_environment_info, check_device typer_app = typer.Typer(pretty_exceptions_show_locals=False, add_completion=False) @typer_app.command(help="Install all plugins dependencies") def install_plugins_packages(): - from lama_cleaner.installer import install_plugins_package + from iopaint.installer import install_plugins_package install_plugins_package() @@ -67,12 +67,12 @@ def run( logger.info(f"{model} not found in {model_dir}, try to downloading") cli_download_model(model, model_dir) - from lama_cleaner.batch_processing import batch_inpaint + from iopaint.batch_processing import batch_inpaint batch_inpaint(model, device, image, mask, output, config, concat) -@typer_app.command(help="Start lama cleaner server") +@typer_app.command(help="Start IOPaint server") def start( host: str = Option("127.0.0.1"), port: int = Option(8080), @@ -136,8 +136,8 @@ def start( logger.info(f"{model} not found in {model_dir}, try to downloading") cli_download_model(model, model_dir) - from lama_cleaner.api import Api - from lama_cleaner.schema import ApiConfig + from iopaint.api import Api + from iopaint.schema import ApiConfig app = FastAPI() api = Api( diff --git a/lama_cleaner/const.py b/iopaint/const.py similarity index 100% rename from lama_cleaner/const.py rename to iopaint/const.py diff --git a/lama_cleaner/download.py b/iopaint/download.py similarity index 94% rename from lama_cleaner/download.py rename to iopaint/download.py index ca3781d..654a1ff 100644 --- a/lama_cleaner/download.py +++ b/iopaint/download.py @@ -6,21 +6,21 @@ from huggingface_hub.constants import HF_HUB_CACHE from loguru import logger from pathlib import Path -from lama_cleaner.const import ( +from iopaint.const import ( DEFAULT_MODEL_DIR, DIFFUSERS_SD_CLASS_NAME, DIFFUSERS_SD_INPAINT_CLASS_NAME, DIFFUSERS_SDXL_CLASS_NAME, DIFFUSERS_SDXL_INPAINT_CLASS_NAME, ) -from lama_cleaner.model.utils import handle_from_pretrained_exceptions -from lama_cleaner.model_info import ModelInfo, ModelType -from lama_cleaner.runtime import setup_model_dir +from iopaint.model.utils import handle_from_pretrained_exceptions +from iopaint.model_info import ModelInfo, ModelType +from iopaint.runtime import setup_model_dir def cli_download_model(model: str, model_dir: Path): setup_model_dir(model_dir) - from lama_cleaner.model import models + from iopaint.model import models if model in models and models[model].is_erase_model: logger.info(f"Downloading {model}...") @@ -85,7 +85,7 @@ def scan_single_file_diffusion_models(cache_dir) -> List[ModelInfo]: def scan_inpaint_models(model_dir: Path) -> List[ModelInfo]: res = [] - from lama_cleaner.model import models + from iopaint.model import models # logger.info(f"Scanning inpaint models in {model_dir}") diff --git a/lama_cleaner/file_manager/__init__.py b/iopaint/file_manager/__init__.py similarity index 100% rename from lama_cleaner/file_manager/__init__.py rename to iopaint/file_manager/__init__.py diff --git a/lama_cleaner/file_manager/file_manager.py b/iopaint/file_manager/file_manager.py similarity index 100% rename from lama_cleaner/file_manager/file_manager.py rename to iopaint/file_manager/file_manager.py diff --git a/lama_cleaner/file_manager/storage_backends.py b/iopaint/file_manager/storage_backends.py similarity index 100% rename from lama_cleaner/file_manager/storage_backends.py rename to iopaint/file_manager/storage_backends.py diff --git a/lama_cleaner/file_manager/utils.py b/iopaint/file_manager/utils.py similarity index 100% rename from lama_cleaner/file_manager/utils.py rename to iopaint/file_manager/utils.py diff --git a/lama_cleaner/helper.py b/iopaint/helper.py similarity index 97% rename from lama_cleaner/helper.py rename to iopaint/helper.py index 177df02..ce83f38 100644 --- a/lama_cleaner/helper.py +++ b/iopaint/helper.py @@ -10,7 +10,7 @@ import cv2 from PIL import Image, ImageOps, PngImagePlugin import numpy as np import torch -from lama_cleaner.const import MPS_UNSUPPORT_MODELS +from iopaint.const import MPS_UNSUPPORT_MODELS from loguru import logger from torch.hub import download_url_to_file, get_dir import hashlib @@ -56,12 +56,12 @@ def download_model(url, model_md5: str = None): try: os.remove(cached_file) logger.error( - f"Model md5: {_md5}, expected md5: {model_md5}, wrong model deleted. Please restart lama-cleaner." + f"Model md5: {_md5}, expected md5: {model_md5}, wrong model deleted. Please restart iopaint." f"If you still have errors, please try download model manually first https://lama-cleaner-docs.vercel.app/install/download_model_manually.\n" ) except: logger.error( - f"Model md5: {_md5}, expected md5: {model_md5}, please delete {cached_file} and restart lama-cleaner." + f"Model md5: {_md5}, expected md5: {model_md5}, please delete {cached_file} and restart iopaint." ) exit(-1) @@ -80,12 +80,12 @@ def handle_error(model_path, model_md5, e): try: os.remove(model_path) logger.error( - f"Model md5: {_md5}, expected md5: {model_md5}, wrong model deleted. Please restart lama-cleaner." + f"Model md5: {_md5}, expected md5: {model_md5}, wrong model deleted. Please restart iopaint." f"If you still have errors, please try download model manually first https://lama-cleaner-docs.vercel.app/install/download_model_manually.\n" ) except: logger.error( - f"Model md5: {_md5}, expected md5: {model_md5}, please delete {model_path} and restart lama-cleaner." + f"Model md5: {_md5}, expected md5: {model_md5}, please delete {model_path} and restart iopaint." ) else: logger.error( diff --git a/lama_cleaner/installer.py b/iopaint/installer.py similarity index 100% rename from lama_cleaner/installer.py rename to iopaint/installer.py diff --git a/lama_cleaner/model/__init__.py b/iopaint/model/__init__.py similarity index 100% rename from lama_cleaner/model/__init__.py rename to iopaint/model/__init__.py diff --git a/lama_cleaner/model/base.py b/iopaint/model/base.py similarity index 98% rename from lama_cleaner/model/base.py rename to iopaint/model/base.py index 683ac0e..fa6a677 100644 --- a/lama_cleaner/model/base.py +++ b/iopaint/model/base.py @@ -6,15 +6,15 @@ import torch import numpy as np from loguru import logger -from lama_cleaner.helper import ( +from iopaint.helper import ( boxes_from_mask, resize_max_size, pad_img_to_modulo, switch_mps_device, ) -from lama_cleaner.model.helper.g_diffuser_bot import expand_image -from lama_cleaner.model.utils import get_scheduler -from lama_cleaner.schema import InpaintRequest, HDStrategy, SDSampler +from iopaint.model.helper.g_diffuser_bot import expand_image +from iopaint.model.utils import get_scheduler +from iopaint.schema import InpaintRequest, HDStrategy, SDSampler class InpaintModel: diff --git a/lama_cleaner/model/controlnet.py b/iopaint/model/controlnet.py similarity index 94% rename from lama_cleaner/model/controlnet.py rename to iopaint/model/controlnet.py index 727dc61..abc049f 100644 --- a/lama_cleaner/model/controlnet.py +++ b/iopaint/model/controlnet.py @@ -5,16 +5,16 @@ import torch from diffusers import ControlNetModel, DiffusionPipeline from loguru import logger -from lama_cleaner.model.base import DiffusionInpaintModel -from lama_cleaner.model.helper.controlnet_preprocess import ( +from iopaint.model.base import DiffusionInpaintModel +from iopaint.model.helper.controlnet_preprocess import ( make_canny_control_image, make_openpose_control_image, make_depth_control_image, make_inpaint_control_image, ) -from lama_cleaner.model.helper.cpu_text_encoder import CPUTextEncoderWrapper -from lama_cleaner.model.utils import get_scheduler, handle_from_pretrained_exceptions -from lama_cleaner.schema import InpaintRequest, ModelType +from iopaint.model.helper.cpu_text_encoder import CPUTextEncoderWrapper +from iopaint.model.utils import get_scheduler, handle_from_pretrained_exceptions +from iopaint.schema import InpaintRequest, ModelType class ControlNet(DiffusionInpaintModel): diff --git a/lama_cleaner/model/ddim_sampler.py b/iopaint/model/ddim_sampler.py similarity index 98% rename from lama_cleaner/model/ddim_sampler.py rename to iopaint/model/ddim_sampler.py index d1e4400..7d4033e 100644 --- a/lama_cleaner/model/ddim_sampler.py +++ b/iopaint/model/ddim_sampler.py @@ -2,7 +2,7 @@ import torch import numpy as np from tqdm import tqdm -from lama_cleaner.model.utils import make_ddim_timesteps, make_ddim_sampling_parameters, noise_like +from iopaint.model.utils import make_ddim_timesteps, make_ddim_sampling_parameters, noise_like from loguru import logger diff --git a/lama_cleaner/model/fcf.py b/iopaint/model/fcf.py similarity index 99% rename from lama_cleaner/model/fcf.py rename to iopaint/model/fcf.py index 327b533..80d9596 100644 --- a/lama_cleaner/model/fcf.py +++ b/iopaint/model/fcf.py @@ -6,9 +6,9 @@ import torch import numpy as np import torch.fft as fft -from lama_cleaner.schema import InpaintRequest +from iopaint.schema import InpaintRequest -from lama_cleaner.helper import ( +from iopaint.helper import ( load_model, get_cache_path_by_url, norm_img, @@ -16,11 +16,11 @@ from lama_cleaner.helper import ( resize_max_size, download_model, ) -from lama_cleaner.model.base import InpaintModel +from iopaint.model.base import InpaintModel from torch import conv2d, nn import torch.nn.functional as F -from lama_cleaner.model.utils import ( +from iopaint.model.utils import ( setup_filter, _parse_scaling, _parse_padding, diff --git a/lama_cleaner/model/helper/controlnet_preprocess.py b/iopaint/model/helper/controlnet_preprocess.py similarity index 100% rename from lama_cleaner/model/helper/controlnet_preprocess.py rename to iopaint/model/helper/controlnet_preprocess.py diff --git a/lama_cleaner/model/helper/cpu_text_encoder.py b/iopaint/model/helper/cpu_text_encoder.py similarity index 94% rename from lama_cleaner/model/helper/cpu_text_encoder.py rename to iopaint/model/helper/cpu_text_encoder.py index 66cc86c..20ce9d0 100644 --- a/lama_cleaner/model/helper/cpu_text_encoder.py +++ b/iopaint/model/helper/cpu_text_encoder.py @@ -1,5 +1,5 @@ import torch -from lama_cleaner.model.utils import torch_gc +from iopaint.model.utils import torch_gc class CPUTextEncoderWrapper(torch.nn.Module): diff --git a/lama_cleaner/model/helper/g_diffuser_bot.py b/iopaint/model/helper/g_diffuser_bot.py similarity index 100% rename from lama_cleaner/model/helper/g_diffuser_bot.py rename to iopaint/model/helper/g_diffuser_bot.py diff --git a/lama_cleaner/model/instruct_pix2pix.py b/iopaint/model/instruct_pix2pix.py similarity index 95% rename from lama_cleaner/model/instruct_pix2pix.py rename to iopaint/model/instruct_pix2pix.py index bf03ff7..56bae64 100644 --- a/lama_cleaner/model/instruct_pix2pix.py +++ b/iopaint/model/instruct_pix2pix.py @@ -3,8 +3,8 @@ import cv2 import torch from loguru import logger -from lama_cleaner.model.base import DiffusionInpaintModel -from lama_cleaner.schema import InpaintRequest +from iopaint.model.base import DiffusionInpaintModel +from iopaint.schema import InpaintRequest class InstructPix2Pix(DiffusionInpaintModel): diff --git a/lama_cleaner/model/kandinsky.py b/iopaint/model/kandinsky.py similarity index 92% rename from lama_cleaner/model/kandinsky.py rename to iopaint/model/kandinsky.py index 5bcfffd..481a72e 100644 --- a/lama_cleaner/model/kandinsky.py +++ b/iopaint/model/kandinsky.py @@ -3,9 +3,9 @@ import cv2 import numpy as np import torch -from lama_cleaner.model.base import DiffusionInpaintModel -from lama_cleaner.model.utils import get_scheduler -from lama_cleaner.schema import InpaintRequest +from iopaint.model.base import DiffusionInpaintModel +from iopaint.model.utils import get_scheduler +from iopaint.schema import InpaintRequest class Kandinsky(DiffusionInpaintModel): diff --git a/lama_cleaner/model/lama.py b/iopaint/model/lama.py similarity index 92% rename from lama_cleaner/model/lama.py rename to iopaint/model/lama.py index 0a2e6f5..15d1f7d 100644 --- a/lama_cleaner/model/lama.py +++ b/iopaint/model/lama.py @@ -4,14 +4,14 @@ import cv2 import numpy as np import torch -from lama_cleaner.helper import ( +from iopaint.helper import ( norm_img, get_cache_path_by_url, load_jit_model, download_model, ) -from lama_cleaner.model.base import InpaintModel -from lama_cleaner.schema import InpaintRequest +from iopaint.model.base import InpaintModel +from iopaint.schema import InpaintRequest LAMA_MODEL_URL = os.environ.get( "LAMA_MODEL_URL", diff --git a/lama_cleaner/model/ldm.py b/iopaint/model/ldm.py similarity index 97% rename from lama_cleaner/model/ldm.py rename to iopaint/model/ldm.py index a338e8e..6ba4f3a 100644 --- a/lama_cleaner/model/ldm.py +++ b/iopaint/model/ldm.py @@ -4,20 +4,20 @@ import numpy as np import torch from loguru import logger -from lama_cleaner.model.base import InpaintModel -from lama_cleaner.model.ddim_sampler import DDIMSampler -from lama_cleaner.model.plms_sampler import PLMSSampler -from lama_cleaner.schema import InpaintRequest, LDMSampler +from iopaint.model.base import InpaintModel +from iopaint.model.ddim_sampler import DDIMSampler +from iopaint.model.plms_sampler import PLMSSampler +from iopaint.schema import InpaintRequest, LDMSampler torch.manual_seed(42) import torch.nn as nn -from lama_cleaner.helper import ( +from iopaint.helper import ( download_model, norm_img, get_cache_path_by_url, load_jit_model, ) -from lama_cleaner.model.utils import ( +from iopaint.model.utils import ( make_beta_schedule, timestep_embedding, ) diff --git a/lama_cleaner/model/manga.py b/iopaint/model/manga.py similarity index 94% rename from lama_cleaner/model/manga.py rename to iopaint/model/manga.py index b675e6a..66d04fc 100644 --- a/lama_cleaner/model/manga.py +++ b/iopaint/model/manga.py @@ -7,9 +7,9 @@ import torch import time from loguru import logger -from lama_cleaner.helper import get_cache_path_by_url, load_jit_model, download_model -from lama_cleaner.model.base import InpaintModel -from lama_cleaner.schema import InpaintRequest +from iopaint.helper import get_cache_path_by_url, load_jit_model, download_model +from iopaint.model.base import InpaintModel +from iopaint.schema import InpaintRequest MANGA_INPAINTOR_MODEL_URL = os.environ.get( diff --git a/lama_cleaner/model/mat.py b/iopaint/model/mat.py similarity index 99% rename from lama_cleaner/model/mat.py rename to iopaint/model/mat.py index cc01284..c55c913 100644 --- a/lama_cleaner/model/mat.py +++ b/iopaint/model/mat.py @@ -8,14 +8,14 @@ import torch.nn as nn import torch.nn.functional as F import torch.utils.checkpoint as checkpoint -from lama_cleaner.helper import ( +from iopaint.helper import ( load_model, get_cache_path_by_url, norm_img, download_model, ) -from lama_cleaner.model.base import InpaintModel -from lama_cleaner.model.utils import ( +from iopaint.model.base import InpaintModel +from iopaint.model.utils import ( setup_filter, Conv2dLayer, FullyConnectedLayer, @@ -28,7 +28,7 @@ from lama_cleaner.model.utils import ( normalize_2nd_moment, set_seed, ) -from lama_cleaner.schema import InpaintRequest +from iopaint.schema import InpaintRequest class ModulatedConv2d(nn.Module): diff --git a/lama_cleaner/model/mi_gan.py b/iopaint/model/mi_gan.py similarity index 96% rename from lama_cleaner/model/mi_gan.py rename to iopaint/model/mi_gan.py index 923e6ba..a9605cc 100644 --- a/lama_cleaner/model/mi_gan.py +++ b/iopaint/model/mi_gan.py @@ -3,7 +3,7 @@ import os import cv2 import torch -from lama_cleaner.helper import ( +from iopaint.helper import ( load_jit_model, download_model, get_cache_path_by_url, @@ -11,8 +11,8 @@ from lama_cleaner.helper import ( resize_max_size, norm_img, ) -from lama_cleaner.model.base import InpaintModel -from lama_cleaner.schema import InpaintRequest +from iopaint.model.base import InpaintModel +from iopaint.schema import InpaintRequest MIGAN_MODEL_URL = os.environ.get( "MIGAN_MODEL_URL", diff --git a/lama_cleaner/model/opencv2.py b/iopaint/model/opencv2.py similarity index 87% rename from lama_cleaner/model/opencv2.py rename to iopaint/model/opencv2.py index b13a13d..9ab8e5c 100644 --- a/lama_cleaner/model/opencv2.py +++ b/iopaint/model/opencv2.py @@ -1,6 +1,6 @@ import cv2 -from lama_cleaner.model.base import InpaintModel -from lama_cleaner.schema import InpaintRequest +from iopaint.model.base import InpaintModel +from iopaint.schema import InpaintRequest flag_map = {"INPAINT_NS": cv2.INPAINT_NS, "INPAINT_TELEA": cv2.INPAINT_TELEA} diff --git a/lama_cleaner/model/paint_by_example.py b/iopaint/model/paint_by_example.py similarity index 94% rename from lama_cleaner/model/paint_by_example.py rename to iopaint/model/paint_by_example.py index a8cbdbb..0e5200c 100644 --- a/lama_cleaner/model/paint_by_example.py +++ b/iopaint/model/paint_by_example.py @@ -4,9 +4,9 @@ import cv2 import torch from loguru import logger -from lama_cleaner.helper import decode_base64_to_image -from lama_cleaner.model.base import DiffusionInpaintModel -from lama_cleaner.schema import InpaintRequest +from iopaint.helper import decode_base64_to_image +from iopaint.model.base import DiffusionInpaintModel +from iopaint.schema import InpaintRequest class PaintByExample(DiffusionInpaintModel): diff --git a/lama_cleaner/model/plms_sampler.py b/iopaint/model/plms_sampler.py similarity index 99% rename from lama_cleaner/model/plms_sampler.py rename to iopaint/model/plms_sampler.py index d9c0416..29450e5 100644 --- a/lama_cleaner/model/plms_sampler.py +++ b/iopaint/model/plms_sampler.py @@ -1,7 +1,7 @@ # From: https://github.com/CompVis/latent-diffusion/blob/main/ldm/models/diffusion/plms.py import torch import numpy as np -from lama_cleaner.model.utils import make_ddim_timesteps, make_ddim_sampling_parameters, noise_like +from iopaint.model.utils import make_ddim_timesteps, make_ddim_sampling_parameters, noise_like from tqdm import tqdm diff --git a/lama_cleaner/model/power_paint/__init__.py b/iopaint/model/power_paint/__init__.py similarity index 100% rename from lama_cleaner/model/power_paint/__init__.py rename to iopaint/model/power_paint/__init__.py diff --git a/lama_cleaner/model/power_paint/pipeline_powerpaint.py b/iopaint/model/power_paint/pipeline_powerpaint.py similarity index 100% rename from lama_cleaner/model/power_paint/pipeline_powerpaint.py rename to iopaint/model/power_paint/pipeline_powerpaint.py diff --git a/lama_cleaner/model/power_paint/pipeline_powerpaint_controlnet.py b/iopaint/model/power_paint/pipeline_powerpaint_controlnet.py similarity index 100% rename from lama_cleaner/model/power_paint/pipeline_powerpaint_controlnet.py rename to iopaint/model/power_paint/pipeline_powerpaint_controlnet.py diff --git a/lama_cleaner/model/power_paint/power_paint.py b/iopaint/model/power_paint/power_paint.py similarity index 93% rename from lama_cleaner/model/power_paint/power_paint.py rename to iopaint/model/power_paint/power_paint.py index d10ad95..174dbac 100644 --- a/lama_cleaner/model/power_paint/power_paint.py +++ b/iopaint/model/power_paint/power_paint.py @@ -4,10 +4,10 @@ import cv2 import torch from loguru import logger -from lama_cleaner.model.base import DiffusionInpaintModel -from lama_cleaner.model.helper.cpu_text_encoder import CPUTextEncoderWrapper -from lama_cleaner.model.utils import handle_from_pretrained_exceptions -from lama_cleaner.schema import InpaintRequest +from iopaint.model.base import DiffusionInpaintModel +from iopaint.model.helper.cpu_text_encoder import CPUTextEncoderWrapper +from iopaint.model.utils import handle_from_pretrained_exceptions +from iopaint.schema import InpaintRequest from .powerpaint_tokenizer import add_task_to_prompt diff --git a/lama_cleaner/model/power_paint/powerpaint_tokenizer.py b/iopaint/model/power_paint/powerpaint_tokenizer.py similarity index 99% rename from lama_cleaner/model/power_paint/powerpaint_tokenizer.py rename to iopaint/model/power_paint/powerpaint_tokenizer.py index 887ba29..39d5cb7 100644 --- a/lama_cleaner/model/power_paint/powerpaint_tokenizer.py +++ b/iopaint/model/power_paint/powerpaint_tokenizer.py @@ -5,7 +5,7 @@ import random from typing import Any, List, Optional, Union from transformers import CLIPTokenizer -from lama_cleaner.schema import PowerPaintTask +from iopaint.schema import PowerPaintTask def add_task_to_prompt(prompt, negative_prompt, task: PowerPaintTask): diff --git a/lama_cleaner/model/sd.py b/iopaint/model/sd.py similarity index 93% rename from lama_cleaner/model/sd.py rename to iopaint/model/sd.py index c3cad9e..f1a3086 100644 --- a/lama_cleaner/model/sd.py +++ b/iopaint/model/sd.py @@ -3,10 +3,10 @@ import cv2 import torch from loguru import logger -from lama_cleaner.model.base import DiffusionInpaintModel -from lama_cleaner.model.helper.cpu_text_encoder import CPUTextEncoderWrapper -from lama_cleaner.model.utils import handle_from_pretrained_exceptions -from lama_cleaner.schema import InpaintRequest, ModelType +from iopaint.model.base import DiffusionInpaintModel +from iopaint.model.helper.cpu_text_encoder import CPUTextEncoderWrapper +from iopaint.model.utils import handle_from_pretrained_exceptions +from iopaint.schema import InpaintRequest, ModelType class SD(DiffusionInpaintModel): diff --git a/lama_cleaner/model/sdxl.py b/iopaint/model/sdxl.py similarity index 94% rename from lama_cleaner/model/sdxl.py rename to iopaint/model/sdxl.py index 3d4a9b6..5675202 100644 --- a/lama_cleaner/model/sdxl.py +++ b/iopaint/model/sdxl.py @@ -6,9 +6,9 @@ import torch from diffusers import AutoencoderKL from loguru import logger -from lama_cleaner.model.base import DiffusionInpaintModel -from lama_cleaner.model.utils import handle_from_pretrained_exceptions -from lama_cleaner.schema import InpaintRequest, ModelType +from iopaint.model.base import DiffusionInpaintModel +from iopaint.model.utils import handle_from_pretrained_exceptions +from iopaint.schema import InpaintRequest, ModelType class SDXL(DiffusionInpaintModel): diff --git a/lama_cleaner/model/utils.py b/iopaint/model/utils.py similarity index 99% rename from lama_cleaner/model/utils.py rename to iopaint/model/utils.py index 509ed9b..178b71a 100644 --- a/lama_cleaner/model/utils.py +++ b/iopaint/model/utils.py @@ -27,7 +27,7 @@ from diffusers import ( from diffusers.configuration_utils import FrozenDict from loguru import logger -from lama_cleaner.schema import SDSampler +from iopaint.schema import SDSampler from torch import conv2d, conv_transpose2d diff --git a/lama_cleaner/model/zits.py b/iopaint/model/zits.py similarity index 98% rename from lama_cleaner/model/zits.py rename to iopaint/model/zits.py index 8858a88..16f9634 100644 --- a/lama_cleaner/model/zits.py +++ b/iopaint/model/zits.py @@ -5,11 +5,11 @@ import cv2 import torch import torch.nn.functional as F -from lama_cleaner.helper import get_cache_path_by_url, load_jit_model, download_model -from lama_cleaner.schema import InpaintRequest +from iopaint.helper import get_cache_path_by_url, load_jit_model, download_model +from iopaint.schema import InpaintRequest import numpy as np -from lama_cleaner.model.base import InpaintModel +from iopaint.model.base import InpaintModel ZITS_INPAINT_MODEL_URL = os.environ.get( "ZITS_INPAINT_MODEL_URL", diff --git a/lama_cleaner/model_info.py b/iopaint/model_info.py similarity index 94% rename from lama_cleaner/model_info.py rename to iopaint/model_info.py index d799b83..d3f6af9 100644 --- a/lama_cleaner/model_info.py +++ b/iopaint/model_info.py @@ -2,13 +2,13 @@ from typing import List from pydantic import computed_field, BaseModel -from lama_cleaner.const import ( +from iopaint.const import ( SDXL_CONTROLNET_CHOICES, SD2_CONTROLNET_CHOICES, SD_CONTROLNET_CHOICES, ) -from lama_cleaner.model import InstructPix2Pix, Kandinsky22, PowerPaint, SD2 -from lama_cleaner.schema import ModelType +from iopaint.model import InstructPix2Pix, Kandinsky22, PowerPaint, SD2 +from iopaint.schema import ModelType class ModelInfo(BaseModel): diff --git a/lama_cleaner/model_manager.py b/iopaint/model_manager.py similarity index 95% rename from lama_cleaner/model_manager.py rename to iopaint/model_manager.py index e73b8b7..89c91f0 100644 --- a/lama_cleaner/model_manager.py +++ b/iopaint/model_manager.py @@ -4,12 +4,12 @@ import torch from loguru import logger import numpy as np -from lama_cleaner.download import scan_models -from lama_cleaner.helper import switch_mps_device -from lama_cleaner.model import models, ControlNet, SD, SDXL -from lama_cleaner.model.utils import torch_gc -from lama_cleaner.model_info import ModelInfo, ModelType -from lama_cleaner.schema import InpaintRequest +from iopaint.download import scan_models +from iopaint.helper import switch_mps_device +from iopaint.model import models, ControlNet, SD, SDXL +from iopaint.model.utils import torch_gc +from iopaint.model_info import ModelInfo, ModelType +from iopaint.schema import InpaintRequest class ModelManager: diff --git a/lama_cleaner/plugins/__init__.py b/iopaint/plugins/__init__.py similarity index 100% rename from lama_cleaner/plugins/__init__.py rename to iopaint/plugins/__init__.py diff --git a/lama_cleaner/plugins/anime_seg.py b/iopaint/plugins/anime_seg.py similarity index 98% rename from lama_cleaner/plugins/anime_seg.py rename to iopaint/plugins/anime_seg.py index b4bb8b1..286564b 100644 --- a/lama_cleaner/plugins/anime_seg.py +++ b/iopaint/plugins/anime_seg.py @@ -5,9 +5,9 @@ import torch.nn.functional as F import numpy as np from PIL import Image -from lama_cleaner.helper import load_model -from lama_cleaner.plugins.base_plugin import BasePlugin -from lama_cleaner.schema import RunPluginRequest +from iopaint.helper import load_model +from iopaint.plugins.base_plugin import BasePlugin +from iopaint.schema import RunPluginRequest class REBNCONV(nn.Module): diff --git a/lama_cleaner/plugins/base_plugin.py b/iopaint/plugins/base_plugin.py similarity index 92% rename from lama_cleaner/plugins/base_plugin.py rename to iopaint/plugins/base_plugin.py index fecc613..13dfdad 100644 --- a/lama_cleaner/plugins/base_plugin.py +++ b/iopaint/plugins/base_plugin.py @@ -1,7 +1,7 @@ from loguru import logger import numpy as np -from lama_cleaner.schema import RunPluginRequest +from iopaint.schema import RunPluginRequest class BasePlugin: diff --git a/lama_cleaner/plugins/gfpgan_plugin.py b/iopaint/plugins/gfpgan_plugin.py similarity index 93% rename from lama_cleaner/plugins/gfpgan_plugin.py rename to iopaint/plugins/gfpgan_plugin.py index a94fba3..619280b 100644 --- a/lama_cleaner/plugins/gfpgan_plugin.py +++ b/iopaint/plugins/gfpgan_plugin.py @@ -2,9 +2,9 @@ import cv2 import numpy as np from loguru import logger -from lama_cleaner.helper import download_model -from lama_cleaner.plugins.base_plugin import BasePlugin -from lama_cleaner.schema import RunPluginRequest +from iopaint.helper import download_model +from iopaint.plugins.base_plugin import BasePlugin +from iopaint.schema import RunPluginRequest class GFPGANPlugin(BasePlugin): diff --git a/lama_cleaner/plugins/gfpganer.py b/iopaint/plugins/gfpganer.py similarity index 100% rename from lama_cleaner/plugins/gfpganer.py rename to iopaint/plugins/gfpganer.py diff --git a/lama_cleaner/plugins/interactive_seg.py b/iopaint/plugins/interactive_seg.py similarity index 90% rename from lama_cleaner/plugins/interactive_seg.py rename to iopaint/plugins/interactive_seg.py index 6bb1899..7c03ba5 100644 --- a/lama_cleaner/plugins/interactive_seg.py +++ b/iopaint/plugins/interactive_seg.py @@ -7,10 +7,10 @@ import numpy as np import torch from loguru import logger -from lama_cleaner.helper import download_model -from lama_cleaner.plugins.base_plugin import BasePlugin -from lama_cleaner.plugins.segment_anything import SamPredictor, sam_model_registry -from lama_cleaner.schema import RunPluginRequest +from iopaint.helper import download_model +from iopaint.plugins.base_plugin import BasePlugin +from iopaint.plugins.segment_anything import SamPredictor, sam_model_registry +from iopaint.schema import RunPluginRequest # 从小到大 SEGMENT_ANYTHING_MODELS = { diff --git a/lama_cleaner/plugins/realesrgan.py b/iopaint/plugins/realesrgan.py similarity index 94% rename from lama_cleaner/plugins/realesrgan.py rename to iopaint/plugins/realesrgan.py index d17942b..3f68303 100644 --- a/lama_cleaner/plugins/realesrgan.py +++ b/iopaint/plugins/realesrgan.py @@ -5,10 +5,10 @@ import numpy as np import torch from loguru import logger -from lama_cleaner.const import RealESRGANModel -from lama_cleaner.helper import download_model -from lama_cleaner.plugins.base_plugin import BasePlugin -from lama_cleaner.schema import RunPluginRequest +from iopaint.const import RealESRGANModel +from iopaint.helper import download_model +from iopaint.plugins.base_plugin import BasePlugin +from iopaint.schema import RunPluginRequest class RealESRGANUpscaler(BasePlugin): diff --git a/lama_cleaner/plugins/remove_bg.py b/iopaint/plugins/remove_bg.py similarity index 92% rename from lama_cleaner/plugins/remove_bg.py rename to iopaint/plugins/remove_bg.py index a462af5..55de64f 100644 --- a/lama_cleaner/plugins/remove_bg.py +++ b/iopaint/plugins/remove_bg.py @@ -3,8 +3,8 @@ import cv2 import numpy as np from torch.hub import get_dir -from lama_cleaner.plugins.base_plugin import BasePlugin -from lama_cleaner.schema import RunPluginRequest +from iopaint.plugins.base_plugin import BasePlugin +from iopaint.schema import RunPluginRequest class RemoveBG(BasePlugin): diff --git a/lama_cleaner/plugins/restoreformer.py b/iopaint/plugins/restoreformer.py similarity index 91% rename from lama_cleaner/plugins/restoreformer.py rename to iopaint/plugins/restoreformer.py index 39592af..4e1d3e7 100644 --- a/lama_cleaner/plugins/restoreformer.py +++ b/iopaint/plugins/restoreformer.py @@ -2,9 +2,9 @@ import cv2 import numpy as np from loguru import logger -from lama_cleaner.helper import download_model -from lama_cleaner.plugins.base_plugin import BasePlugin -from lama_cleaner.schema import RunPluginRequest +from iopaint.helper import download_model +from iopaint.plugins.base_plugin import BasePlugin +from iopaint.schema import RunPluginRequest class RestoreFormerPlugin(BasePlugin): diff --git a/lama_cleaner/plugins/segment_anything/__init__.py b/iopaint/plugins/segment_anything/__init__.py similarity index 100% rename from lama_cleaner/plugins/segment_anything/__init__.py rename to iopaint/plugins/segment_anything/__init__.py diff --git a/lama_cleaner/plugins/segment_anything/build_sam.py b/iopaint/plugins/segment_anything/build_sam.py similarity index 98% rename from lama_cleaner/plugins/segment_anything/build_sam.py rename to iopaint/plugins/segment_anything/build_sam.py index 2212c53..f8dea8e 100644 --- a/lama_cleaner/plugins/segment_anything/build_sam.py +++ b/iopaint/plugins/segment_anything/build_sam.py @@ -8,7 +8,7 @@ import torch from functools import partial -from lama_cleaner.plugins.segment_anything.modeling.tiny_vit_sam import TinyViT +from iopaint.plugins.segment_anything.modeling.tiny_vit_sam import TinyViT from .modeling import ( ImageEncoderViT, diff --git a/lama_cleaner/plugins/segment_anything/modeling/__init__.py b/iopaint/plugins/segment_anything/modeling/__init__.py similarity index 100% rename from lama_cleaner/plugins/segment_anything/modeling/__init__.py rename to iopaint/plugins/segment_anything/modeling/__init__.py diff --git a/lama_cleaner/plugins/segment_anything/modeling/common.py b/iopaint/plugins/segment_anything/modeling/common.py similarity index 100% rename from lama_cleaner/plugins/segment_anything/modeling/common.py rename to iopaint/plugins/segment_anything/modeling/common.py diff --git a/lama_cleaner/plugins/segment_anything/modeling/image_encoder.py b/iopaint/plugins/segment_anything/modeling/image_encoder.py similarity index 100% rename from lama_cleaner/plugins/segment_anything/modeling/image_encoder.py rename to iopaint/plugins/segment_anything/modeling/image_encoder.py diff --git a/lama_cleaner/plugins/segment_anything/modeling/mask_decoder.py b/iopaint/plugins/segment_anything/modeling/mask_decoder.py similarity index 100% rename from lama_cleaner/plugins/segment_anything/modeling/mask_decoder.py rename to iopaint/plugins/segment_anything/modeling/mask_decoder.py diff --git a/lama_cleaner/plugins/segment_anything/modeling/prompt_encoder.py b/iopaint/plugins/segment_anything/modeling/prompt_encoder.py similarity index 100% rename from lama_cleaner/plugins/segment_anything/modeling/prompt_encoder.py rename to iopaint/plugins/segment_anything/modeling/prompt_encoder.py diff --git a/lama_cleaner/plugins/segment_anything/modeling/sam.py b/iopaint/plugins/segment_anything/modeling/sam.py similarity index 100% rename from lama_cleaner/plugins/segment_anything/modeling/sam.py rename to iopaint/plugins/segment_anything/modeling/sam.py diff --git a/lama_cleaner/plugins/segment_anything/modeling/tiny_vit_sam.py b/iopaint/plugins/segment_anything/modeling/tiny_vit_sam.py similarity index 100% rename from lama_cleaner/plugins/segment_anything/modeling/tiny_vit_sam.py rename to iopaint/plugins/segment_anything/modeling/tiny_vit_sam.py diff --git a/lama_cleaner/plugins/segment_anything/modeling/transformer.py b/iopaint/plugins/segment_anything/modeling/transformer.py similarity index 100% rename from lama_cleaner/plugins/segment_anything/modeling/transformer.py rename to iopaint/plugins/segment_anything/modeling/transformer.py diff --git a/lama_cleaner/plugins/segment_anything/predictor.py b/iopaint/plugins/segment_anything/predictor.py similarity index 100% rename from lama_cleaner/plugins/segment_anything/predictor.py rename to iopaint/plugins/segment_anything/predictor.py diff --git a/lama_cleaner/plugins/segment_anything/utils/__init__.py b/iopaint/plugins/segment_anything/utils/__init__.py similarity index 100% rename from lama_cleaner/plugins/segment_anything/utils/__init__.py rename to iopaint/plugins/segment_anything/utils/__init__.py diff --git a/lama_cleaner/plugins/segment_anything/utils/transforms.py b/iopaint/plugins/segment_anything/utils/transforms.py similarity index 100% rename from lama_cleaner/plugins/segment_anything/utils/transforms.py rename to iopaint/plugins/segment_anything/utils/transforms.py diff --git a/lama_cleaner/runtime.py b/iopaint/runtime.py similarity index 97% rename from lama_cleaner/runtime.py rename to iopaint/runtime.py index d373dfc..268678b 100644 --- a/lama_cleaner/runtime.py +++ b/iopaint/runtime.py @@ -9,7 +9,7 @@ from loguru import logger from rich import print from typing import Dict, Any -from lama_cleaner.const import Device +from iopaint.const import Device _PY_VERSION: str = sys.version.split()[0].rstrip("+") @@ -28,7 +28,7 @@ _CANDIDATES = [ "transformers", "opencv-python", "accelerate", - "lama-cleaner", + "iopaint", "rembg", "realesrgan", "gfpgan", diff --git a/lama_cleaner/schema.py b/iopaint/schema.py similarity index 99% rename from lama_cleaner/schema.py rename to iopaint/schema.py index 65e11f4..000771b 100644 --- a/lama_cleaner/schema.py +++ b/iopaint/schema.py @@ -5,7 +5,7 @@ from typing import Optional, Literal, List from pydantic import BaseModel, Field, field_validator -from lama_cleaner.const import Device, InteractiveSegModel, RealESRGANModel +from iopaint.const import Device, InteractiveSegModel, RealESRGANModel class PluginInfo(BaseModel): diff --git a/lama_cleaner/tests/.gitignore b/iopaint/tests/.gitignore similarity index 100% rename from lama_cleaner/tests/.gitignore rename to iopaint/tests/.gitignore diff --git a/lama_cleaner/tests/__init__.py b/iopaint/tests/__init__.py similarity index 100% rename from lama_cleaner/tests/__init__.py rename to iopaint/tests/__init__.py diff --git a/lama_cleaner/tests/anime_test.png b/iopaint/tests/anime_test.png similarity index 100% rename from lama_cleaner/tests/anime_test.png rename to iopaint/tests/anime_test.png diff --git a/lama_cleaner/tests/bunny.jpeg b/iopaint/tests/bunny.jpeg similarity index 100% rename from lama_cleaner/tests/bunny.jpeg rename to iopaint/tests/bunny.jpeg diff --git a/lama_cleaner/tests/cat.png b/iopaint/tests/cat.png similarity index 100% rename from lama_cleaner/tests/cat.png rename to iopaint/tests/cat.png diff --git a/lama_cleaner/tests/icc_profile_test.jpg b/iopaint/tests/icc_profile_test.jpg similarity index 100% rename from lama_cleaner/tests/icc_profile_test.jpg rename to iopaint/tests/icc_profile_test.jpg diff --git a/lama_cleaner/tests/icc_profile_test.png b/iopaint/tests/icc_profile_test.png similarity index 100% rename from lama_cleaner/tests/icc_profile_test.png rename to iopaint/tests/icc_profile_test.png diff --git a/lama_cleaner/tests/image.png b/iopaint/tests/image.png similarity index 100% rename from lama_cleaner/tests/image.png rename to iopaint/tests/image.png diff --git a/lama_cleaner/tests/mask.png b/iopaint/tests/mask.png similarity index 100% rename from lama_cleaner/tests/mask.png rename to iopaint/tests/mask.png diff --git a/lama_cleaner/tests/overture-creations-5sI6fQgYIuo.png b/iopaint/tests/overture-creations-5sI6fQgYIuo.png similarity index 100% rename from lama_cleaner/tests/overture-creations-5sI6fQgYIuo.png rename to iopaint/tests/overture-creations-5sI6fQgYIuo.png diff --git a/lama_cleaner/tests/overture-creations-5sI6fQgYIuo_all_mask.png b/iopaint/tests/overture-creations-5sI6fQgYIuo_all_mask.png similarity index 100% rename from lama_cleaner/tests/overture-creations-5sI6fQgYIuo_all_mask.png rename to iopaint/tests/overture-creations-5sI6fQgYIuo_all_mask.png diff --git a/lama_cleaner/tests/overture-creations-5sI6fQgYIuo_mask.png b/iopaint/tests/overture-creations-5sI6fQgYIuo_mask.png similarity index 100% rename from lama_cleaner/tests/overture-creations-5sI6fQgYIuo_mask.png rename to iopaint/tests/overture-creations-5sI6fQgYIuo_mask.png diff --git a/lama_cleaner/tests/overture-creations-5sI6fQgYIuo_mask_blur.png b/iopaint/tests/overture-creations-5sI6fQgYIuo_mask_blur.png similarity index 100% rename from lama_cleaner/tests/overture-creations-5sI6fQgYIuo_mask_blur.png rename to iopaint/tests/overture-creations-5sI6fQgYIuo_mask_blur.png diff --git a/lama_cleaner/tests/png_parameter_test.png b/iopaint/tests/png_parameter_test.png similarity index 100% rename from lama_cleaner/tests/png_parameter_test.png rename to iopaint/tests/png_parameter_test.png diff --git a/lama_cleaner/tests/test_adjust_mask.py b/iopaint/tests/test_adjust_mask.py similarity index 83% rename from lama_cleaner/tests/test_adjust_mask.py rename to iopaint/tests/test_adjust_mask.py index 33de61e..dfa8040 100644 --- a/lama_cleaner/tests/test_adjust_mask.py +++ b/iopaint/tests/test_adjust_mask.py @@ -1,6 +1,6 @@ import cv2 -from lama_cleaner.helper import adjust_mask -from lama_cleaner.tests.utils import current_dir, save_dir +from iopaint.helper import adjust_mask +from iopaint.tests.utils import current_dir, save_dir mask_p = current_dir / "overture-creations-5sI6fQgYIuo_mask.png" diff --git a/lama_cleaner/tests/test_controlnet.py b/iopaint/tests/test_controlnet.py similarity index 92% rename from lama_cleaner/tests/test_controlnet.py rename to iopaint/tests/test_controlnet.py index 052a7d7..4f5f800 100644 --- a/lama_cleaner/tests/test_controlnet.py +++ b/iopaint/tests/test_controlnet.py @@ -1,7 +1,7 @@ import os -from lama_cleaner.const import SD_CONTROLNET_CHOICES -from lama_cleaner.tests.utils import current_dir, check_device, get_config, assert_equal +from iopaint.const import SD_CONTROLNET_CHOICES +from iopaint.tests.utils import current_dir, check_device, get_config, assert_equal os.environ["PYTORCH_ENABLE_MPS_FALLBACK"] = "1" from pathlib import Path @@ -9,8 +9,8 @@ from pathlib import Path import pytest import torch -from lama_cleaner.model_manager import ModelManager -from lama_cleaner.schema import HDStrategy, SDSampler +from iopaint.model_manager import ModelManager +from iopaint.schema import HDStrategy, SDSampler model_name = "runwayml/stable-diffusion-inpainting" diff --git a/lama_cleaner/tests/test_instruct_pix2pix.py b/iopaint/tests/test_instruct_pix2pix.py similarity index 85% rename from lama_cleaner/tests/test_instruct_pix2pix.py rename to iopaint/tests/test_instruct_pix2pix.py index 7f6c927..7354902 100644 --- a/lama_cleaner/tests/test_instruct_pix2pix.py +++ b/iopaint/tests/test_instruct_pix2pix.py @@ -3,9 +3,9 @@ from pathlib import Path import pytest import torch -from lama_cleaner.model_manager import ModelManager -from lama_cleaner.schema import HDStrategy -from lama_cleaner.tests.utils import get_config, check_device, assert_equal, current_dir +from iopaint.model_manager import ModelManager +from iopaint.schema import HDStrategy +from iopaint.tests.utils import get_config, check_device, assert_equal, current_dir model_name = "timbrooks/instruct-pix2pix" diff --git a/lama_cleaner/tests/test_load_img.py b/iopaint/tests/test_load_img.py similarity index 83% rename from lama_cleaner/tests/test_load_img.py rename to iopaint/tests/test_load_img.py index b156c78..f7071bf 100644 --- a/lama_cleaner/tests/test_load_img.py +++ b/iopaint/tests/test_load_img.py @@ -1,5 +1,5 @@ -from lama_cleaner.helper import load_img -from lama_cleaner.tests.utils import current_dir +from iopaint.helper import load_img +from iopaint.tests.utils import current_dir png_img_p = current_dir / "image.png" jpg_img_p = current_dir / "bunny.jpeg" diff --git a/lama_cleaner/tests/test_model.py b/iopaint/tests/test_model.py similarity index 96% rename from lama_cleaner/tests/test_model.py rename to iopaint/tests/test_model.py index 6b0ceb7..dd84b12 100644 --- a/lama_cleaner/tests/test_model.py +++ b/iopaint/tests/test_model.py @@ -1,9 +1,9 @@ import pytest import torch -from lama_cleaner.model_manager import ModelManager -from lama_cleaner.schema import HDStrategy, LDMSampler -from lama_cleaner.tests.utils import assert_equal, get_config, current_dir, check_device +from iopaint.model_manager import ModelManager +from iopaint.schema import HDStrategy, LDMSampler +from iopaint.tests.utils import assert_equal, get_config, current_dir, check_device @pytest.mark.parametrize("device", ["cuda", "mps", "cpu"]) diff --git a/lama_cleaner/tests/test_model_md5.py b/iopaint/tests/test_model_md5.py similarity index 77% rename from lama_cleaner/tests/test_model_md5.py rename to iopaint/tests/test_model_md5.py index 928a6de..3a81d72 100644 --- a/lama_cleaner/tests/test_model_md5.py +++ b/iopaint/tests/test_model_md5.py @@ -1,6 +1,6 @@ def test_load_model(): - from lama_cleaner.plugins import InteractiveSeg - from lama_cleaner.model_manager import ModelManager + from iopaint.plugins import InteractiveSeg + from iopaint.model_manager import ModelManager interactive_seg_model = InteractiveSeg("vit_l", "cpu") diff --git a/lama_cleaner/tests/test_model_switch.py b/iopaint/tests/test_model_switch.py similarity index 94% rename from lama_cleaner/tests/test_model_switch.py rename to iopaint/tests/test_model_switch.py index a360566..735e1bd 100644 --- a/lama_cleaner/tests/test_model_switch.py +++ b/iopaint/tests/test_model_switch.py @@ -1,12 +1,12 @@ import os -from lama_cleaner.schema import InpaintRequest +from iopaint.schema import InpaintRequest os.environ["PYTORCH_ENABLE_MPS_FALLBACK"] = "1" import torch -from lama_cleaner.model_manager import ModelManager +from iopaint.model_manager import ModelManager def test_model_switch(): diff --git a/lama_cleaner/tests/test_outpainting.py b/iopaint/tests/test_outpainting.py similarity index 94% rename from lama_cleaner/tests/test_outpainting.py rename to iopaint/tests/test_outpainting.py index f261b3c..a84a1ec 100644 --- a/lama_cleaner/tests/test_outpainting.py +++ b/iopaint/tests/test_outpainting.py @@ -1,6 +1,6 @@ import os -from lama_cleaner.tests.utils import current_dir, check_device +from iopaint.tests.utils import current_dir, check_device os.environ["PYTORCH_ENABLE_MPS_FALLBACK"] = "1" from pathlib import Path @@ -8,9 +8,9 @@ from pathlib import Path import pytest import torch -from lama_cleaner.model_manager import ModelManager -from lama_cleaner.schema import HDStrategy, SDSampler -from lama_cleaner.tests.test_model import get_config, assert_equal +from iopaint.model_manager import ModelManager +from iopaint.schema import HDStrategy, SDSampler +from iopaint.tests.test_model import get_config, assert_equal @pytest.mark.parametrize("name", ["runwayml/stable-diffusion-inpainting"]) diff --git a/lama_cleaner/tests/test_paint_by_example.py b/iopaint/tests/test_paint_by_example.py similarity index 91% rename from lama_cleaner/tests/test_paint_by_example.py rename to iopaint/tests/test_paint_by_example.py index c642c4c..27b8a77 100644 --- a/lama_cleaner/tests/test_paint_by_example.py +++ b/iopaint/tests/test_paint_by_example.py @@ -2,9 +2,9 @@ import cv2 import pytest from PIL import Image -from lama_cleaner.model_manager import ModelManager -from lama_cleaner.schema import HDStrategy -from lama_cleaner.tests.utils import ( +from iopaint.model_manager import ModelManager +from iopaint.schema import HDStrategy +from iopaint.tests.utils import ( current_dir, get_config, get_data, diff --git a/lama_cleaner/tests/test_plugins.py b/iopaint/tests/test_plugins.py similarity index 92% rename from lama_cleaner/tests/test_plugins.py rename to iopaint/tests/test_plugins.py index 8f7e8ea..c481cb1 100644 --- a/lama_cleaner/tests/test_plugins.py +++ b/iopaint/tests/test_plugins.py @@ -3,17 +3,17 @@ import os import time from PIL import Image -from lama_cleaner.helper import encode_pil_to_base64, gen_frontend_mask -from lama_cleaner.plugins.anime_seg import AnimeSeg -from lama_cleaner.schema import RunPluginRequest -from lama_cleaner.tests.utils import check_device, current_dir, save_dir +from iopaint.helper import encode_pil_to_base64, gen_frontend_mask +from iopaint.plugins.anime_seg import AnimeSeg +from iopaint.schema import RunPluginRequest +from iopaint.tests.utils import check_device, current_dir, save_dir os.environ["PYTORCH_ENABLE_MPS_FALLBACK"] = "1" import cv2 import pytest -from lama_cleaner.plugins import ( +from iopaint.plugins import ( RemoveBG, RealESRGANUpscaler, GFPGANPlugin, diff --git a/lama_cleaner/tests/test_save_exif.py b/iopaint/tests/test_save_exif.py similarity index 96% rename from lama_cleaner/tests/test_save_exif.py rename to iopaint/tests/test_save_exif.py index 31e76ca..5c19810 100644 --- a/lama_cleaner/tests/test_save_exif.py +++ b/iopaint/tests/test_save_exif.py @@ -5,7 +5,7 @@ from typing import List from PIL import Image -from lama_cleaner.helper import pil_to_bytes, load_img +from iopaint.helper import pil_to_bytes, load_img current_dir = Path(__file__).parent.absolute().resolve() diff --git a/lama_cleaner/tests/test_sd_model.py b/iopaint/tests/test_sd_model.py similarity index 97% rename from lama_cleaner/tests/test_sd_model.py rename to iopaint/tests/test_sd_model.py index b94a3ef..4aeaaa2 100644 --- a/lama_cleaner/tests/test_sd_model.py +++ b/iopaint/tests/test_sd_model.py @@ -2,7 +2,7 @@ import os from loguru import logger -from lama_cleaner.tests.utils import check_device, get_config, assert_equal +from iopaint.tests.utils import check_device, get_config, assert_equal os.environ["PYTORCH_ENABLE_MPS_FALLBACK"] = "1" from pathlib import Path @@ -10,8 +10,8 @@ from pathlib import Path import pytest import torch -from lama_cleaner.model_manager import ModelManager -from lama_cleaner.schema import HDStrategy, SDSampler, FREEUConfig +from iopaint.model_manager import ModelManager +from iopaint.schema import HDStrategy, SDSampler, FREEUConfig current_dir = Path(__file__).parent.absolute().resolve() save_dir = current_dir / "result" diff --git a/lama_cleaner/tests/test_sdxl.py b/iopaint/tests/test_sdxl.py similarity index 93% rename from lama_cleaner/tests/test_sdxl.py rename to iopaint/tests/test_sdxl.py index 506c963..d99fc44 100644 --- a/lama_cleaner/tests/test_sdxl.py +++ b/iopaint/tests/test_sdxl.py @@ -1,15 +1,15 @@ import os -from lama_cleaner.tests.utils import check_device, current_dir +from iopaint.tests.utils import check_device, current_dir os.environ["PYTORCH_ENABLE_MPS_FALLBACK"] = "1" import pytest import torch -from lama_cleaner.model_manager import ModelManager -from lama_cleaner.schema import HDStrategy, SDSampler, FREEUConfig -from lama_cleaner.tests.test_model import get_config, assert_equal +from iopaint.model_manager import ModelManager +from iopaint.schema import HDStrategy, SDSampler, FREEUConfig +from iopaint.tests.test_model import get_config, assert_equal @pytest.mark.parametrize("device", ["cuda", "mps"]) diff --git a/lama_cleaner/tests/utils.py b/iopaint/tests/utils.py similarity index 94% rename from lama_cleaner/tests/utils.py rename to iopaint/tests/utils.py index 342e179..dc3afda 100644 --- a/lama_cleaner/tests/utils.py +++ b/iopaint/tests/utils.py @@ -3,8 +3,8 @@ import cv2 import pytest import torch -from lama_cleaner.helper import encode_pil_to_base64 -from lama_cleaner.schema import LDMSampler, HDStrategy, InpaintRequest, SDSampler +from iopaint.helper import encode_pil_to_base64 +from iopaint.schema import LDMSampler, HDStrategy, InpaintRequest, SDSampler from PIL import Image current_dir = Path(__file__).parent.absolute().resolve() diff --git a/lama_cleaner/web_config.py b/iopaint/web_config.py similarity index 99% rename from lama_cleaner/web_config.py rename to iopaint/web_config.py index 49f724d..d3da8d0 100644 --- a/lama_cleaner/web_config.py +++ b/iopaint/web_config.py @@ -5,7 +5,7 @@ from datetime import datetime import gradio as gr from loguru import logger -from lama_cleaner.const import * +from iopaint.const import * _config_file = None diff --git a/main.py b/main.py index f57b35f..3b76d32 100644 --- a/main.py +++ b/main.py @@ -1,4 +1,4 @@ -from lama_cleaner import entry_point +from iopaint import entry_point if __name__ == "__main__": entry_point() diff --git a/publish.sh b/publish.sh index 0e76da0..70eb4d9 100644 --- a/publish.sh +++ b/publish.sh @@ -4,6 +4,8 @@ set -e pushd ./web_app npm run build popd +rm -r ./iopaint/web_app +cp -r web_app/dist ./iopaint/web_app rm -r -f dist python3 setup.py sdist bdist_wheel diff --git a/requirements.txt b/requirements.txt index e62ff5d..54907f3 100644 --- a/requirements.txt +++ b/requirements.txt @@ -6,7 +6,6 @@ safetensors controlnet-aux==0.0.3 fastapi==0.108.0 python-socketio==5.7.2 -flaskwebgui==0.3.5 typer pydantic rich diff --git a/setup.py b/setup.py index 013e5da..fc79fb2 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,7 @@ import setuptools from pathlib import Path -web_files = Path("lama_cleaner/app/build/").glob("**/*") +web_files = Path("iopaint/app/build/").glob("**/*") web_files = [str(it).replace("lama_cleaner/", "") for it in web_files] with open("README.md", "r", encoding="utf-8") as fh: @@ -20,19 +20,19 @@ def load_requirements(): # https://setuptools.readthedocs.io/en/latest/setuptools.html#including-data-files setuptools.setup( - name="lama-cleaner", - version="1.2.4", + name="IOPaint", + version="1.0.0", author="PanicByte", author_email="cwq1913@gmail.com", - description="Image inpainting tool powered by SOTA AI Model", + description="Image inpainting, outpainting tool powered by SOTA AI Model", long_description=long_description, long_description_content_type="text/markdown", url="https://github.com/Sanster/lama-cleaner", packages=setuptools.find_packages("./"), - package_data={"lama_cleaner": web_files}, + package_data={"iopaint": web_files}, install_requires=load_requirements(), python_requires=">=3.7", - entry_points={"console_scripts": ["lama-cleaner=lama_cleaner:entry_point"]}, + entry_points={"console_scripts": ["iopaint=iopaint:entry_point"]}, classifiers=[ "License :: OSI Approved :: Apache Software License", "Operating System :: OS Independent",