Spaces:
Running
Running
Upload 3 files
Browse files- all_models2.py +129 -0
- app3.py +371 -0
- blacklist.py +35 -0
all_models2.py
ADDED
@@ -0,0 +1,129 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from blacklist import bad_tags,bad_models,fav_models
|
2 |
+
models = []
|
3 |
+
models_plus_tags=[]
|
4 |
+
tags_plus_models=[]
|
5 |
+
|
6 |
+
|
7 |
+
def list_uniq(l):
|
8 |
+
return sorted(set(l), key=l.index)
|
9 |
+
|
10 |
+
def find_model_list(author: str="", tags: list[str]=[], not_tag="", sort: str="last_modified", limit: int=30, force_gpu=False, check_status=False, bad_models=bad_models):
|
11 |
+
from huggingface_hub import HfApi
|
12 |
+
api = HfApi()
|
13 |
+
default_tags = ["diffusers"]
|
14 |
+
if not sort: sort = "last_modified"
|
15 |
+
models = []
|
16 |
+
models_plus_tags=[]
|
17 |
+
try:
|
18 |
+
model_infos = api.list_models(author=author, task="text-to-image",
|
19 |
+
tags=list_uniq(default_tags + tags), cardData=True, sort=sort, limit=limit)
|
20 |
+
except Exception as e:
|
21 |
+
print(f"Error: Failed to list models.")
|
22 |
+
print(e)
|
23 |
+
return models
|
24 |
+
for model in model_infos:
|
25 |
+
|
26 |
+
if not model.private and not model.gated:
|
27 |
+
loadable = True
|
28 |
+
if not_tag and not_tag in model.tags or not loadable: continue
|
29 |
+
if model.id not in bad_models :
|
30 |
+
models.append(model.id)
|
31 |
+
models_plus_tags.append([model.id,process_tags(model.tags)])
|
32 |
+
if len(models) == limit: break
|
33 |
+
return models , models_plus_tags
|
34 |
+
|
35 |
+
def process_tags(tags,bad_tags=bad_tags):
|
36 |
+
t1=True
|
37 |
+
new_tags=[]
|
38 |
+
for tag in tags:
|
39 |
+
if tag not in bad_tags:
|
40 |
+
if tag == 'en':
|
41 |
+
t1=False
|
42 |
+
if t1 :
|
43 |
+
new_tags.append(tag)
|
44 |
+
return new_tags
|
45 |
+
|
46 |
+
def clas_tags(models_plus_tags,min):
|
47 |
+
tags_plus_models=[]
|
48 |
+
output=[]
|
49 |
+
new_tag=True
|
50 |
+
for ent in models_plus_tags:
|
51 |
+
for tagClas in ent[1]:
|
52 |
+
new_tag=True
|
53 |
+
for tag in tags_plus_models:
|
54 |
+
if tag[0] == tagClas:
|
55 |
+
tag[1]+=1
|
56 |
+
tag[2].append(ent[0])
|
57 |
+
new_tag=False
|
58 |
+
if new_tag:
|
59 |
+
tags_plus_models.append([tagClas,1,[ent[0]]])
|
60 |
+
for t in tags_plus_models:
|
61 |
+
if t[0]=='diffusers' :
|
62 |
+
t[0]='all'
|
63 |
+
output.append(t)
|
64 |
+
else :
|
65 |
+
if t[1]>=min and t[1]!=len(models_plus_tags):
|
66 |
+
output.append(t)
|
67 |
+
return output
|
68 |
+
def orga_tag(tags_plus_models):
|
69 |
+
output=[]
|
70 |
+
while(len(output)<len(tags_plus_models)):
|
71 |
+
max=0
|
72 |
+
for tag in tags_plus_models:
|
73 |
+
if tag[1]>max:
|
74 |
+
if tag not in output:
|
75 |
+
max=tag[1]
|
76 |
+
tagMax=tag
|
77 |
+
output.append(tagMax)
|
78 |
+
return output
|
79 |
+
def tag_new(models,limit=40):
|
80 |
+
output=["NEW",0,[]]
|
81 |
+
if limit>len(models):
|
82 |
+
limit=len(models)
|
83 |
+
for i in range(limit):
|
84 |
+
output[1]+=1
|
85 |
+
output[2].append(models[i])
|
86 |
+
return output
|
87 |
+
|
88 |
+
def tag_fav(models=models,fav_models=fav_models):
|
89 |
+
output=["FAV",0,[]]
|
90 |
+
for m in fav_models:
|
91 |
+
if m in models:
|
92 |
+
output[1]+=1
|
93 |
+
output[2].append(m)
|
94 |
+
return output
|
95 |
+
|
96 |
+
def update_tag(models_plus_tags,list_new_tag):
|
97 |
+
for m_new in list_new_tag[2]:
|
98 |
+
for m in models_plus_tags:
|
99 |
+
if m_new == m[0]:
|
100 |
+
m[1].append(list_new_tag[0])
|
101 |
+
return models_plus_tags
|
102 |
+
|
103 |
+
|
104 |
+
from operator import itemgetter
|
105 |
+
|
106 |
+
#models = find_model_list("Yntec", [], "", "last_modified", 20)
|
107 |
+
models , models_plus_tags = find_model_list("John6666", ["stable-diffusion-xl"], "", "last_modified", 100)
|
108 |
+
#tags_plus_models = orga_tag(clas_tags(models_plus_tags,2))
|
109 |
+
tags_plus_models = orga_tag(clas_tags(sorted(models_plus_tags, key=itemgetter(0)),2))
|
110 |
+
list_new=tag_new(models,40)
|
111 |
+
models_plus_tags=update_tag(models_plus_tags,list_new)
|
112 |
+
tags_plus_models.insert(1,list_new)
|
113 |
+
list_fav=tag_fav()
|
114 |
+
if list_fav[1]>0:
|
115 |
+
tags_plus_models.insert(1,list_fav)
|
116 |
+
models_plus_tags=update_tag(models_plus_tags,list_fav)
|
117 |
+
print(models_plus_tags[0])
|
118 |
+
|
119 |
+
#models.extend(find_model_list("John6666", ["stable-diffusion-xl"], "", "last_modified", 200))
|
120 |
+
|
121 |
+
#models.extend(find_model_list("John6666", [], "", "last_modified", 20)) # The latest 20 models will be added to the models written above.
|
122 |
+
|
123 |
+
# Examples:
|
124 |
+
#models = ['yodayo-ai/kivotos-xl-2.0', 'yodayo-ai/holodayo-xl-2.1'] # specific models
|
125 |
+
#models = find_model_list("Yntec", [], "", "last_modified", 20) # Yntec's latest 20 models
|
126 |
+
#models = find_model_list("Yntec", ["anime"], "", "last_modified", 20) # Yntec's latest 20 models with 'anime' tag
|
127 |
+
#models = find_model_list("Yntec", [], "anime", "last_modified", 20) # Yntec's latest 20 models without 'anime' tag
|
128 |
+
#models = find_model_list("", [], "", "last_modified", 20) # latest 20 text-to-image models of huggingface
|
129 |
+
#models = find_model_list("", [], "", "downloads", 20) # monthly most downloaded 20 text-to-image models of huggingface
|
app3.py
ADDED
@@ -0,0 +1,371 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
import gradio as gr
|
3 |
+
from random import randint
|
4 |
+
from all_models2 import tags_plus_models,models,models_plus_tags
|
5 |
+
from datetime import datetime
|
6 |
+
|
7 |
+
from threading import RLock
|
8 |
+
lock = RLock()
|
9 |
+
|
10 |
+
nb_rep=2
|
11 |
+
nb_mod_dif=8
|
12 |
+
|
13 |
+
nb_models=nb_mod_dif*nb_rep
|
14 |
+
now2 = 0
|
15 |
+
|
16 |
+
def split_models(models,nb_models):
|
17 |
+
models_temp=[]
|
18 |
+
models_lis_temp=[]
|
19 |
+
i=0
|
20 |
+
for m in models:
|
21 |
+
models_temp.append(m)
|
22 |
+
i=i+1
|
23 |
+
if i%nb_models==0:
|
24 |
+
models_lis_temp.append(models_temp)
|
25 |
+
models_temp=[]
|
26 |
+
if len(models_temp)>1:
|
27 |
+
models_lis_temp.append(models_temp)
|
28 |
+
return models_lis_temp
|
29 |
+
|
30 |
+
def split_models_axb(models,a,b):
|
31 |
+
models_temp=[]
|
32 |
+
models_lis_temp=[]
|
33 |
+
i=0
|
34 |
+
nb_models=b
|
35 |
+
for m in models:
|
36 |
+
for j in range(a):
|
37 |
+
models_temp.append(m)
|
38 |
+
i=i+1
|
39 |
+
if i%nb_models==0:
|
40 |
+
models_lis_temp.append(models_temp)
|
41 |
+
models_temp=[]
|
42 |
+
if len(models_temp)>1:
|
43 |
+
models_lis_temp.append(models_temp)
|
44 |
+
return models_lis_temp
|
45 |
+
|
46 |
+
def split_models_8x3(models,nb_models):
|
47 |
+
models_temp=[]
|
48 |
+
models_lis_temp=[]
|
49 |
+
i=0
|
50 |
+
nb_models_x3=8
|
51 |
+
for m in models:
|
52 |
+
models_temp.append(m)
|
53 |
+
i=i+1
|
54 |
+
if i%nb_models_x3==0:
|
55 |
+
models_lis_temp.append(models_temp+models_temp+models_temp)
|
56 |
+
models_temp=[]
|
57 |
+
if len(models_temp)>0:
|
58 |
+
models_lis_temp.append(models_temp+models_temp+models_temp)
|
59 |
+
return models_lis_temp
|
60 |
+
|
61 |
+
def construct_list_models(tags_plus_models,nb_rep,nb_mod_dif):
|
62 |
+
list_temp=[]
|
63 |
+
output=[]
|
64 |
+
for tag_plus_models in tags_plus_models:
|
65 |
+
list_temp=split_models_axb(tag_plus_models[2],nb_rep,nb_mod_dif)
|
66 |
+
list_temp2=[]
|
67 |
+
i=0
|
68 |
+
for elem in list_temp:
|
69 |
+
list_temp2.append([tag_plus_models[0]+"_"+str(i)+" : "+elem[0]+" - "+elem[len(elem)-1] ,elem])
|
70 |
+
i+=1
|
71 |
+
output.append([tag_plus_models[0] + " (" + str(tag_plus_models[1]) + ")",list_temp2])
|
72 |
+
return output
|
73 |
+
|
74 |
+
models_test = []
|
75 |
+
models_test = construct_list_models(tags_plus_models,nb_rep,nb_mod_dif)
|
76 |
+
|
77 |
+
def get_current_time():
|
78 |
+
now = datetime.now()
|
79 |
+
now2 = now
|
80 |
+
current_time = now2.strftime("%Y-%m-%d %H:%M:%S")
|
81 |
+
ki = f'{kii} {current_time}'
|
82 |
+
return ki
|
83 |
+
|
84 |
+
def load_fn(models):
|
85 |
+
global models_load
|
86 |
+
global num_models
|
87 |
+
global default_models
|
88 |
+
models_load = {}
|
89 |
+
num_models = len(models)
|
90 |
+
i=0
|
91 |
+
if num_models!=0:
|
92 |
+
default_models = models[:num_models]
|
93 |
+
else:
|
94 |
+
default_models = {}
|
95 |
+
for model in models:
|
96 |
+
i+=1
|
97 |
+
if i%50==0:
|
98 |
+
print("\n\n\n-------"+str(i)+'/'+str(len(models))+"-------\n\n\n")
|
99 |
+
if model not in models_load.keys():
|
100 |
+
try:
|
101 |
+
m = gr.load(f'models/{model}')
|
102 |
+
except Exception as error:
|
103 |
+
m = gr.Interface(lambda txt: None, ['text'], ['image'])
|
104 |
+
models_load.update({model: m})
|
105 |
+
|
106 |
+
|
107 |
+
"""models = models_test[1]"""
|
108 |
+
load_fn(models)
|
109 |
+
"""models = {}
|
110 |
+
load_fn(models)"""
|
111 |
+
|
112 |
+
|
113 |
+
def extend_choices(choices):
|
114 |
+
return choices + (nb_models - len(choices)) * ['NA']
|
115 |
+
"""return choices + (num_models - len(choices)) * ['NA']"""
|
116 |
+
|
117 |
+
def extend_choices_b(choices):
|
118 |
+
choices_plus = extend_choices(choices)
|
119 |
+
return [gr.Textbox(m, visible=False) for m in choices_plus]
|
120 |
+
|
121 |
+
def update_imgbox(choices):
|
122 |
+
choices_plus = extend_choices(choices)
|
123 |
+
return [gr.Image(None, label=m, visible=(m != 'NA')) for m in choices_plus]
|
124 |
+
|
125 |
+
def choice_group_a(group_model_choice):
|
126 |
+
return group_model_choice
|
127 |
+
|
128 |
+
def choice_group_b(group_model_choice):
|
129 |
+
choice=choice_group_a(group_model_choice)
|
130 |
+
choice = extend_choices(choice)
|
131 |
+
"""return [gr.Image(label=m, min_width=170, height=170) for m in choice]"""
|
132 |
+
return [gr.Image(None, label=m, visible=(m != 'NA')) for m in choice]
|
133 |
+
|
134 |
+
def choice_group_c(group_model_choice):
|
135 |
+
choice=choice_group_a(group_model_choice)
|
136 |
+
choice = extend_choices(choice)
|
137 |
+
return [gr.Textbox(m, visible=False) for m in choice]
|
138 |
+
|
139 |
+
def choice_group_d(var_Test):
|
140 |
+
(gen_button,stop_button,output,current_models)=var_Test
|
141 |
+
for m, o in zip(current_models, output):
|
142 |
+
gen_event = gen_button.click(gen_fn, [m, txt_input], o)
|
143 |
+
stop_button.click(lambda s: gr.update(interactive=False), None, stop_button, cancels=[gen_event])
|
144 |
+
return gen_event
|
145 |
+
|
146 |
+
def cutStrg(longStrg,start,end):
|
147 |
+
shortStrg=''
|
148 |
+
for i in range(end-start):
|
149 |
+
shortStrg+=longStrg[start+i]
|
150 |
+
return shortStrg
|
151 |
+
|
152 |
+
def aff_models_perso(txt_list_perso,nb_models=nb_models,models=models):
|
153 |
+
list_perso=[]
|
154 |
+
t1=True
|
155 |
+
start=txt_list_perso.find('\"')
|
156 |
+
if start!=-1:
|
157 |
+
while t1:
|
158 |
+
start+=1
|
159 |
+
end=txt_list_perso.find('\"',start)
|
160 |
+
if end != -1:
|
161 |
+
txtTemp=cutStrg(txt_list_perso,start,end)
|
162 |
+
if txtTemp in models:
|
163 |
+
list_perso.append(cutStrg(txt_list_perso,start,end))
|
164 |
+
else :
|
165 |
+
t1=False
|
166 |
+
start=txt_list_perso.find('\"',end+1)
|
167 |
+
if start==-1:
|
168 |
+
t1=False
|
169 |
+
if len(list_perso)>=nb_models:
|
170 |
+
t1=False
|
171 |
+
return list_perso
|
172 |
+
|
173 |
+
def aff_models_perso_b(txt_list_perso):
|
174 |
+
return choice_group_b(aff_models_perso(txt_list_perso))
|
175 |
+
|
176 |
+
def aff_models_perso_c(txt_list_perso):
|
177 |
+
return choice_group_c(aff_models_perso(txt_list_perso))
|
178 |
+
|
179 |
+
|
180 |
+
def tag_choice(group_tag_choice):
|
181 |
+
return gr.Dropdown(label="test Tag", show_label=False, choices=list(group_tag_choice) , allow_custom_value=True)
|
182 |
+
|
183 |
+
def test_pass(test):
|
184 |
+
if test==os.getenv('p'):
|
185 |
+
print("ok")
|
186 |
+
return gr.Dropdown(label="test Model", show_label=False, choices=list(models_test) , allow_custom_value=True)
|
187 |
+
else:
|
188 |
+
print("nop")
|
189 |
+
return gr.Dropdown(label="test Model", show_label=False, choices=list([]) , allow_custom_value=True)
|
190 |
+
|
191 |
+
def test_pass_aff(test):
|
192 |
+
if test==os.getenv('p'):
|
193 |
+
return gr.Accordion("stuffs", open=True, visible=True)
|
194 |
+
else:
|
195 |
+
return gr.Accordion("stuffs", open=True, visible=False)
|
196 |
+
|
197 |
+
def gen_fn(model_str, prompt):
|
198 |
+
if model_str == 'NA':
|
199 |
+
return None
|
200 |
+
noise = str(randint(0, 9999))
|
201 |
+
try :
|
202 |
+
m=models_load[model_str](f'{prompt} {noise}')
|
203 |
+
except Exception as error :
|
204 |
+
print("error : " + model_str)
|
205 |
+
m=False
|
206 |
+
|
207 |
+
return m
|
208 |
+
|
209 |
+
def add_gallery(image, model_str, gallery):
|
210 |
+
if gallery is None: gallery = []
|
211 |
+
with lock:
|
212 |
+
if image is not None: gallery.insert(0, (image, model_str))
|
213 |
+
return gallery
|
214 |
+
|
215 |
+
def disp_models(group_model_choice,nb_rep=nb_rep):
|
216 |
+
listTemp=[]
|
217 |
+
strTemp='\n'
|
218 |
+
i=0
|
219 |
+
for m in group_model_choice:
|
220 |
+
if m not in listTemp:
|
221 |
+
listTemp.append(m)
|
222 |
+
for m in listTemp:
|
223 |
+
i+=1
|
224 |
+
strTemp+="\"" + m + "\",\n"
|
225 |
+
if i%(8/nb_rep)==0:
|
226 |
+
strTemp+="\n"
|
227 |
+
return gr.Textbox(label="models",value=strTemp)
|
228 |
+
|
229 |
+
def search_models(str_search,tags_plus_models=tags_plus_models,models_plus_tags=models_plus_tags):
|
230 |
+
output1="\n"
|
231 |
+
output2=""
|
232 |
+
for m in tags_plus_models[0][2]:
|
233 |
+
if m.find(str_search)!=-1:
|
234 |
+
output1+="\"" + m + "\",\n"
|
235 |
+
outputPlus="\n From tags : \n\n"
|
236 |
+
for tag_plus_models in tags_plus_models:
|
237 |
+
if str_search in tag_plus_models[0]:
|
238 |
+
for m in tag_plus_models[2]:
|
239 |
+
output2+="\"" + m + "\",\n"
|
240 |
+
if output2 != "":
|
241 |
+
output=output1+outputPlus+output2
|
242 |
+
else :
|
243 |
+
output=output1
|
244 |
+
return gr.Textbox(label="out",value=output)
|
245 |
+
|
246 |
+
def search_info(txt_search_info,models_plus_tags=models_plus_tags):
|
247 |
+
outputList=[]
|
248 |
+
if txt_search_info.find("\"")!=-1:
|
249 |
+
start=txt_search_info.find("\"")+1
|
250 |
+
end=txt_search_info.find("\"",start)
|
251 |
+
m_name=cutStrg(txt_search_info,start,end)
|
252 |
+
else :
|
253 |
+
m_name = txt_search_info
|
254 |
+
for m in models_plus_tags:
|
255 |
+
if m_name == m[0]:
|
256 |
+
outputList=m[1]
|
257 |
+
if len(outputList)==0:
|
258 |
+
outputList.append("Model Not Find")
|
259 |
+
return gr.Textbox(label="out",value=outputList)
|
260 |
+
|
261 |
+
def make_me():
|
262 |
+
# with gr.Tab('The Dream'):
|
263 |
+
with gr.Row():
|
264 |
+
#txt_input = gr.Textbox(lines=3, width=300, max_height=100)
|
265 |
+
txt_input = gr.Textbox(label='Your prompt:', lines=3, width=300, max_height=100)
|
266 |
+
|
267 |
+
gen_button = gr.Button('Generate images', width=150, height=30)
|
268 |
+
stop_button = gr.Button('Stop', variant='secondary', interactive=False, width=150, height=30)
|
269 |
+
gen_button.click(lambda s: gr.update(interactive=True), None, stop_button)
|
270 |
+
gr.HTML("""
|
271 |
+
<div style="text-align: center; max-width: 100%; margin: 0 auto;">
|
272 |
+
<body>
|
273 |
+
</body>
|
274 |
+
</div>
|
275 |
+
""")
|
276 |
+
with gr.Row():
|
277 |
+
"""output = [gr.Image(label=m, min_width=170, height=170) for m in default_models]
|
278 |
+
current_models = [gr.Textbox(m, visible=False) for m in default_models]"""
|
279 |
+
"""choices=[models_test[0][0]]"""
|
280 |
+
choices=models_test[0][1][0][1]
|
281 |
+
"""output = [gr.Image(label=m, min_width=170, height=170) for m in choices]
|
282 |
+
current_models = [gr.Textbox(m, visible=False) for m in choices]"""
|
283 |
+
output = update_imgbox([choices[0]])
|
284 |
+
current_models = extend_choices_b([choices[0]])
|
285 |
+
|
286 |
+
#with gr.Row():
|
287 |
+
# gallery = gr.Gallery(label="Output", show_download_button=True, elem_classes="gallery",
|
288 |
+
# interactive=False, show_share_button=True, container=True, format="png",
|
289 |
+
# preview=True, object_fit="cover", columns=2, rows=2)
|
290 |
+
|
291 |
+
for m, o in zip(current_models, output):
|
292 |
+
gen_event = gen_button.click(gen_fn, [m, txt_input], o)
|
293 |
+
stop_button.click(lambda s: gr.update(interactive=False), None, stop_button, cancels=[gen_event])
|
294 |
+
#o.change(add_gallery, [o, m, gallery], [gallery])
|
295 |
+
"""with gr.Accordion('Model selection'):
|
296 |
+
model_choice = gr.CheckboxGroup(models, label=f' {num_models} different models selected', value=default_models, multiselect=True, max_choices=num_models, interactive=True, filterable=False)
|
297 |
+
model_choice.change(update_imgbox, (gen_button,stop_button,group_model_choice), output)
|
298 |
+
model_choice.change(extend_choices, model_choice, current_models)
|
299 |
+
"""
|
300 |
+
|
301 |
+
|
302 |
+
with gr.Accordion("stuffs", open=True, visible=False) as stuffs_a:
|
303 |
+
with gr.Row():
|
304 |
+
"""group_model_choice = gr.Dropdown(label="Lists Models", show_label=False, choices=list(models_test) , allow_custom_value=True)"""
|
305 |
+
group_model_choice = gr.Dropdown(label="test Model", show_label=False, choices=list([]) , allow_custom_value=True)
|
306 |
+
group_model_choice.change(choice_group_b,group_model_choice,output)
|
307 |
+
group_model_choice.change(choice_group_c,group_model_choice,current_models)
|
308 |
+
"""group_model_choice.change(choice_group_d,(gen_button,stop_button,output,current_models),gen_event)"""
|
309 |
+
|
310 |
+
with gr.Row():
|
311 |
+
group_tag_choice = gr.Dropdown(label="Lists Tags", show_label=False, choices=list([]) , allow_custom_value=True)
|
312 |
+
group_tag_choice.change(tag_choice,group_tag_choice,group_model_choice)
|
313 |
+
|
314 |
+
with gr.Row():
|
315 |
+
txt_input_p = gr.Textbox(label="Pass", lines=1, width=300, max_height=100)
|
316 |
+
|
317 |
+
test_button = gr.Button(' ', width=30, height=10)
|
318 |
+
test_button.click(test_pass,txt_input_p,group_tag_choice)
|
319 |
+
|
320 |
+
|
321 |
+
with gr.Accordion("stuffs", open=True, visible=False) as stuffs_b:
|
322 |
+
|
323 |
+
with gr.Row():
|
324 |
+
txt_list_models=gr.Textbox(label="Models Actu",value="")
|
325 |
+
group_model_choice.change(disp_models,group_model_choice,txt_list_models)
|
326 |
+
|
327 |
+
with gr.Row():
|
328 |
+
txt_list_perso = gr.Textbox(label='List Models Perso', width=300, max_height=100)
|
329 |
+
|
330 |
+
button_list_perso = gr.Button('Load', width=30, height=10)
|
331 |
+
button_list_perso.click(aff_models_perso_b,txt_list_perso,output)
|
332 |
+
button_list_perso.click(aff_models_perso_c,txt_list_perso,current_models)
|
333 |
+
|
334 |
+
with gr.Row():
|
335 |
+
txt_search = gr.Textbox(label='Search in', width=300, max_height=100)
|
336 |
+
txt_output_search = gr.Textbox(label='Search out', width=300, max_height=100)
|
337 |
+
button_search = gr.Button('Research', width=30, height=10)
|
338 |
+
button_search.click(search_models,txt_search,txt_output_search)
|
339 |
+
|
340 |
+
with gr.Row():
|
341 |
+
txt_search_info = gr.Textbox(label='Search info in', width=300, max_height=100)
|
342 |
+
txt_output_search_info = gr.Textbox(label='Search info out', width=300, max_height=100)
|
343 |
+
button_search_info = gr.Button('Research info', width=30, height=10)
|
344 |
+
button_search_info.click(search_info,txt_search_info,txt_output_search_info)
|
345 |
+
|
346 |
+
|
347 |
+
with gr.Row():
|
348 |
+
test_button.click(test_pass_aff,txt_input_p,stuffs_a)
|
349 |
+
test_button.click(test_pass_aff,txt_input_p,stuffs_b)
|
350 |
+
gr.HTML("""
|
351 |
+
<div class="footer">
|
352 |
+
<p> Based on the <a href="https://huggingface.co/spaces/derwahnsinn/TestGen">TestGen</a> Space by derwahnsinn, the <a href="https://huggingface.co/spaces/RdnUser77/SpacIO_v1">SpacIO</a> Space by RdnUser77 and Omnibus's Maximum Multiplier!
|
353 |
+
</p>
|
354 |
+
""")
|
355 |
+
|
356 |
+
|
357 |
+
|
358 |
+
js_code = """
|
359 |
+
|
360 |
+
console.log('ghgh');
|
361 |
+
"""
|
362 |
+
|
363 |
+
|
364 |
+
with gr.Blocks(css="div.float.svelte-1mwvhlq { position: absolute; top: var(--block-label-margin); left: var(--block-label-margin); background: none; border: none;}") as demo:
|
365 |
+
gr.Markdown("<script>" + js_code + "</script>")
|
366 |
+
make_me()
|
367 |
+
|
368 |
+
|
369 |
+
|
370 |
+
demo.queue(concurrency_count=999)
|
371 |
+
demo.launch()
|
blacklist.py
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
bad_tags= [
|
2 |
+
"safetensors",
|
3 |
+
"region:us",
|
4 |
+
"autotrain_compatible",
|
5 |
+
"endpoints_compatible",
|
6 |
+
"diffusers:StableDiffusionXLPipeline",
|
7 |
+
"license:other",
|
8 |
+
"license:creativeml-openrail-m",
|
9 |
+
"base_model:cagliostrolab/animagine-xl-3.1",
|
10 |
+
"base_model:finetune:cagliostrolab/animagine-xl-3.1",
|
11 |
+
"base_model:da2el/ioliPonyMix",
|
12 |
+
"base_model:finetune:da2el/ioliPonyMix",
|
13 |
+
|
14 |
+
]
|
15 |
+
|
16 |
+
bad_models=[
|
17 |
+
"John6666/aua-09-sdxl",
|
18 |
+
"John6666/beyond-experimental-v28loramerge-sdxl",
|
19 |
+
"John6666/aua-always-use-artists-auap08-sdxl",
|
20 |
+
"John6666/artiwaifu-diffusion-v20-sdxl",
|
21 |
+
"John6666/flyx3-mix-xl-v1-sdxl",
|
22 |
+
"John6666/flyx3-mix-xl-v2-sdxl",
|
23 |
+
|
24 |
+
]
|
25 |
+
|
26 |
+
fav_models=[
|
27 |
+
"John6666/3x3mix-xl-typed-v1-sdxl",
|
28 |
+
"John6666/florag-pony-half-xl-sdxl",
|
29 |
+
"John6666/red-blue-fantasy-pony-sdxl",
|
30 |
+
"John6666/catloaf-v1-sdxl",
|
31 |
+
"John6666/peroperositai-v1-sdxl",
|
32 |
+
"John6666/hda-matrix-copdxl-v1-sdxl",
|
33 |
+
"John6666/animeliner-ponyxl-v1-sdxl",
|
34 |
+
]
|
35 |
+
|