Update app.py
Browse files
app.py
CHANGED
@@ -45,10 +45,11 @@ def sldls(loris):
|
|
45 |
loris.append(lmh)
|
46 |
return loris
|
47 |
|
48 |
-
def chdr(apol,prompt,modil,los,stips,gaul):
|
49 |
try:
|
50 |
type="SD"
|
51 |
-
fnamo
|
|
|
52 |
flng=["yssup", "sllab", "stsaerb", "sinep", "selppin", "ssa", "tnuc", "mub", "kcoc", "kcid", "anigav", "dekan", "edun", "slatineg", "xes", "nrop", "stit", "ttub", "bojwolb", "noitartenep", "kcuf", "kcus", "kcil",]
|
53 |
flng=[itm[::-1] for itm in flng]
|
54 |
ptn = r"\b" + r"\b|\b".join(flng) + r"\b"
|
@@ -56,13 +57,10 @@ def chdr(apol,prompt,modil,los,stips,gaul):
|
|
56 |
print("onon buddy")
|
57 |
else:
|
58 |
dobj={'img_name':fnamo,'model':modil,'lora':los,'prompt':prompt,'steps':stips,'type':type}
|
59 |
-
tre='./tmpo/'+fnamo+'.json'
|
60 |
-
tra='./tmpo/'+fnamo+'.png'
|
61 |
with open(tre, 'w') as f:
|
62 |
json.dump(dobj, f)
|
63 |
HfApi.upload_folder(repo_id="JoPmt/hf_community_images",folder_path="./tmpo",repo_type="dataset",path_in_repo="./",token=HF_TOKEN)
|
64 |
dobj={'img_name':fnamo,'model':modil,'lora':los,'prompt':prompt,'steps':stips,'type':type,'haed':gaul,}
|
65 |
-
tre='./tmpo/'+fnamo+'.json'
|
66 |
with open(tre, 'w') as f:
|
67 |
json.dump(dobj, f)
|
68 |
HfApi.upload_folder(repo_id="JoPmt/Tst_datast_imgs",folder_path="./tmpo",repo_type="dataset",path_in_repo="./",token=HF_TOKEN)
|
@@ -199,8 +197,9 @@ def plex(prompt,neg_prompt,modil,stips,scaly,nut,wei,hei,los,loca,gaul,progress=
|
|
199 |
image = pipe(prompt=""+str(adi)+str(ldi)+prompt+"", negative_prompt=neg_prompt, generator=generator, num_inference_steps=stips, guidance_scale=scaly, width=wei, height=hei, cross_attention_kwargs={"scale": lora_scale})
|
200 |
for a, imze in enumerate(image["images"]):
|
201 |
apol.append(imze)
|
202 |
-
|
203 |
-
|
|
|
204 |
return apol
|
205 |
|
206 |
def aip(ill,api_name="/run"):
|
|
|
45 |
loris.append(lmh)
|
46 |
return loris
|
47 |
|
48 |
+
def chdr(apol,prompt,modil,los,stips,fnamo,gaul):
|
49 |
try:
|
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"
|
|
|
57 |
print("onon buddy")
|
58 |
else:
|
59 |
dobj={'img_name':fnamo,'model':modil,'lora':los,'prompt':prompt,'steps':stips,'type':type}
|
|
|
|
|
60 |
with open(tre, 'w') as f:
|
61 |
json.dump(dobj, f)
|
62 |
HfApi.upload_folder(repo_id="JoPmt/hf_community_images",folder_path="./tmpo",repo_type="dataset",path_in_repo="./",token=HF_TOKEN)
|
63 |
dobj={'img_name':fnamo,'model':modil,'lora':los,'prompt':prompt,'steps':stips,'type':type,'haed':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)
|
|
|
197 |
image = pipe(prompt=""+str(adi)+str(ldi)+prompt+"", negative_prompt=neg_prompt, generator=generator, num_inference_steps=stips, guidance_scale=scaly, width=wei, height=hei, cross_attention_kwargs={"scale": lora_scale})
|
198 |
for a, imze in enumerate(image["images"]):
|
199 |
apol.append(imze)
|
200 |
+
fnamo=""+str(int(time.time()))+""
|
201 |
+
imze.save('./tmpo/'+fnamo+'.png', 'PNG')
|
202 |
+
chdr(apol,prompt,modil,los,stips,fnamo,gaul)
|
203 |
return apol
|
204 |
|
205 |
def aip(ill,api_name="/run"):
|