Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,586 +1,152 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
-
import os
|
| 3 |
-
import
|
| 4 |
-
from
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
"digiplay/Jellymix_XL_v1",
|
| 14 |
-
"John6666/wai-real-e-v1-sdxl",
|
| 15 |
-
"playgroundai/playground-v2-1024px-aesthetic",
|
| 16 |
-
"John6666/epicrealism-xl-v8kiss-sdxl",
|
| 17 |
-
"dataautogpt3/ProteusV0.4",
|
| 18 |
-
"John6666/badbro-xl-v5-sdxl",
|
| 19 |
-
"Bakanayatsu/ponyDiffusion-V6-XL-Turbo-DPO",
|
| 20 |
-
"John6666/smooth-hassaku-authaku-mix-v1-sdxl",
|
| 21 |
-
"Lykon/dreamshaper-xl-1-0",
|
| 22 |
-
"John6666/titania-juggernaut-mix-v1-sdxl",
|
| 23 |
-
"nerijs/pixel-art-xl",
|
| 24 |
-
"John6666/defacta-xl-3-v3-sdxl",
|
| 25 |
-
"Linaqruf/animagine-xl",
|
| 26 |
-
"John6666/big-lust-v1-sdxl",
|
| 27 |
-
"dataautogpt3/OpenDalleV1.1",
|
| 28 |
-
"John6666/urang-diffusion-v11-sdxl",
|
| 29 |
-
"stabilityai/stable-diffusion-xl-base-1.0",
|
| 30 |
-
"John6666/hadrian-delice-xl-v26j-sdxl",
|
| 31 |
-
"John6666/3x3mix-xl-typeh-v1-sdxl",
|
| 32 |
-
"John6666/kaguya-v1-sdxl",
|
| 33 |
-
"John6666/zonkey-realism-v5-sdxl",
|
| 34 |
-
"John6666/wai-cute-v4-sdxl",
|
| 35 |
-
"John6666/ultimate-realistic-mix-v2-sdxl",
|
| 36 |
-
"John6666/flower-mix-cherry-xl-v4-sdxl",
|
| 37 |
-
"John6666/cocoa-mix-xl-v5-25d-sdxl",
|
| 38 |
-
"John6666/big-asp-v1-sdxl",
|
| 39 |
-
"John6666/animix-v9-xl-animetvmix-v25-sdxl",
|
| 40 |
-
"John6666/tsuki-v35-sdxl",
|
| 41 |
-
"John6666/xlp-caulkinum-animeline-bnd-sdxl",
|
| 42 |
-
"John6666/xl-caulkinum-animeline-standard-bgm-sdxl",
|
| 43 |
-
"John6666/xl-caulkinum-animeline-standard-aq-sdxl",
|
| 44 |
-
"John6666/fluffy-tart-xl-v15-sdxl",
|
| 45 |
-
"John6666/cutiemagine-v1-sdxl",
|
| 46 |
-
"John6666/new-tail-multiple-artists-v1-sdxl",
|
| 47 |
-
"John6666/blafbastic-xl-v1-sdxl",
|
| 48 |
-
"John6666/grilled-lamprey-sdxl-v12o7n9745-sdxl",
|
| 49 |
-
"John6666/savant-v201-sdxl",
|
| 50 |
-
"John6666/speciosa-25d-v12-sdxl",
|
| 51 |
-
"John6666/flyx3-mix-xl-v2-sdxl",
|
| 52 |
-
"John6666/3x3mix-xl-typeg-v1-sdxl",
|
| 53 |
-
"John6666/barry-the-quokka-sdxl-lora",
|
| 54 |
-
"John6666/4th-tail-autism-v045-sdxl",
|
| 55 |
-
"John6666/wai-real-cn-v7-sdxl",
|
| 56 |
-
"John6666/xl-merges-xl012rb2-sdxl",
|
| 57 |
-
"John6666/speciosa-25d-v11a-sdxl",
|
| 58 |
-
"John6666/akizone-style-xl-sdxl",
|
| 59 |
-
"John6666/badbro-xl-v3-sdxl",
|
| 60 |
-
"John6666/ultimate-realistic-mix-v1-sdxl",
|
| 61 |
-
"John6666/leekai-sdxl",
|
| 62 |
-
"John6666/hadrian-delice-xl-v25e-sdxl",
|
| 63 |
-
"John6666/r-anime-3mil-testmodel-v1-sdxl",
|
| 64 |
-
"John6666/4gold-mixl-v111-sdxl",
|
| 65 |
-
"John6666/copycat-bg-v1-sdxl",
|
| 66 |
-
"John6666/lizmix-version-ex-sdxl",
|
| 67 |
-
"John6666/asuma-xl-sdxl",
|
| 68 |
-
"John6666/speciosa-v12-sdxl",
|
| 69 |
-
"John6666/model-ex-v5-sdxl",
|
| 70 |
-
"John6666/ohara-pdxl-v1-sdxl",
|
| 71 |
-
"John6666/forreal-xl-v5-sdxl",
|
| 72 |
-
"John6666/real-vis-xl-v40-sdxl",
|
| 73 |
-
"John6666/1style-adjust-of-animaginexl31-v1-sdxl",
|
| 74 |
-
"John6666/aios-v101foal-v1100foalii-sdxl",
|
| 75 |
-
"John6666/katayama-mix-xl-v1-sdxl",
|
| 76 |
-
"John6666/megane-xl-v5-sdxl",
|
| 77 |
-
"John6666/flyx3-mix-xl-v1-sdxl",
|
| 78 |
-
"John6666/authaku-mix-v1-sdxl",
|
| 79 |
-
"John6666/sdxl-anime-illustration-v1-sdxl",
|
| 80 |
-
"John6666/agenda-mix-pdxl-v15-sdxl",
|
| 81 |
-
"John6666/toketap-v1-sdxl",
|
| 82 |
-
"John6666/unreal-tulip-v1-sdxl",
|
| 83 |
-
"John6666/hadrian-delice-xl-styled-stylea-v12d-sdxl",
|
| 84 |
-
"John6666/bubble-style-xl-v1-sdxl",
|
| 85 |
-
"John6666/crystal-clear-slime-nsf-v1-sdxl",
|
| 86 |
-
"John6666/bubble-xl-v1-sdxl",
|
| 87 |
-
"John6666/cocoa-mix-xl-v4-sdxl",
|
| 88 |
-
"John6666/wai-c-v3-sdxl",
|
| 89 |
-
"John6666/iniverse-mix-xl-sfwnsfw-guofen-v15-sdxl",
|
| 90 |
-
"John6666/hadrian-delice-xl-styled-stylea-v11h-sdxl",
|
| 91 |
-
"John6666/flower-mix-moon-xl-v1-sdxl",
|
| 92 |
-
"John6666/eclipse-xl-v13test-sdxl",
|
| 93 |
-
"John6666/ost-ander-mix-v1-sdxl",
|
| 94 |
-
"John6666/sweet-mix-xl-v1-sdxl",
|
| 95 |
-
"John6666/xl-merges-xl011-sdxl",
|
| 96 |
-
"John6666/digital-af-xlp-v1-sdxl",
|
| 97 |
-
"John6666/perfect-nai-v1-sdxl",
|
| 98 |
-
"John6666/wai-real-mix-v8-sdxl",
|
| 99 |
-
"John6666/schizo-merges-arti-heart-neta-inception-sdxl",
|
| 100 |
-
"John6666/cocoa-mix-xl-v3-sdxl",
|
| 101 |
-
"John6666/3x3x3mixxl-v2-sdxl",
|
| 102 |
-
"John6666/anime-screenshot-xl-v1-sdxl",
|
| 103 |
-
"John6666/flower-mix-cherry-xl-v3-sdxl",
|
| 104 |
-
"John6666/boring-cake-v1-sdxl",
|
| 105 |
-
"John6666/schizo-merges-arti-heart-neta-v2-sdxl",
|
| 106 |
-
"John6666/hadrian-delice-xl-styled-stylea-v10d-sdxl",
|
| 107 |
-
"John6666/dissonance-v11-sdxl",
|
| 108 |
-
"John6666/fpl005-sdxl",
|
| 109 |
-
"John6666/bamboo-shoot-mix-v1-sdxl",
|
| 110 |
-
"John6666/3d-rendering-style-beta2-sdxl",
|
| 111 |
-
"John6666/wai-doll-cn-v2-sdxl",
|
| 112 |
-
"John6666/hamef-kawaii-mix-type24normal-warm-sdxl",
|
| 113 |
-
"John6666/mala-smooth-v1-sdxl",
|
| 114 |
-
"John6666/fluffy-tart-xl-v14-sdxl",
|
| 115 |
-
"John6666/hamef-kawaii-mix-type24light-warm-sdxl",
|
| 116 |
-
"John6666/ras-real-anime-screencap-v1-sdxl",
|
| 117 |
-
"John6666/anima-pencil-xl-v5-sdxl",
|
| 118 |
-
"John6666/randomizer89-pdxl-merge-v3-sdxl",
|
| 119 |
-
"John6666/cocoa-mix-xl-v2-sdxl",
|
| 120 |
-
"John6666/grilled-lamprey-sdxl-v10o4n3-sdxl",
|
| 121 |
-
"John6666/white-unicorn-v2-sdxl",
|
| 122 |
-
"John6666/pys-gallery-anime-v24-sdxl",
|
| 123 |
-
"John6666/3x3mix-xl-typef-v1-sdxl",
|
| 124 |
-
"John6666/grilled-lamprey-sdxl-v10o1n9752-sdxl",
|
| 125 |
-
"John6666/blue-pencil-xl-v7-sdxl",
|
| 126 |
-
"John6666/sympony-v2-fuga-sdxl",
|
| 127 |
-
"John6666/cute-core-v1-sdxl",
|
| 128 |
-
"John6666/cocoa-mix-xl-v1-sdxl",
|
| 129 |
-
"John6666/niji-style-xl-v21-sdxl",
|
| 130 |
-
"John6666/animix-v9-xl-animetvmix-2nd-sdxl",
|
| 131 |
-
"John6666/pegasusxx-v40-twilightsky-sdxl",
|
| 132 |
-
"John6666/pegana-merge-v2-sdxl",
|
| 133 |
-
"John6666/flower-mix-cherry-xl-v2-sdxl",
|
| 134 |
-
"John6666/getsujitsu-v1-sdxl",
|
| 135 |
-
"John6666/lyuyang-mix-vp-v198-sdxl",
|
| 136 |
-
"John6666/tsuki-v2-sdxl",
|
| 137 |
-
"John6666/bunny-mint-v3-ns-sdxl",
|
| 138 |
-
"John6666/wai-real-cn-v6-sdxl",
|
| 139 |
-
"John6666/xl-merges-xl010-sdxl",
|
| 140 |
-
"John6666/bunny-mint-sdxl",
|
| 141 |
-
"John6666/wai-cute-v3-sdxl",
|
| 142 |
-
"John6666/3x3mix-xl-typea-v2-sdxl",
|
| 143 |
-
"John6666/hamef-kawaii-mix-type2light-sdxl",
|
| 144 |
-
"John6666/aniease-v24-sdxl",
|
| 145 |
-
"John6666/wai-real-cn-v5-sdxl",
|
| 146 |
-
"John6666/wai-real-cn-v4-sdxl",
|
| 147 |
-
"John6666/rae-diffusion-xl-v1-sdxl",
|
| 148 |
-
"John6666/sympony-v1-prelude-sdxl",
|
| 149 |
-
"John6666/himawari-mix-xl-v13-sdxl",
|
| 150 |
-
"John6666/3x3mix-xl-typee-v1-sdxl",
|
| 151 |
-
"John6666/r-anime-220k-v1-sdxl",
|
| 152 |
-
"John6666/knk-soft-shading-v1-sdxl",
|
| 153 |
-
"John6666/astolfo-mix-xl-tgmd-sdxl",
|
| 154 |
-
"John6666/hadrian-delice-xl-v20l-sdxl",
|
| 155 |
-
"John6666/accretion-disc-xl-v1-sdxl",
|
| 156 |
-
"John6666/confusion-xl-v3-sdxl",
|
| 157 |
-
"John6666/luminastra-xl-v2-sdxl",
|
| 158 |
-
"John6666/9527-detail-realistic-xl-v55mix-sdxl",
|
| 159 |
-
"John6666/nero-mix-v1-sdxl",
|
| 160 |
-
"John6666/runbullxl-v8-sdxl",
|
| 161 |
-
"John6666/deng-pvc-xl-mix2-v1-sdxl",
|
| 162 |
-
"John6666/3x3mix-xl-typed-v1-sdxl",
|
| 163 |
-
"John6666/kosa-v2-sdxl",
|
| 164 |
-
"John6666/pegana-merge-v1-sdxl",
|
| 165 |
-
"John6666/kohaku-xl-epsilon-rev2-sdxl",
|
| 166 |
-
"John6666/99mix-v1-sdxl",
|
| 167 |
-
"John6666/pegasusxx-v383-sdxl",
|
| 168 |
-
"John6666/sino-station-xl-manhua-v8-sdxl",
|
| 169 |
-
"John6666/pegasusxx-v35-sdxl",
|
| 170 |
-
"John6666/eclipse-xl-v1-sdxl",
|
| 171 |
-
"John6666/kome-anime-coloring-chibi-style-v1-sdxl",
|
| 172 |
-
"John6666/base-anime-style-pony-v3-sdxl",
|
| 173 |
-
"John6666/copycat-v2-sdxl",
|
| 174 |
-
"John6666/asyncs-mix-xl-v31-sdxl",
|
| 175 |
-
"John6666/adamah-mix-xl-v15-sdxl",
|
| 176 |
-
"John6666/cosmix-v2-sdxl",
|
| 177 |
-
"John6666/super-robot-diffusion-rise-v1-sdxl",
|
| 178 |
-
"John6666/animix-v9-xl-sdxl",
|
| 179 |
-
"John6666/pthno2-v1-sdxl",
|
| 180 |
-
"John6666/xl-caulkinum-realline-sj-sdxl",
|
| 181 |
-
"John6666/wai-cute-v2-sdxl",
|
| 182 |
-
"John6666/comradeship-xl-v9-sdxl",
|
| 183 |
-
"John6666/heart-of-apple-xl-v3-sdxl",
|
| 184 |
-
"John6666/tri-fusion-v1e-sdxl",
|
| 185 |
-
"John6666/himawari-mix-xl-v6-sdxl",
|
| 186 |
-
"John6666/after-real-xl-beta2-sdxl",
|
| 187 |
-
"John6666/cherry-picker-xl-v3-sdxl",
|
| 188 |
-
"John6666/aniease-v23-sdxl",
|
| 189 |
-
"John6666/any-orange-mix-xl-v1-sdxl",
|
| 190 |
-
"John6666/white-unicorn-another-sdxl",
|
| 191 |
-
"John6666/fuduki-mix-v2-sdxl",
|
| 192 |
-
"John6666/anime-illust-diffusion-v8-sdxl",
|
| 193 |
-
"John6666/neta-art-xl-v1dpo-sdxl",
|
| 194 |
-
"John6666/raemu-xl-v35l-sdxl",
|
| 195 |
-
"John6666/aing-diffusion-xl-v13-sdxl",
|
| 196 |
-
"John6666/stuffy-mix-v1-sdxl",
|
| 197 |
-
"John6666/chacol-omega-mix-v11a-sdxl",
|
| 198 |
-
"John6666/epona-mix-v3-sdxl",
|
| 199 |
-
"John6666/baxl-v3-sdxl",
|
| 200 |
-
"John6666/cute-core-v3-sdxl",
|
| 201 |
-
"John6666/yamers-anime-sa-sdxl",
|
| 202 |
-
"John6666/3x3x3mixxl-v1-sdxl",
|
| 203 |
-
"John6666/rumblexl-v13-sdxl",
|
| 204 |
-
"John6666/anime-bulldozer-v2-sdxl",
|
| 205 |
-
"John6666/anima-pencil-sdxl",
|
| 206 |
-
"John6666/colorful-xl-v7-sdxl",
|
| 207 |
-
|
| 208 |
-
]
|
| 209 |
current_model = models[0]
|
|
|
|
| 210 |
|
| 211 |
-
|
| 212 |
-
|
| 213 |
-
models2=[
|
| 214 |
-
gr.Interface.load(f"models/{models[0]}",live=True,preprocess=False),
|
| 215 |
-
gr.Interface.load(f"models/{models[1]}",live=True,preprocess=False),
|
| 216 |
-
gr.Interface.load(f"models/{models[2]}",live=True,preprocess=False),
|
| 217 |
-
gr.Interface.load(f"models/{models[3]}",live=True,preprocess=False),
|
| 218 |
-
gr.Interface.load(f"models/{models[4]}",live=True,preprocess=False),
|
| 219 |
-
gr.Interface.load(f"models/{models[5]}",live=True,preprocess=False),
|
| 220 |
-
gr.Interface.load(f"models/{models[6]}",live=True,preprocess=False),
|
| 221 |
-
gr.Interface.load(f"models/{models[7]}",live=True,preprocess=False),
|
| 222 |
-
gr.Interface.load(f"models/{models[8]}",live=True,preprocess=False),
|
| 223 |
-
gr.Interface.load(f"models/{models[9]}",live=True,preprocess=False),
|
| 224 |
-
|
| 225 |
-
gr.Interface.load(f"models/{models[10]}",live=True,preprocess=False),
|
| 226 |
-
gr.Interface.load(f"models/{models[11]}",live=True,preprocess=False),
|
| 227 |
-
gr.Interface.load(f"models/{models[12]}",live=True,preprocess=False),
|
| 228 |
-
gr.Interface.load(f"models/{models[13]}",live=True,preprocess=False),
|
| 229 |
-
gr.Interface.load(f"models/{models[14]}",live=True,preprocess=False),
|
| 230 |
-
gr.Interface.load(f"models/{models[15]}",live=True,preprocess=False),
|
| 231 |
-
gr.Interface.load(f"models/{models[16]}",live=True,preprocess=False),
|
| 232 |
-
gr.Interface.load(f"models/{models[17]}",live=True,preprocess=False),
|
| 233 |
-
gr.Interface.load(f"models/{models[18]}",live=True,preprocess=False),
|
| 234 |
-
gr.Interface.load(f"models/{models[19]}",live=True,preprocess=False),
|
| 235 |
-
|
| 236 |
-
gr.Interface.load(f"models/{models[20]}",live=True,preprocess=False),
|
| 237 |
-
gr.Interface.load(f"models/{models[21]}",live=True,preprocess=False),
|
| 238 |
-
gr.Interface.load(f"models/{models[22]}",live=True,preprocess=False),
|
| 239 |
-
gr.Interface.load(f"models/{models[23]}",live=True,preprocess=False),
|
| 240 |
-
gr.Interface.load(f"models/{models[24]}",live=True,preprocess=False),
|
| 241 |
-
gr.Interface.load(f"models/{models[25]}",live=True,preprocess=False),
|
| 242 |
-
gr.Interface.load(f"models/{models[26]}",live=True,preprocess=False),
|
| 243 |
-
gr.Interface.load(f"models/{models[27]}",live=True,preprocess=False),
|
| 244 |
-
gr.Interface.load(f"models/{models[28]}",live=True,preprocess=False),
|
| 245 |
-
gr.Interface.load(f"models/{models[29]}",live=True,preprocess=False),
|
| 246 |
-
|
| 247 |
-
gr.Interface.load(f"models/{models[30]}",live=True,preprocess=False),
|
| 248 |
-
gr.Interface.load(f"models/{models[31]}",live=True,preprocess=False),
|
| 249 |
-
gr.Interface.load(f"models/{models[32]}",live=True,preprocess=False),
|
| 250 |
-
gr.Interface.load(f"models/{models[33]}",live=True,preprocess=False),
|
| 251 |
-
gr.Interface.load(f"models/{models[34]}",live=True,preprocess=False),
|
| 252 |
-
gr.Interface.load(f"models/{models[35]}",live=True,preprocess=False),
|
| 253 |
-
gr.Interface.load(f"models/{models[36]}",live=True,preprocess=False),
|
| 254 |
-
gr.Interface.load(f"models/{models[37]}",live=True,preprocess=False),
|
| 255 |
-
gr.Interface.load(f"models/{models[38]}",live=True,preprocess=False),
|
| 256 |
-
gr.Interface.load(f"models/{models[39]}",live=True,preprocess=False),
|
| 257 |
-
|
| 258 |
-
gr.Interface.load(f"models/{models[40]}",live=True,preprocess=False),
|
| 259 |
-
gr.Interface.load(f"models/{models[41]}",live=True,preprocess=False),
|
| 260 |
-
gr.Interface.load(f"models/{models[42]}",live=True,preprocess=False),
|
| 261 |
-
gr.Interface.load(f"models/{models[43]}",live=True,preprocess=False),
|
| 262 |
-
gr.Interface.load(f"models/{models[44]}",live=True,preprocess=False),
|
| 263 |
-
gr.Interface.load(f"models/{models[45]}",live=True,preprocess=False),
|
| 264 |
-
gr.Interface.load(f"models/{models[46]}",live=True,preprocess=False),
|
| 265 |
-
gr.Interface.load(f"models/{models[47]}",live=True,preprocess=False),
|
| 266 |
-
gr.Interface.load(f"models/{models[48]}",live=True,preprocess=False),
|
| 267 |
-
gr.Interface.load(f"models/{models[49]}",live=True,preprocess=False),
|
| 268 |
-
|
| 269 |
-
gr.Interface.load(f"models/{models[50]}",live=True,preprocess=False),
|
| 270 |
-
gr.Interface.load(f"models/{models[51]}",live=True,preprocess=False),
|
| 271 |
-
gr.Interface.load(f"models/{models[52]}",live=True,preprocess=False),
|
| 272 |
-
gr.Interface.load(f"models/{models[53]}",live=True,preprocess=False),
|
| 273 |
-
gr.Interface.load(f"models/{models[54]}",live=True,preprocess=False),
|
| 274 |
-
gr.Interface.load(f"models/{models[55]}",live=True,preprocess=False),
|
| 275 |
-
gr.Interface.load(f"models/{models[56]}",live=True,preprocess=False),
|
| 276 |
-
gr.Interface.load(f"models/{models[57]}",live=True,preprocess=False),
|
| 277 |
-
gr.Interface.load(f"models/{models[58]}",live=True,preprocess=False),
|
| 278 |
-
gr.Interface.load(f"models/{models[59]}",live=True,preprocess=False),
|
| 279 |
-
|
| 280 |
-
gr.Interface.load(f"models/{models[60]}",live=True,preprocess=False),
|
| 281 |
-
gr.Interface.load(f"models/{models[61]}",live=True,preprocess=False),
|
| 282 |
-
gr.Interface.load(f"models/{models[62]}",live=True,preprocess=False),
|
| 283 |
-
gr.Interface.load(f"models/{models[63]}",live=True,preprocess=False),
|
| 284 |
-
gr.Interface.load(f"models/{models[64]}",live=True,preprocess=False),
|
| 285 |
-
gr.Interface.load(f"models/{models[65]}",live=True,preprocess=False),
|
| 286 |
-
gr.Interface.load(f"models/{models[66]}",live=True,preprocess=False),
|
| 287 |
-
gr.Interface.load(f"models/{models[67]}",live=True,preprocess=False),
|
| 288 |
-
gr.Interface.load(f"models/{models[68]}",live=True,preprocess=False),
|
| 289 |
-
gr.Interface.load(f"models/{models[69]}",live=True,preprocess=False),
|
| 290 |
-
|
| 291 |
-
gr.Interface.load(f"models/{models[70]}",live=True,preprocess=False),
|
| 292 |
-
gr.Interface.load(f"models/{models[71]}",live=True,preprocess=False),
|
| 293 |
-
gr.Interface.load(f"models/{models[72]}",live=True,preprocess=False),
|
| 294 |
-
gr.Interface.load(f"models/{models[73]}",live=True,preprocess=False),
|
| 295 |
-
gr.Interface.load(f"models/{models[74]}",live=True,preprocess=False),
|
| 296 |
-
gr.Interface.load(f"models/{models[75]}",live=True,preprocess=False),
|
| 297 |
-
gr.Interface.load(f"models/{models[76]}",live=True,preprocess=False),
|
| 298 |
-
gr.Interface.load(f"models/{models[77]}",live=True,preprocess=False),
|
| 299 |
-
gr.Interface.load(f"models/{models[78]}",live=True,preprocess=False),
|
| 300 |
-
gr.Interface.load(f"models/{models[79]}",live=True,preprocess=False),
|
| 301 |
-
|
| 302 |
-
gr.Interface.load(f"models/{models[80]}",live=True,preprocess=False),
|
| 303 |
-
gr.Interface.load(f"models/{models[81]}",live=True,preprocess=False),
|
| 304 |
-
gr.Interface.load(f"models/{models[82]}",live=True,preprocess=False),
|
| 305 |
-
gr.Interface.load(f"models/{models[83]}",live=True,preprocess=False),
|
| 306 |
-
gr.Interface.load(f"models/{models[84]}",live=True,preprocess=False),
|
| 307 |
-
gr.Interface.load(f"models/{models[85]}",live=True,preprocess=False),
|
| 308 |
-
gr.Interface.load(f"models/{models[86]}",live=True,preprocess=False),
|
| 309 |
-
gr.Interface.load(f"models/{models[87]}",live=True,preprocess=False),
|
| 310 |
-
gr.Interface.load(f"models/{models[88]}",live=True,preprocess=False),
|
| 311 |
-
gr.Interface.load(f"models/{models[89]}",live=True,preprocess=False),
|
| 312 |
-
|
| 313 |
-
gr.Interface.load(f"models/{models[90]}",live=True,preprocess=False),
|
| 314 |
-
gr.Interface.load(f"models/{models[91]}",live=True,preprocess=False),
|
| 315 |
-
gr.Interface.load(f"models/{models[92]}",live=True,preprocess=False),
|
| 316 |
-
gr.Interface.load(f"models/{models[93]}",live=True,preprocess=False),
|
| 317 |
-
gr.Interface.load(f"models/{models[94]}",live=True,preprocess=False),
|
| 318 |
-
gr.Interface.load(f"models/{models[95]}",live=True,preprocess=False),
|
| 319 |
-
gr.Interface.load(f"models/{models[96]}",live=True,preprocess=False),
|
| 320 |
-
gr.Interface.load(f"models/{models[97]}",live=True,preprocess=False),
|
| 321 |
-
gr.Interface.load(f"models/{models[98]}",live=True,preprocess=False),
|
| 322 |
-
gr.Interface.load(f"models/{models[99]}",live=True,preprocess=False),
|
| 323 |
-
|
| 324 |
-
gr.Interface.load(f"models/{models[100]}",live=True,preprocess=False),
|
| 325 |
-
gr.Interface.load(f"models/{models[101]}",live=True,preprocess=False),
|
| 326 |
-
gr.Interface.load(f"models/{models[102]}",live=True,preprocess=False),
|
| 327 |
-
gr.Interface.load(f"models/{models[103]}",live=True,preprocess=False),
|
| 328 |
-
gr.Interface.load(f"models/{models[104]}",live=True,preprocess=False),
|
| 329 |
-
gr.Interface.load(f"models/{models[105]}",live=True,preprocess=False),
|
| 330 |
-
gr.Interface.load(f"models/{models[106]}",live=True,preprocess=False),
|
| 331 |
-
gr.Interface.load(f"models/{models[107]}",live=True,preprocess=False),
|
| 332 |
-
gr.Interface.load(f"models/{models[108]}",live=True,preprocess=False),
|
| 333 |
-
gr.Interface.load(f"models/{models[109]}",live=True,preprocess=False),
|
| 334 |
-
|
| 335 |
-
gr.Interface.load(f"models/{models[110]}",live=True,preprocess=False),
|
| 336 |
-
gr.Interface.load(f"models/{models[111]}",live=True,preprocess=False),
|
| 337 |
-
gr.Interface.load(f"models/{models[112]}",live=True,preprocess=False),
|
| 338 |
-
gr.Interface.load(f"models/{models[113]}",live=True,preprocess=False),
|
| 339 |
-
gr.Interface.load(f"models/{models[114]}",live=True,preprocess=False),
|
| 340 |
-
gr.Interface.load(f"models/{models[115]}",live=True,preprocess=False),
|
| 341 |
-
gr.Interface.load(f"models/{models[116]}",live=True,preprocess=False),
|
| 342 |
-
gr.Interface.load(f"models/{models[117]}",live=True,preprocess=False),
|
| 343 |
-
gr.Interface.load(f"models/{models[118]}",live=True,preprocess=False),
|
| 344 |
-
gr.Interface.load(f"models/{models[119]}",live=True,preprocess=False),
|
| 345 |
-
|
| 346 |
-
gr.Interface.load(f"models/{models[120]}",live=True,preprocess=False),
|
| 347 |
-
gr.Interface.load(f"models/{models[121]}",live=True,preprocess=False),
|
| 348 |
-
gr.Interface.load(f"models/{models[122]}",live=True,preprocess=False),
|
| 349 |
-
gr.Interface.load(f"models/{models[123]}",live=True,preprocess=False),
|
| 350 |
-
gr.Interface.load(f"models/{models[124]}",live=True,preprocess=False),
|
| 351 |
-
gr.Interface.load(f"models/{models[125]}",live=True,preprocess=False),
|
| 352 |
-
gr.Interface.load(f"models/{models[126]}",live=True,preprocess=False),
|
| 353 |
-
gr.Interface.load(f"models/{models[127]}",live=True,preprocess=False),
|
| 354 |
-
gr.Interface.load(f"models/{models[128]}",live=True,preprocess=False),
|
| 355 |
-
gr.Interface.load(f"models/{models[129]}",live=True,preprocess=False),
|
| 356 |
-
|
| 357 |
-
gr.Interface.load(f"models/{models[130]}",live=True,preprocess=False),
|
| 358 |
-
gr.Interface.load(f"models/{models[131]}",live=True,preprocess=False),
|
| 359 |
-
gr.Interface.load(f"models/{models[132]}",live=True,preprocess=False),
|
| 360 |
-
gr.Interface.load(f"models/{models[133]}",live=True,preprocess=False),
|
| 361 |
-
gr.Interface.load(f"models/{models[134]}",live=True,preprocess=False),
|
| 362 |
-
gr.Interface.load(f"models/{models[135]}",live=True,preprocess=False),
|
| 363 |
-
gr.Interface.load(f"models/{models[136]}",live=True,preprocess=False),
|
| 364 |
-
gr.Interface.load(f"models/{models[137]}",live=True,preprocess=False),
|
| 365 |
-
gr.Interface.load(f"models/{models[138]}",live=True,preprocess=False),
|
| 366 |
-
gr.Interface.load(f"models/{models[139]}",live=True,preprocess=False),
|
| 367 |
-
|
| 368 |
-
gr.Interface.load(f"models/{models[140]}",live=True,preprocess=False),
|
| 369 |
-
gr.Interface.load(f"models/{models[141]}",live=True,preprocess=False),
|
| 370 |
-
gr.Interface.load(f"models/{models[142]}",live=True,preprocess=False),
|
| 371 |
-
gr.Interface.load(f"models/{models[143]}",live=True,preprocess=False),
|
| 372 |
-
gr.Interface.load(f"models/{models[144]}",live=True,preprocess=False),
|
| 373 |
-
gr.Interface.load(f"models/{models[145]}",live=True,preprocess=False),
|
| 374 |
-
gr.Interface.load(f"models/{models[146]}",live=True,preprocess=False),
|
| 375 |
-
gr.Interface.load(f"models/{models[147]}",live=True,preprocess=False),
|
| 376 |
-
gr.Interface.load(f"models/{models[148]}",live=True,preprocess=False),
|
| 377 |
-
gr.Interface.load(f"models/{models[149]}",live=True,preprocess=False),
|
| 378 |
|
| 379 |
-
|
| 380 |
-
|
| 381 |
-
gr.Interface.load(f"models/{models[152]}",live=True,preprocess=False),
|
| 382 |
-
gr.Interface.load(f"models/{models[153]}",live=True,preprocess=False),
|
| 383 |
-
gr.Interface.load(f"models/{models[154]}",live=True,preprocess=False),
|
| 384 |
-
gr.Interface.load(f"models/{models[155]}",live=True,preprocess=False),
|
| 385 |
-
gr.Interface.load(f"models/{models[156]}",live=True,preprocess=False),
|
| 386 |
-
gr.Interface.load(f"models/{models[157]}",live=True,preprocess=False),
|
| 387 |
-
gr.Interface.load(f"models/{models[158]}",live=True,preprocess=False),
|
| 388 |
-
gr.Interface.load(f"models/{models[159]}",live=True,preprocess=False),
|
| 389 |
-
|
| 390 |
-
gr.Interface.load(f"models/{models[160]}",live=True,preprocess=False),
|
| 391 |
-
gr.Interface.load(f"models/{models[161]}",live=True,preprocess=False),
|
| 392 |
-
gr.Interface.load(f"models/{models[162]}",live=True,preprocess=False),
|
| 393 |
-
gr.Interface.load(f"models/{models[163]}",live=True,preprocess=False),
|
| 394 |
-
gr.Interface.load(f"models/{models[164]}",live=True,preprocess=False),
|
| 395 |
-
gr.Interface.load(f"models/{models[165]}",live=True,preprocess=False),
|
| 396 |
-
gr.Interface.load(f"models/{models[166]}",live=True,preprocess=False),
|
| 397 |
-
gr.Interface.load(f"models/{models[167]}",live=True,preprocess=False),
|
| 398 |
-
gr.Interface.load(f"models/{models[168]}",live=True,preprocess=False),
|
| 399 |
-
gr.Interface.load(f"models/{models[169]}",live=True,preprocess=False),
|
| 400 |
-
|
| 401 |
-
gr.Interface.load(f"models/{models[170]}",live=True,preprocess=False),
|
| 402 |
-
gr.Interface.load(f"models/{models[171]}",live=True,preprocess=False),
|
| 403 |
-
gr.Interface.load(f"models/{models[172]}",live=True,preprocess=False),
|
| 404 |
-
gr.Interface.load(f"models/{models[173]}",live=True,preprocess=False),
|
| 405 |
-
gr.Interface.load(f"models/{models[174]}",live=True,preprocess=False),
|
| 406 |
-
gr.Interface.load(f"models/{models[175]}",live=True,preprocess=False),
|
| 407 |
-
gr.Interface.load(f"models/{models[176]}",live=True,preprocess=False),
|
| 408 |
-
gr.Interface.load(f"models/{models[177]}",live=True,preprocess=False),
|
| 409 |
-
gr.Interface.load(f"models/{models[178]}",live=True,preprocess=False),
|
| 410 |
-
gr.Interface.load(f"models/{models[179]}",live=True,preprocess=False),
|
| 411 |
-
|
| 412 |
-
gr.Interface.load(f"models/{models[180]}",live=True,preprocess=False),
|
| 413 |
-
gr.Interface.load(f"models/{models[181]}",live=True,preprocess=False),
|
| 414 |
-
gr.Interface.load(f"models/{models[182]}",live=True,preprocess=False),
|
| 415 |
-
gr.Interface.load(f"models/{models[183]}",live=True,preprocess=False),
|
| 416 |
-
gr.Interface.load(f"models/{models[184]}",live=True,preprocess=False),
|
| 417 |
-
gr.Interface.load(f"models/{models[185]}",live=True,preprocess=False),
|
| 418 |
-
gr.Interface.load(f"models/{models[186]}",live=True,preprocess=False),
|
| 419 |
-
gr.Interface.load(f"models/{models[187]}",live=True,preprocess=False),
|
| 420 |
-
gr.Interface.load(f"models/{models[188]}",live=True,preprocess=False),
|
| 421 |
-
gr.Interface.load(f"models/{models[189]}",live=True,preprocess=False),
|
| 422 |
-
|
| 423 |
-
gr.Interface.load(f"models/{models[190]}",live=True,preprocess=False),
|
| 424 |
-
gr.Interface.load(f"models/{models[191]}",live=True,preprocess=False),
|
| 425 |
-
gr.Interface.load(f"models/{models[192]}",live=True,preprocess=False),
|
| 426 |
-
gr.Interface.load(f"models/{models[193]}",live=True,preprocess=False),
|
| 427 |
-
gr.Interface.load(f"models/{models[194]}",live=True,preprocess=False),
|
| 428 |
-
gr.Interface.load(f"models/{models[195]}",live=True,preprocess=False),
|
| 429 |
-
gr.Interface.load(f"models/{models[196]}",live=True,preprocess=False),
|
| 430 |
-
gr.Interface.load(f"models/{models[197]}",live=True,preprocess=False),
|
| 431 |
-
gr.Interface.load(f"models/{models[198]}",live=True,preprocess=False),
|
| 432 |
-
gr.Interface.load(f"models/{models[199]}",live=True,preprocess=False),
|
| 433 |
-
|
| 434 |
-
|
| 435 |
-
]
|
| 436 |
-
|
| 437 |
-
|
| 438 |
-
def text_it1(inputs,text_gen1=text_gen1):
|
| 439 |
-
go_t1=text_gen1(inputs)
|
| 440 |
return(go_t1)
|
| 441 |
|
| 442 |
def set_model(current_model):
|
| 443 |
current_model = models[current_model]
|
| 444 |
return gr.update(label=(f"{current_model}"))
|
| 445 |
|
| 446 |
-
|
| 447 |
-
|
| 448 |
-
|
| 449 |
-
|
| 450 |
-
|
| 451 |
-
|
| 452 |
-
|
| 453 |
-
|
| 454 |
-
|
| 455 |
-
|
| 456 |
-
|
| 457 |
-
|
| 458 |
-
|
| 459 |
-
|
| 460 |
-
|
| 461 |
-
|
| 462 |
-
|
| 463 |
-
|
| 464 |
-
|
| 465 |
-
|
| 466 |
-
|
| 467 |
-
|
| 468 |
-
|
| 469 |
-
|
| 470 |
-
|
| 471 |
-
|
| 472 |
-
|
| 473 |
-
|
| 474 |
-
|
| 475 |
-
|
| 476 |
-
|
| 477 |
-
|
| 478 |
-
|
| 479 |
-
|
| 480 |
-
|
| 481 |
-
|
| 482 |
-
|
| 483 |
-
|
| 484 |
-
|
| 485 |
-
|
| 486 |
-
|
| 487 |
-
|
| 488 |
-
|
| 489 |
-
|
| 490 |
-
|
| 491 |
-
|
| 492 |
-
|
| 493 |
-
|
| 494 |
-
|
| 495 |
-
|
| 496 |
-
|
| 497 |
-
|
| 498 |
-
|
| 499 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 500 |
with gr.Row():
|
| 501 |
with gr.Column(scale=100):
|
| 502 |
-
#Model selection dropdown
|
| 503 |
-
model_name1 = gr.Dropdown(label="Select Model", choices=[m for m in models], type="index",
|
|
|
|
| 504 |
with gr.Row():
|
| 505 |
with gr.Column(scale=100):
|
| 506 |
-
|
| 507 |
-
|
| 508 |
-
|
| 509 |
-
|
| 510 |
-
|
| 511 |
-
|
| 512 |
-
|
| 513 |
-
|
| 514 |
-
|
| 515 |
-
|
| 516 |
-
|
| 517 |
-
|
| 518 |
-
|
| 519 |
-
#font-size: 14px !important;
|
| 520 |
-
#font-weight: 500 !important;
|
| 521 |
-
#height: 48px !important;
|
| 522 |
-
#justify-content: center !important;
|
| 523 |
-
#letter-spacing: .25px !important;
|
| 524 |
-
#line-height: normal !important;
|
| 525 |
-
#max-width: 100% !important;
|
| 526 |
-
#overflow: visible !important;
|
| 527 |
-
#padding: 2px 24px !important;
|
| 528 |
-
#position: relative !important;
|
| 529 |
-
#text-align: center !important;
|
| 530 |
-
#text-transform: none !important;
|
| 531 |
-
#transition: box-shadow 280ms cubic-bezier(.4, 0, .2, 1),opacity 15ms linear 30ms,transform 270ms cubic-bezier(0, 0, .2, 1) 0ms !important;
|
| 532 |
-
#user-select: none !important;
|
| 533 |
-
#-webkit-user-select: none !important;
|
| 534 |
-
#touch-action: manipulation !important;
|
| 535 |
-
#width: auto !important;
|
| 536 |
-
#will-change: transform,opacity !important;
|
| 537 |
-
#z-index: 0 !important;
|
| 538 |
-
gr.HTML("""<style> .gr-button {
|
| 539 |
-
color: white !important;
|
| 540 |
-
text-shadow: 1px 1px 0 rgba(0, 0, 0, 1) !important;
|
| 541 |
-
background-image: linear-gradient(#ff9e0c, #ffd31e) !important;
|
| 542 |
-
border-radius: 24px !important;
|
| 543 |
-
border: solid 1px !important;
|
| 544 |
-
border-top-color: #ffffff !important;
|
| 545 |
-
border-right-color: #000000 !important;
|
| 546 |
-
border-bottom-color: #000000 !important;
|
| 547 |
-
border-left-color: #ffffff !important;
|
| 548 |
-
padding: 6px 30px;
|
| 549 |
-
}
|
| 550 |
|
| 551 |
-
.gr-button:active {
|
| 552 |
-
font-size: 98% !important;
|
| 553 |
-
text-shadow: 0px 0px 0 rgba(0, 0, 0, 1) !important;
|
| 554 |
-
border-top-color: #000000 !important;
|
| 555 |
-
border-right-color: #ffffff !important;
|
| 556 |
-
border-bottom-color: #ffffff !important;
|
| 557 |
-
border-left-color: #000000 !important;
|
| 558 |
-
}
|
| 559 |
-
|
| 560 |
-
</style>""")
|
| 561 |
-
run=gr.Button("Generate Image")
|
| 562 |
with gr.Row():
|
| 563 |
-
with gr.Column(
|
| 564 |
-
output1=gr.Image(label=(f"{current_model}")
|
|
|
|
| 565 |
|
| 566 |
-
|
| 567 |
with gr.Row():
|
| 568 |
with gr.Column(scale=50):
|
| 569 |
-
input_text=gr.Textbox(label="Use this box to extend an idea automagically, by typing some words and clicking Extend Idea",lines=2)
|
| 570 |
-
|
| 571 |
-
|
| 572 |
-
|
| 573 |
-
|
| 574 |
def short_prompt(inputs):
|
| 575 |
-
return(inputs)
|
| 576 |
-
|
| 577 |
-
model_name1.change(set_model,inputs=model_name1,outputs=[output1])
|
| 578 |
-
|
| 579 |
-
run.click(send_it1, inputs=[magic1, model_name1], outputs=[output1])
|
| 580 |
-
|
| 581 |
-
use_short.click(short_prompt,inputs=[input_text],outputs=magic1)
|
| 582 |
|
| 583 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 584 |
|
| 585 |
-
myface.queue(
|
| 586 |
-
myface.launch(
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
import os
|
| 3 |
+
from all_models import models
|
| 4 |
+
from externalmod import gr_Interface_load, save_image, randomize_seed
|
| 5 |
+
from prompt_extend import extend_prompt
|
| 6 |
+
import asyncio
|
| 7 |
+
from threading import RLock
|
| 8 |
+
lock = RLock()
|
| 9 |
+
HF_TOKEN = os.environ.get("HF_TOKEN") if os.environ.get("HF_TOKEN") else None # If private or gated models aren't used, ENV setting is unnecessary.
|
| 10 |
+
|
| 11 |
+
inference_timeout = 600
|
| 12 |
+
MAX_SEED = 2**32-1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
current_model = models[0]
|
| 14 |
+
text_gen1 = extend_prompt
|
| 15 |
|
| 16 |
+
models2 = [gr_Interface_load(f"models/{m}", live=False, preprocess=True, postprocess=False, hf_token=HF_TOKEN) for m in models]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
|
| 18 |
+
def text_it1(inputs, text_gen1=text_gen1):
|
| 19 |
+
go_t1 = text_gen1(inputs)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
return(go_t1)
|
| 21 |
|
| 22 |
def set_model(current_model):
|
| 23 |
current_model = models[current_model]
|
| 24 |
return gr.update(label=(f"{current_model}"))
|
| 25 |
|
| 26 |
+
def send_it1(inputs, model_choice, neg_input, height, width, steps, cfg, seed):
|
| 27 |
+
output1 = gen_fn(model_choice, inputs, neg_input, height, width, steps, cfg, seed)
|
| 28 |
+
return (output1)
|
| 29 |
+
|
| 30 |
+
# https://huggingface.co/docs/api-inference/detailed_parameters
|
| 31 |
+
# https://huggingface.co/docs/huggingface_hub/package_reference/inference_client
|
| 32 |
+
async def infer(model_index, prompt, nprompt="", height=0, width=0, steps=0, cfg=0, seed=-1, timeout=inference_timeout):
|
| 33 |
+
kwargs = {}
|
| 34 |
+
if height > 0: kwargs["height"] = height
|
| 35 |
+
if width > 0: kwargs["width"] = width
|
| 36 |
+
if steps > 0: kwargs["num_inference_steps"] = steps
|
| 37 |
+
if cfg > 0: cfg = kwargs["guidance_scale"] = cfg
|
| 38 |
+
if seed == -1: kwargs["seed"] = randomize_seed()
|
| 39 |
+
else: kwargs["seed"] = seed
|
| 40 |
+
task = asyncio.create_task(asyncio.to_thread(models2[model_index].fn,
|
| 41 |
+
prompt=prompt, negative_prompt=nprompt, **kwargs, token=HF_TOKEN))
|
| 42 |
+
await asyncio.sleep(0)
|
| 43 |
+
try:
|
| 44 |
+
result = await asyncio.wait_for(task, timeout=timeout)
|
| 45 |
+
except asyncio.TimeoutError as e:
|
| 46 |
+
print(e)
|
| 47 |
+
print(f"Task timed out: {models[model_index]}")
|
| 48 |
+
if not task.done(): task.cancel()
|
| 49 |
+
result = None
|
| 50 |
+
raise Exception(f"Task timed out: {models[model_index]}") from e
|
| 51 |
+
except Exception as e:
|
| 52 |
+
print(e)
|
| 53 |
+
if not task.done(): task.cancel()
|
| 54 |
+
result = None
|
| 55 |
+
raise Exception() from e
|
| 56 |
+
if task.done() and result is not None and not isinstance(result, tuple):
|
| 57 |
+
with lock:
|
| 58 |
+
png_path = "image.png"
|
| 59 |
+
image = save_image(result, png_path, models[model_index], prompt, nprompt, height, width, steps, cfg, seed)
|
| 60 |
+
return image
|
| 61 |
+
return None
|
| 62 |
+
|
| 63 |
+
def gen_fn(model_index, prompt, nprompt="", height=0, width=0, steps=0, cfg=0, seed=-1):
|
| 64 |
+
try:
|
| 65 |
+
loop = asyncio.new_event_loop()
|
| 66 |
+
result = loop.run_until_complete(infer(model_index, prompt, nprompt,
|
| 67 |
+
height, width, steps, cfg, seed, inference_timeout))
|
| 68 |
+
except (Exception, asyncio.CancelledError) as e:
|
| 69 |
+
print(e)
|
| 70 |
+
print(f"Task aborted: {models[model_index]}")
|
| 71 |
+
result = None
|
| 72 |
+
raise gr.Error(f"Task aborted: {models[model_index]}, Error: {e}")
|
| 73 |
+
finally:
|
| 74 |
+
loop.close()
|
| 75 |
+
return result
|
| 76 |
+
|
| 77 |
+
css="""
|
| 78 |
+
.gradio-container {background-image: linear-gradient(#254150, #1e2f40, #182634) !important;
|
| 79 |
+
color: #ffaa66 !important; font-family: 'IBM Plex Sans', sans-serif !important;}
|
| 80 |
+
h1 {font-size: 6em; color: #ffc99f; margin-top: 30px; margin-bottom: 30px;
|
| 81 |
+
text-shadow: 3px 3px 0 rgba(0, 0, 0, 1) !important;}
|
| 82 |
+
h3 {color: #ffc99f; !important;}
|
| 83 |
+
h4 {display: inline-block; color: #ffffff !important;}
|
| 84 |
+
.wrapper img {font-size: 98% !important; white-space: nowrap !important; text-align: center !important;
|
| 85 |
+
display: inline-block !important; color: #ffffff !important;}
|
| 86 |
+
.wrapper {color: #ffffff !important;}
|
| 87 |
+
.gr-box {background-image: linear-gradient(#182634, #1e2f40, #254150) !important;
|
| 88 |
+
border-top-color: #000000 !important; border-right-color: #ffffff !important;
|
| 89 |
+
border-bottom-color: #ffffff !important; border-left-color: #000000 !important;}
|
| 90 |
+
"""
|
| 91 |
+
|
| 92 |
+
with gr.Blocks(theme='John6666/YntecLight', fill_width=True, css=css) as myface:
|
| 93 |
+
gr.HTML(f"""
|
| 94 |
+
<div style="text-align: center; max-width: 1200px; margin: 0 auto;">
|
| 95 |
+
<div class="center"><h1>ToyWorld XL</h1></div>
|
| 96 |
+
<p style="margin-bottom: 1px; color: #ffaa66;">
|
| 97 |
+
<h3>Top {int(len(models))} SDXL models, but why? For your enjoyment!</h3></p>
|
| 98 |
+
<br><div class="wrapper">9.23 <img src="https://huggingface.co/Yntec/DucHaitenLofi/resolve/main/NEW.webp" alt="NEW!" style="width:32px;height:16px;">Negative prompts, Width, Height, Steps, Guidance, Seeds and 100 models added!</div>
|
| 99 |
+
<p style="margin-bottom: 1px; font-size: 98%">
|
| 100 |
+
<br><div class="wrapper">Try mode than 900 image models at the <u><a href="https://huggingface.co/spaces/Yntec/PrintingPress">PrintingPress</a></u>, and use 6 different models at <u><a href="https://huggingface.co/spaces/Yntec/ToyWorld">ToyWorld!</a></u>!
|
| 101 |
+
</p></p></div>
|
| 102 |
+
""", elem_classes="gr-box")
|
| 103 |
with gr.Row():
|
| 104 |
with gr.Column(scale=100):
|
| 105 |
+
# Model selection dropdown
|
| 106 |
+
model_name1 = gr.Dropdown(label="Select Model", choices=[m for m in models], type="index",
|
| 107 |
+
value=current_model, interactive=True, elem_classes=["gr-box", "gr-input"])
|
| 108 |
with gr.Row():
|
| 109 |
with gr.Column(scale=100):
|
| 110 |
+
with gr.Group():
|
| 111 |
+
magic1 = gr.Textbox(label="Your Prompt", lines=4, elem_classes=["gr-box", "gr-input"]) #Positive
|
| 112 |
+
with gr.Accordion("Advanced", open=False, visible=True):
|
| 113 |
+
neg_input = gr.Textbox(label='Negative prompt', lines=1, elem_classes=["gr-box", "gr-input"])
|
| 114 |
+
with gr.Row():
|
| 115 |
+
width = gr.Slider(label="Width", info="If 0, the default value is used.", maximum=1216, step=32, value=0, elem_classes=["gr-box", "gr-input"])
|
| 116 |
+
height = gr.Slider(label="Height", info="If 0, the default value is used.", maximum=1216, step=32, value=0, elem_classes=["gr-box", "gr-input"])
|
| 117 |
+
with gr.Row():
|
| 118 |
+
steps = gr.Slider(label="Number of inference steps", info="If 0, the default value is used.", maximum=33, step=1, value=0, elem_classes=["gr-box", "gr-input"])
|
| 119 |
+
cfg = gr.Slider(label="Guidance scale", info="If 0, the default value is used.", maximum=30.0, step=0.1, value=-1, elem_classes=["gr-box", "gr-input"])
|
| 120 |
+
seed = gr.Slider(label="Seed", info="Randomize Seed if -1.", minimum=-1, maximum=MAX_SEED, step=1, value=-1, elem_classes=["gr-box", "gr-input"])
|
| 121 |
+
seed_rand = gr.Button("Randomize Seed 🎲", size="sm", variant="secondary")
|
| 122 |
+
run = gr.Button("Generate Image", variant="primary", elem_classes="gr-button")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 123 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 124 |
with gr.Row():
|
| 125 |
+
with gr.Column():
|
| 126 |
+
output1 = gr.Image(label=(f"{current_model}"), show_download_button=True,
|
| 127 |
+
interactive=False, show_share_button=False, format=".png", elem_classes="gr-box")
|
| 128 |
|
|
|
|
| 129 |
with gr.Row():
|
| 130 |
with gr.Column(scale=50):
|
| 131 |
+
input_text=gr.Textbox(label="Use this box to extend an idea automagically, by typing some words and clicking Extend Idea", lines=2, elem_classes=["gr-box", "gr-input"])
|
| 132 |
+
see_prompts=gr.Button("Extend Idea -> overwrite the contents of the `Your Prompt´ box above", variant="primary", elem_classes="gr-button")
|
| 133 |
+
use_short=gr.Button("Copy the contents of this box to the `Your Prompt´ box above", variant="primary", elem_classes="gr-button")
|
|
|
|
|
|
|
| 134 |
def short_prompt(inputs):
|
| 135 |
+
return (inputs)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 136 |
|
| 137 |
+
model_name1.change(set_model, inputs=model_name1, outputs=[output1])
|
| 138 |
+
gr.on(
|
| 139 |
+
triggers=[run.click, magic1.submit],
|
| 140 |
+
fn=send_it1,
|
| 141 |
+
inputs=[magic1, model_name1, neg_input, height, width, steps, cfg, seed],
|
| 142 |
+
outputs=[output1],
|
| 143 |
+
concurrency_limit=None,
|
| 144 |
+
queue=False,
|
| 145 |
+
)
|
| 146 |
+
use_short.click(short_prompt, inputs=[input_text], outputs=magic1)
|
| 147 |
+
see_prompts.click(text_it1, inputs=[input_text], outputs=magic1)
|
| 148 |
+
seed_rand.click(randomize_seed, None, [seed], queue=False)
|
| 149 |
|
| 150 |
+
myface.queue(default_concurrency_limit=200, max_size=200)
|
| 151 |
+
myface.launch(show_api=False, max_threads=400)
|
| 152 |
+
# https://github.com/gradio-app/gradio/issues/6339
|