-
Notifications
You must be signed in to change notification settings - Fork 29
/
ia_ui_items.py
110 lines (93 loc) · 2.52 KB
/
ia_ui_items.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
from huggingface_hub import scan_cache_dir
def get_sampler_names():
"""Get sampler name list.
Returns:
list: sampler name list
"""
sampler_names = [
"DDIM",
"Euler",
"Euler a",
"DPM2 Karras",
"DPM2 a Karras",
]
return sampler_names
def get_sam_model_ids():
"""Get SAM model ids list.
Returns:
list: SAM model ids list
"""
sam_model_ids = [
"sam2_hiera_large.pt",
"sam2_hiera_base_plus.pt",
"sam2_hiera_small.pt",
"sam2_hiera_tiny.pt",
"sam_vit_h_4b8939.pth",
"sam_vit_l_0b3195.pth",
"sam_vit_b_01ec64.pth",
"sam_hq_vit_h.pth",
"sam_hq_vit_l.pth",
"sam_hq_vit_b.pth",
"FastSAM-x.pt",
"FastSAM-s.pt",
"mobile_sam.pt",
]
return sam_model_ids
inp_list_from_cache = None
def get_inp_model_ids():
"""Get inpainting model ids list.
Returns:
list: model ids list
"""
global inp_list_from_cache
model_ids = [
"stabilityai/stable-diffusion-2-inpainting",
"Uminosachi/dreamshaper_8Inpainting",
"Uminosachi/deliberate_v3-inpainting",
"Uminosachi/realisticVisionV51_v51VAE-inpainting",
"Uminosachi/revAnimated_v121Inp-inpainting",
"runwayml/stable-diffusion-inpainting",
]
if inp_list_from_cache is not None and isinstance(inp_list_from_cache, list):
model_ids.extend(inp_list_from_cache)
return model_ids
try:
hf_cache_info = scan_cache_dir()
inpaint_repos = []
for repo in hf_cache_info.repos:
if repo.repo_type == "model" and "inpaint" in repo.repo_id.lower() and repo.repo_id not in model_ids:
inpaint_repos.append(repo.repo_id)
inp_list_from_cache = sorted(inpaint_repos, reverse=True, key=lambda x: x.split("/")[-1])
model_ids.extend(inp_list_from_cache)
return model_ids
except Exception:
return model_ids
def get_cleaner_model_ids():
"""Get cleaner model ids list.
Returns:
list: model ids list
"""
model_ids = [
"lama",
"ldm",
"zits",
"mat",
"fcf",
"manga",
]
return model_ids
def get_padding_mode_names():
"""Get padding mode name list.
Returns:
list: padding mode name list
"""
padding_mode_names = [
"constant",
"edge",
"reflect",
"mean",
"median",
"maximum",
"minimum",
]
return padding_mode_names