diff --git a/scripts/launch.py b/launch.py similarity index 95% rename from scripts/launch.py rename to launch.py index e26a930..f3fef5e 100644 --- a/scripts/launch.py +++ b/launch.py @@ -2,8 +2,8 @@ import gradio as gr import sys import cv2 -from td_abg import get_foreground -from convertor import pil2cv +from scripts.td_abg import get_foreground +from scripts.convertor import pil2cv diff --git a/scripts/__pycache__/convertor.cpython-310.pyc b/scripts/__pycache__/convertor.cpython-310.pyc new file mode 100644 index 0000000..b0e678d Binary files /dev/null and b/scripts/__pycache__/convertor.cpython-310.pyc differ diff --git a/scripts/__pycache__/td_abg.cpython-310.pyc b/scripts/__pycache__/td_abg.cpython-310.pyc new file mode 100644 index 0000000..b23a4cd Binary files /dev/null and b/scripts/__pycache__/td_abg.cpython-310.pyc differ diff --git a/scripts/main.py b/scripts/main.py index db3ae85..e8463b6 100644 --- a/scripts/main.py +++ b/scripts/main.py @@ -9,22 +9,10 @@ import gradio as gr import modules.scripts as scripts from modules import script_callbacks -from td_abg import get_foreground -from convertor import pil2cv +from scripts.td_abg import get_foreground +from scripts.convertor import pil2cv -""" -body_estimation = None -presets_file = os.path.join(scripts.basedir(), "presets.json") -presets = {} - -try: - with open(presets_file) as file: - presets = json.load(file) -except FileNotFoundError: - pass -""" - def processing(self, input_image, td_abg_enabled, h_split, v_split, n_cluster, alpha, th_rate, cascadePSP_enabled, fast, psp_L): image = pil2cv(input_image) image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB) @@ -49,15 +37,15 @@ def on_ui_tabs(): with gr.Row(): with gr.Column(): input_image = gr.Image(type="pil") - with gr.Accordion("tile division ABG", open=True): + with gr.Accordion("tile division BG Remover", open=True): with gr.Box(): - td_abg_enabled = gr.Checkbox(label="enabled", show_label=True) - h_split = gr.Slider(1, 2048, value=256, step=4, label="horizontal split num", show_label=True) - v_split = gr.Slider(1, 2048, value=256, step=4, label="vertical split num", show_label=True) - - n_cluster = gr.Slider(1, 1000, value=500, step=10, label="cluster num", show_label=True) - alpha = gr.Slider(1, 255, value=100, step=1, label="alpha threshold", show_label=True) - th_rate = gr.Slider(0, 1, value=0.1, step=0.01, label="mask content ratio", show_label=True) + td_abg_enabled = gr.Checkbox(label="enabled", show_label=True) + h_split = gr.Slider(1, 2048, value=256, step=4, label="horizontal split num", show_label=True) + v_split = gr.Slider(1, 2048, value=256, step=4, label="vertical split num", show_label=True) + + n_cluster = gr.Slider(1, 1000, value=500, step=10, label="cluster num", show_label=True) + alpha = gr.Slider(1, 255, value=50, step=1, label="alpha threshold", show_label=True) + th_rate = gr.Slider(0, 1, value=0.1, step=0.01, label="mask content ratio", show_label=True) with gr.Accordion("cascadePSP", open=True): with gr.Box(): diff --git a/scripts/td_abg.py b/scripts/td_abg.py index 7c1eba6..257626a 100644 --- a/scripts/td_abg.py +++ b/scripts/td_abg.py @@ -4,7 +4,7 @@ import numpy as np import pandas as pd from sklearn.cluster import KMeans, MiniBatchKMeans -from convertor import rgb2df, df2rgba, cv2pil +from scripts.convertor import rgb2df, df2rgba import gradio as gr import huggingface_hub