Update app.py
Browse files
app.py
CHANGED
@@ -2,7 +2,7 @@ from diffusers import DiffusionPipeline
|
|
2 |
import torch
|
3 |
import gradio as gr
|
4 |
from PIL import Image
|
5 |
-
import os, random, gc, re, json, time, shutil
|
6 |
import PIL.Image
|
7 |
import tqdm
|
8 |
from accelerate import Accelerator
|
@@ -14,19 +14,69 @@ DO_NOT_TRACK=1
|
|
14 |
accelerator = Accelerator(cpu=True)
|
15 |
InferenceClient=InferenceClient()
|
16 |
|
17 |
-
models =[
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
loris=[]
|
19 |
apol=[]
|
20 |
|
21 |
-
def hgfdm(models):
|
22 |
-
models=models
|
23 |
-
poi=InferenceClient.list_deployed_models()
|
24 |
-
voi=poi["text-to-image"]
|
25 |
-
for met in voi:
|
26 |
-
pio=""+met+""
|
27 |
-
models.append(pio)
|
28 |
-
return models
|
29 |
-
|
30 |
def smdls(models):
|
31 |
models=models
|
32 |
mtlst=HfApi.list_models(filter="diffusers:StableDiffusionPipeline",limit=500,full=True,)
|
@@ -50,7 +100,7 @@ def chdr(apol,prompt,modil,los,stips,fnamo,gaul):
|
|
50 |
type="SD"
|
51 |
tre='./tmpo/'+fnamo+'.json'
|
52 |
tra='./tmpo/'+fnamo+'.png'
|
53 |
-
flng=["yssup", "sllab", "stsaerb", "sinep", "selppin", "ssa", "tnuc", "mub", "kcoc", "kcid", "anigav", "dekan", "edun", "slatineg", "xes", "nrop", "stit", "ttub", "bojwolb", "noitartenep", "kcuf", "kcus", "kcil",]
|
54 |
flng=[itm[::-1] for itm in flng]
|
55 |
ptn = r"\b" + r"\b|\b".join(flng) + r"\b"
|
56 |
if re.search(ptn, prompt, re.IGNORECASE):
|
@@ -64,7 +114,11 @@ def chdr(apol,prompt,modil,los,stips,fnamo,gaul):
|
|
64 |
with open(tre, 'w') as f:
|
65 |
json.dump(dobj, f)
|
66 |
HfApi.upload_folder(repo_id="JoPmt/Tst_datast_imgs",folder_path="./tmpo",repo_type="dataset",path_in_repo="./",token=HF_TOKEN)
|
67 |
-
try:
|
|
|
|
|
|
|
|
|
68 |
del tre
|
69 |
del tra
|
70 |
except:
|
|
|
2 |
import torch
|
3 |
import gradio as gr
|
4 |
from PIL import Image
|
5 |
+
import os, random, gc, re, json, time, shutil, glob
|
6 |
import PIL.Image
|
7 |
import tqdm
|
8 |
from accelerate import Accelerator
|
|
|
14 |
accelerator = Accelerator(cpu=True)
|
15 |
InferenceClient=InferenceClient()
|
16 |
|
17 |
+
models =[
|
18 |
+
"runwayml/stable-diffusion-v1-5",
|
19 |
+
"prompthero/openjourney-v4",
|
20 |
+
"CompVis/stable-diffusion-v1-4",
|
21 |
+
"stabilityai/stable-diffusion-2-1",
|
22 |
+
"stablediffusionapi/edge-of-realism",
|
23 |
+
"MirageML/fantasy-scene",
|
24 |
+
"wavymulder/lomo-diffusion",
|
25 |
+
"sd-dreambooth-library/fashion",
|
26 |
+
"DucHaiten/DucHaitenDreamWorld",
|
27 |
+
"VegaKH/Ultraskin",
|
28 |
+
"kandinsky-community/kandinsky-2-1",
|
29 |
+
"MirageML/lowpoly-cyberpunk",
|
30 |
+
"thehive/everyjourney-sdxl-0.9-finetuned",
|
31 |
+
"plasmo/woolitize-768sd1-5",
|
32 |
+
"plasmo/food-crit",
|
33 |
+
"johnslegers/epic-diffusion-v1.1",
|
34 |
+
"Fictiverse/ElRisitas",
|
35 |
+
"robotjung/SemiRealMix",
|
36 |
+
"herpritts/FFXIV-Style",
|
37 |
+
"prompthero/linkedin-diffusion",
|
38 |
+
"RayHell/popupBook-diffusion",
|
39 |
+
"MirageML/lowpoly-world",
|
40 |
+
"deadman44/SD_Photoreal_Merged_Models",
|
41 |
+
"johnslegers/epic-diffusion",
|
42 |
+
"tilake/China-Chic-illustration",
|
43 |
+
"wavymulder/modelshoot",
|
44 |
+
"prompthero/openjourney-lora",
|
45 |
+
"Fictiverse/Stable_Diffusion_VoxelArt_Model",
|
46 |
+
"darkstorm2150/Protogen_v2.2_Official_Release",
|
47 |
+
"hassanblend/HassanBlend1.5.1.2",
|
48 |
+
"hassanblend/hassanblend1.4",
|
49 |
+
"nitrosocke/redshift-diffusion",
|
50 |
+
"prompthero/openjourney-v2",
|
51 |
+
"nitrosocke/Arcane-Diffusion",
|
52 |
+
"Lykon/DreamShaper",
|
53 |
+
"wavymulder/Analog-Diffusion",
|
54 |
+
"nitrosocke/mo-di-diffusion",
|
55 |
+
"dreamlike-art/dreamlike-diffusion-1.0",
|
56 |
+
"dreamlike-art/dreamlike-photoreal-2.0",
|
57 |
+
"digiplay/RealismEngine_v1",
|
58 |
+
"digiplay/AIGEN_v1.4_diffusers",
|
59 |
+
"stablediffusionapi/dreamshaper-v6",
|
60 |
+
"p1atdev/liminal-space-diffusion",
|
61 |
+
"nadanainone/gigaschizonegs",
|
62 |
+
"lckidwell/album-cover-style",
|
63 |
+
"axolotron/ice-cream-animals",
|
64 |
+
"perion/ai-avatar",
|
65 |
+
"digiplay/GhostMix",
|
66 |
+
"ThePioneer/MISA",
|
67 |
+
"TheLastBen/froggy-style-v21-768",
|
68 |
+
"FloydianSound/Nixeu_Diffusion_v1-5",
|
69 |
+
"kakaobrain/karlo-v1-alpha-image-variations",
|
70 |
+
"digiplay/PotoPhotoRealism_v1",
|
71 |
+
"ConsistentFactor/Aurora-By_Consistent_Factor",
|
72 |
+
"rim0/quadruped_mechas",
|
73 |
+
"Akumetsu971/SD_Samurai_Anime_Model",
|
74 |
+
"Bojaxxx/Fantastic-Mr-Fox-Diffusion",
|
75 |
+
"sd-dreambooth-library/original-character-cyclps",
|
76 |
+
]
|
77 |
loris=[]
|
78 |
apol=[]
|
79 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
80 |
def smdls(models):
|
81 |
models=models
|
82 |
mtlst=HfApi.list_models(filter="diffusers:StableDiffusionPipeline",limit=500,full=True,)
|
|
|
100 |
type="SD"
|
101 |
tre='./tmpo/'+fnamo+'.json'
|
102 |
tra='./tmpo/'+fnamo+'.png'
|
103 |
+
flng=["yssup", "sllab", "stsaerb", "sinep", "selppin", "ssa", "tnuc", "mub", "kcoc", "kcid", "anigav", "dekan", "edun", "slatineg", "xes", "nrop", "stit", "ttub", "bojwolb", "noitartenep", "kcuf", "kcus", "kcil", "elttil", "gnuoy", "thgit", "lrig", "etitep", "dlihc", "yxes"]
|
104 |
flng=[itm[::-1] for itm in flng]
|
105 |
ptn = r"\b" + r"\b|\b".join(flng) + r"\b"
|
106 |
if re.search(ptn, prompt, re.IGNORECASE):
|
|
|
114 |
with open(tre, 'w') as f:
|
115 |
json.dump(dobj, f)
|
116 |
HfApi.upload_folder(repo_id="JoPmt/Tst_datast_imgs",folder_path="./tmpo",repo_type="dataset",path_in_repo="./",token=HF_TOKEN)
|
117 |
+
try:
|
118 |
+
for pgn in glob.glob('./tmpo/*.png'):
|
119 |
+
os.remove(pgn)
|
120 |
+
for jgn in glob.glob('./tmpo/*.json'):
|
121 |
+
os.remove(jgn)
|
122 |
del tre
|
123 |
del tra
|
124 |
except:
|