mirror of
https://github.com/vladmandic/automatic
synced 2026-09-19 01:04:32 +02:00
allow upscalers in subfolders
This commit is contained in:
+6
-2
@@ -53,9 +53,12 @@ class Upscaler:
|
||||
|
||||
def find_folder(self, folder, scalers, loaded):
|
||||
for fn in os.listdir(folder): # from folder
|
||||
if not fn.endswith('.pth') and not fn.endswith('.pt'):
|
||||
continue
|
||||
file_name = os.path.join(folder, fn)
|
||||
if os.path.isdir(file_name):
|
||||
self.find_folder(file_name, scalers, loaded)
|
||||
continue
|
||||
if not file_name.endswith('.pth') and not file_name.endswith('.pt'):
|
||||
continue
|
||||
if file_name not in loaded:
|
||||
model_name = os.path.splitext(fn)[0]
|
||||
scaler = UpscalerData(name=f'{self.name} {model_name}', path=file_name, upscaler=self)
|
||||
@@ -63,6 +66,7 @@ class Upscaler:
|
||||
scalers.append(scaler)
|
||||
loaded.append(file_name)
|
||||
modules.shared.log.debug(f'Upscaler type={self.name} folder="{folder}" model="{model_name}" path="{file_name}"')
|
||||
print(f'Upscaler type={self.name} folder="{folder}" model="{model_name}" path="{file_name}"')
|
||||
|
||||
def find_scalers(self):
|
||||
scalers = []
|
||||
|
||||
@@ -16,7 +16,7 @@ class ScriptPostprocessingUpscale(scripts_postprocessing.ScriptPostprocessing):
|
||||
with FormRow(elem_id="extras_upscale"):
|
||||
with gr.Tabs(elem_id="extras_resize_mode"):
|
||||
with gr.TabItem('Scale by', elem_id="extras_scale_by_tab") as tab_scale_by:
|
||||
upscaling_resize = gr.Slider(minimum=1.0, maximum=8.0, step=0.05, label="Resize", value=4, elem_id="extras_upscaling_resize")
|
||||
upscaling_resize = gr.Slider(minimum=1.0, maximum=8.0, step=0.05, label="Resize", value=2.0, elem_id="extras_upscaling_resize")
|
||||
|
||||
with gr.TabItem('Scale to', elem_id="extras_scale_to_tab") as tab_scale_to:
|
||||
with FormRow():
|
||||
|
||||
Reference in New Issue
Block a user