diff --git a/scripts/deoldify_base.py b/scripts/deoldify_base.py new file mode 100644 index 0000000..94454c4 --- /dev/null +++ b/scripts/deoldify_base.py @@ -0,0 +1,26 @@ +''' +Author: SpenserCai +Date: 2023-08-09 09:58:27 +version: +LastEditors: SpenserCai +LastEditTime: 2023-08-09 10:00:43 +Description: file content +''' +from modules import shared +from deoldify import device as deoldify_device +from deoldify.device_id import DeviceId + +device_id = shared.cmd_opts.device_id + +if device_id is not None: + device_id = DeviceId(int(device_id)) + deoldify_device.set(device=device_id) +else: + deoldify_device.set(device=DeviceId.GPU0) + +from deoldify.visualize import * + +import warnings +warnings.filterwarnings("ignore", category=UserWarning, message=".*?Your .*? set is empty.*?") +warnings.filterwarnings("ignore", category=UserWarning, message="The parameter 'pretrained' is deprecated since 0.13 and may be removed in the future, please use 'weights' instead.") +warnings.filterwarnings("ignore", category=FutureWarning, message="Arguments other than a weight enum or `None`.*?") \ No newline at end of file diff --git a/scripts/postprocessing_deoldify.py b/scripts/postprocessing_deoldify.py index 7e5e6e1..6a02b5c 100644 --- a/scripts/postprocessing_deoldify.py +++ b/scripts/postprocessing_deoldify.py @@ -3,33 +3,14 @@ Author: SpenserCai Date: 2023-07-28 14:41:28 version: LastEditors: SpenserCai -LastEditTime: 2023-08-07 21:59:43 +LastEditTime: 2023-08-09 10:00:46 Description: file content ''' # DeOldify UI & Processing from modules import scripts_postprocessing,shared, paths_internal -import gradio as gr - from modules.ui_components import FormRow - -from deoldify import device as deoldify_device -from deoldify.device_id import DeviceId -from PIL import Image - -device_id = shared.cmd_opts.device_id - -if device_id is not None: - device_id = DeviceId(int(device_id)) - deoldify_device.set(device=device_id) -else: - deoldify_device.set(device=DeviceId.GPU0) - -from deoldify.visualize import * - -import warnings -warnings.filterwarnings("ignore", category=UserWarning, message=".*?Your .*? set is empty.*?") -warnings.filterwarnings("ignore", category=UserWarning, message="The parameter 'pretrained' is deprecated since 0.13 and may be removed in the future, please use 'weights' instead.") -warnings.filterwarnings("ignore", category=FutureWarning, message="Arguments other than a weight enum or `None`.*?") +from .deoldify_base import * +import gradio as gr class ScriptPostprocessingUpscale(scripts_postprocessing.ScriptPostprocessing): name = "Deoldify"