diff --git a/README.md b/README.md index a2724e8d4df21d1f34b5b5c2abbcdf5cd9077284..31348d266c8c438a206902255b88b5d77e64ec9f 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,9 @@ --- title: Lama Cleaner Demo -emoji: 📈 -colorFrom: blue -colorTo: pink -sdk: gradio -sdk_version: 3.23.0 -app_file: app.py +emoji: 👀 +colorFrom: purple +colorTo: purple +sdk: docker pinned: false license: apache-2.0 --- diff --git a/__init__.py b/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..2f0b62348e3ce8ca4b30d03712597fd0970b9159 --- /dev/null +++ b/__init__.py @@ -0,0 +1,11 @@ +import warnings +warnings.simplefilter("ignore", UserWarning) + +from parse_args import parse_args + +def entry_point(): + args = parse_args() + # 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.server import main + main(args) diff --git a/app.py b/app.py new file mode 100644 index 0000000000000000000000000000000000000000..3cf2f16c370e3476278c13a1fed0c900272d26d3 --- /dev/null +++ b/app.py @@ -0,0 +1,53 @@ +from typing import List + +from pydantic import BaseModel +from server import main +""" +LAMA Cleaner是一款用于图像去噪的工具,它使用了一种称为“局部自适应均值”的算法来去除图像中的噪声。 +在使用LAMA Cleaner时,您需要提供一个掩码图像,以指示哪些区域需要去噪,哪些区域不需要去噪。 +掩码图像可以是任何格式的图像文件,例如PNG、JPEG或BMP。 +您可以使用任何图像编辑软件(例如Photoshop或GIMP)创建掩码图像。在掩码图像中,您需要使用黑色和白色来表示需要去噪和不需要去噪的区域。黑色表示需要去噪的区域,白色表示不需要去噪的区域。 + +创建掩码图像的步骤如下: + +1、打开您要去噪的图像和一个空白图像。 +2、在空白图像上使用画笔工具绘制黑色和白色的区域,以指示需要去噪和不需要去噪的区域。 +3、将掩码图像保存为PNG、JPEG或BMP格式。 +4、在使用LAMA Cleaner时,将掩码图像作为输入参数传递给它。 +请注意,掩码图像的质量对去噪效果有很大影响。因此,您需要花费一些时间来创建一个准确的掩码图像,以获得最佳的去噪效果。 + + +输入图像:要去噪的原始图像。 +掩码图像:指示哪些区域需要去噪,哪些区域不需要去噪的掩码图像。掩码图像可以是任何格式的图像文件,例如PNG、JPEG或BMP。在掩码图像中,您需要使用黑色和白色来表示需要去噪和不需要去噪的区域。黑色表示需要去噪的区域,白色表示不需要去噪的区域。 +块大小:用于计算局部均值的块的大小。块大小越大,去噪效果越好,但计算时间也会增加。 +块步长:用于计算局部均值的块的步长。步长越小,去噪效果越好,但计算时间也会增加。 +搜索窗口大小:用于搜索最佳匹配块的窗口大小。窗口大小越大,去噪效果越好,但计算时间也会增加。 +相似度阈值:用于确定最佳匹配块的相似度阈值。相似度阈值越小,去噪效果越好,但计算时间也会增加。 +去噪强度:控制去噪的强度。去噪强度越大,去噪效果越好,但可能会导致图像细节的丢失。 +请注意,这些参数的最佳值取决于您的图像和应用场景。您需要根据实际情况进行调整,以获得最佳的去噪效果。 +""" +class FakeArgs(BaseModel): + host: str = "127.0.0.1" + port: int = 7860 + model: str = 'lama' # 使用的模型 + hf_access_token: str = "" + sd_disable_nsfw: bool = False # 禁用稳定扩散NSFW检查器。 + sd_cpu_textencoder: bool = True # 始终在CPU上运行稳定扩散TextEncoder模型。 + sd_run_local: bool = False + sd_enable_xformers: bool = False + local_files_only: bool = False + cpu_offload: bool = False + device: str = "cpu" # CUDA /中央处理器/多处理器 + gui: bool = False + gui_size: List[int] = [1000, 1000] + input: str = '' + disable_model_switch: bool = False + debug: bool = False + no_half: bool = False + disable_nsfw: bool = False + enable_xformers: bool = False + model_dir: str = "" + output_dir: str = "resources" # 自己指定文件上传的位置 + +if __name__ == "__main__": + main(FakeArgs()) \ No newline at end of file diff --git a/app/build/asset-manifest.json b/app/build/asset-manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..d9a1fef82f99a97cba03c3b4f387b252a9e9c6b4 --- /dev/null +++ b/app/build/asset-manifest.json @@ -0,0 +1,16 @@ +{ + "files": { + "main.css": "/static/css/main.e24c9a9b.css", + "main.js": "/static/js/main.ca662570.js", + "static/media/coffee-machine-lineal.gif": "/static/media/coffee-machine-lineal.ee32631219cc3986f861.gif", + "static/media/WorkSans-SemiBold.ttf": "/static/media/WorkSans-SemiBold.1e98db4eb705b586728e.ttf", + "static/media/WorkSans-Bold.ttf": "/static/media/WorkSans-Bold.2bea7a7f7d052c74da25.ttf", + "static/media/WorkSans-Regular.ttf": "/static/media/WorkSans-Regular.bb287b894b27372d8ea7.ttf", + "static/media/WorkSans-Black.ttf": "/static/media/WorkSans-Black.67c2c5a144333953880b.ttf", + "index.html": "/index.html" + }, + "entrypoints": [ + "static/css/main.e24c9a9b.css", + "static/js/main.ca662570.js" + ] +} \ No newline at end of file diff --git a/app/build/index.html b/app/build/index.html new file mode 100644 index 0000000000000000000000000000000000000000..f819e7a14140740aefceef062ef32007f968918e --- /dev/null +++ b/app/build/index.html @@ -0,0 +1,18 @@ + + +
+ + + + + + +