Spaces:
Runtime error
Runtime error
Commit
·
035ae84
1
Parent(s):
7d01b52
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,155 +1,79 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import os
|
| 2 |
from sys import executable as pyexecutable
|
| 3 |
import subprocess
|
| 4 |
import pathlib
|
| 5 |
import gc
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
while True:
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
while True:
|
| 19 |
-
i=subprocess.run([r"git",r"clone",URI,ClonePath])
|
| 20 |
-
if(i.returncode == 0 ):
|
| 21 |
-
del i
|
| 22 |
-
gc.collect()
|
| 23 |
-
return 0
|
| 24 |
-
else :
|
| 25 |
-
del i
|
| 26 |
-
def DownLoad(URI:str,DownloadPath:str,DownLoadFileName:str ) -> int:
|
| 27 |
-
while (True):
|
| 28 |
-
i=subprocess.run([r"aria2c",r"-c",r"-x" ,r"16", r"-s",r"16", r"-k" ,r"1M" ,r"-m",r"0",r"--enable-mmap=false",r"--console-log-level=error",r"-d",DownloadPath,r"-o",DownLoadFileName,URI]);
|
| 29 |
-
if(i.returncode == 0 ):
|
| 30 |
-
del i
|
| 31 |
-
gc.collect()
|
| 32 |
-
return 0
|
| 33 |
-
else :
|
| 34 |
-
del i
|
| 35 |
-
user_home =pathlib.Path.home().resolve()
|
| 36 |
os.chdir(str(user_home))
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
os.chdir(str(user_home / r"stable-diffusion-webui"))
|
| 41 |
-
os.system("git reset --hard 89f9faa63388756314e8a1d96cf86bf5e0663045")
|
| 42 |
-
#
|
| 43 |
-
|
| 44 |
-
#install extensions
|
| 45 |
-
print("installing extensions")
|
| 46 |
-
Gitclone(r"https://huggingface.co/embed/negative",str(user_home / r"stable-diffusion-webui" / r"embeddings" / r"negative"))
|
| 47 |
-
Gitclone(r"https://huggingface.co/embed/lora",str(user_home / r"stable-diffusion-webui" / r"models" / r"Lora" / r"positive"))
|
| 48 |
-
DownLoad(r"https://huggingface.co/embed/upscale/resolve/main/4x-UltraSharp.pth",str(user_home / r"stable-diffusion-webui" / r"models" / r"ESRGAN") ,r"4x-UltraSharp.pth")
|
| 49 |
-
while True:
|
| 50 |
-
if(subprocess.run([r"wget",r"https://raw.githubusercontent.com/camenduru/stable-diffusion-webui-scripts/main/run_n_times.py",r"-O",str(user_home / r"stable-diffusion-webui" / r"scripts" / r"run_n_times.py")]).returncode == 0):
|
| 51 |
-
break
|
| 52 |
-
Gitclone(r"https://github.com/deforum-art/deforum-for-automatic1111-webui",str(user_home / r"stable-diffusion-webui" / r"extensions" / r"deforum-for-automatic1111-webui" ))
|
| 53 |
-
Gitclone(r"https://github.com/AlUlkesh/stable-diffusion-webui-images-browser",str(user_home / r"stable-diffusion-webui" / r"extensions"/ r"stable-diffusion-webui-images-browser"))
|
| 54 |
-
Gitclone(r"https://github.com/camenduru/stable-diffusion-webui-huggingface",str(user_home / r"stable-diffusion-webui" / r"extensions" / r"stable-diffusion-webui-huggingface"))
|
| 55 |
-
Gitclone(r"https://github.com/camenduru/sd-civitai-browser",str(user_home / r"stable-diffusion-webui" / r"extensions" / r"sd-civitai-browser"))
|
| 56 |
-
Gitclone(r"https://github.com/kohya-ss/sd-webui-additional-networks",str(user_home / r"stable-diffusion-webui" / r"extensions" / r"sd-webui-additional-networks"))
|
| 57 |
-
Gitclone(r"https://github.com/Mikubill/sd-webui-controlnet",str(user_home / r"stable-diffusion-webui" / r"extensions" / r"sd-webui-controlnet"))
|
| 58 |
-
Gitclone(r"https://github.com/fkunn1326/openpose-editor",str(user_home / r"stable-diffusion-webui" / r"extensions" / r"openpose-editor"))
|
| 59 |
-
Gitclone(r"https://github.com/jexom/sd-webui-depth-lib",str(user_home / r"stable-diffusion-webui" / r"extensions" / r"sd-webui-depth-lib"))
|
| 60 |
-
Gitclone(r"https://github.com/hnmr293/posex",str(user_home / r"stable-diffusion-webui" / r"extensions" / r"posex"))
|
| 61 |
-
Gitclone(r"https://github.com/nonnonstop/sd-webui-3d-open-pose-editor",str(user_home / r"stable-diffusion-webui" / r"extensions" / r"sd-webui-3d-open-pose-editor"))
|
| 62 |
-
#中文本地化的请解除下一行的注释
|
| 63 |
-
#Gitclone(r"https://github.com/dtlnor/stable-diffusion-webui-localization-zh_CN.git",str(user_home / r"stable-diffusion-webui" / r"extensions" / r"stable-diffusion-webui-localization-zh_CN"))
|
| 64 |
-
Gitclone(r"https://github.com/DominikDoom/a1111-sd-webui-tagcomplete.git" , str(user_home / r"stable-diffusion-webui" / r"extensions" / r"a1111-sd-webui-tagcomplete"))
|
| 65 |
-
Gitclone(r"https://github.com/camenduru/sd-webui-tunnels",str(user_home / r"stable-diffusion-webui" / r"extensions" / r"sd-webui-tunnels"))
|
| 66 |
-
Gitclone(r"https://github.com/etherealxx/batchlinks-webui",str(user_home / r"stable-diffusion-webui" / r"extensions" / r"batchlinks-webui"))
|
| 67 |
-
Gitclone(r"https://github.com/catppuccin/stable-diffusion-webui",str(user_home / r"stable-diffusion-webui" / r"extensions" / r"stable-diffusion-webui-catppuccin"))
|
| 68 |
-
|
| 69 |
-
#Gitclone(r"https://github.com/KohakuBueleaf/a1111-sd-webui-locon",str(user_home / r"stable-diffusion-webui" / r"extensions" / r"a1111-sd-webui-locon" ))
|
| 70 |
-
Gitclone(r"https://github.com/AUTOMATIC1111/stable-diffusion-webui-rembg",str(user_home / r"stable-diffusion-webui" / r"extensions" / r"stable-diffusion-webui-rembg"))
|
| 71 |
-
Gitclone(r"https://github.com/ashen-sensored/stable-diffusion-webui-two-shot",str(user_home / r"stable-diffusion-webui" / r"extensions" / r"stable-diffusion-webui-two-shot"))
|
| 72 |
-
Gitclone(r"https://github.com/camenduru/sd_webui_stealth_pnginfo",str(user_home / r"stable-diffusion-webui" / r"extensions" / r"sd_webui_stealth_pnginfo"))
|
| 73 |
-
|
| 74 |
-
os.chdir(user_home / r"stable-diffusion-webui")
|
| 75 |
-
|
| 76 |
-
#download ControlNet models
|
| 77 |
-
print("extensions dolwnload done .\ndownloading ControlNet models")
|
| 78 |
-
dList =[r"https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11e_sd15_ip2p_fp16.safetensors",
|
| 79 |
-
r"https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11e_sd15_shuffle_fp16.safetensors",
|
| 80 |
-
r"https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_canny_fp16.safetensors",
|
| 81 |
-
r"https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11f1p_sd15_depth_fp16.safetensors",
|
| 82 |
-
r"https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_inpaint_fp16.safetensors",
|
| 83 |
-
r"https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_lineart_fp16.safetensors",
|
| 84 |
-
r"https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_mlsd_fp16.safetensors",
|
| 85 |
-
r"https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_normalbae_fp16.safetensors",
|
| 86 |
-
r"https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_openpose_fp16.safetensors",
|
| 87 |
-
r"https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_scribble_fp16.safetensors",
|
| 88 |
-
r"https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_seg_fp16.safetensors",
|
| 89 |
-
r"https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_softedge_fp16.safetensors",
|
| 90 |
-
r"https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15s2_lineart_anime_fp16.safetensors",
|
| 91 |
-
r"https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11f1e_sd15_tile_fp16.safetensors",
|
| 92 |
-
r"https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11e_sd15_ip2p_fp16.yaml",
|
| 93 |
-
r"https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11e_sd15_shuffle_fp16.yaml",
|
| 94 |
-
r"https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11p_sd15_canny_fp16.yaml",
|
| 95 |
-
r"https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11f1p_sd15_depth_fp16.yaml",
|
| 96 |
-
r"https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11p_sd15_inpaint_fp16.yaml",
|
| 97 |
-
r"https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11p_sd15_lineart_fp16.yaml",
|
| 98 |
-
r"https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11p_sd15_mlsd_fp16.yaml",
|
| 99 |
-
r"https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11p_sd15_normalbae_fp16.yaml",
|
| 100 |
-
r"https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11p_sd15_openpose_fp16.yaml",
|
| 101 |
-
r"https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11p_sd15_scribble_fp16.yaml",
|
| 102 |
-
r"https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11p_sd15_seg_fp16.yaml",
|
| 103 |
-
r"https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11p_sd15_softedge_fp16.yaml",
|
| 104 |
-
r"https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11p_sd15s2_lineart_anime_fp16.yaml",
|
| 105 |
-
r"https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11f1e_sd15_tile_fp16.yaml",
|
| 106 |
-
r"https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/t2iadapter_style_sd14v1.pth",
|
| 107 |
-
r"https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/t2iadapter_sketch_sd14v1.pth",
|
| 108 |
-
r"https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/t2iadapter_seg_sd14v1.pth",
|
| 109 |
-
r"https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/t2iadapter_openpose_sd14v1.pth",
|
| 110 |
-
r"https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/t2iadapter_keypose_sd14v1.pth",
|
| 111 |
-
r"https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/t2iadapter_depth_sd14v1.pth",
|
| 112 |
-
r"https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/t2iadapter_canny_sd14v1.pth",
|
| 113 |
-
r"https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/t2iadapter_canny_sd15v2.pth",
|
| 114 |
-
r"https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/t2iadapter_depth_sd15v2.pth",
|
| 115 |
-
r"https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/t2iadapter_sketch_sd15v2.pth",
|
| 116 |
-
r"https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/t2iadapter_zoedepth_sd15v1.pth"]
|
| 117 |
-
for i in range(0,len(dList)): DownLoad(dList[i],str(user_home / "stable-diffusion-webui" / "extensions" / "sd-webui-controlnet" / "models"),pathlib.Path(dList[i]).name)
|
| 118 |
-
del dList
|
| 119 |
-
|
| 120 |
-
#download model
|
| 121 |
-
#you can change model download address here
|
| 122 |
-
print("ControlNet models download done.\ndownloading model")
|
| 123 |
-
DownLoad(r"https://huggingface.co/ckpt/anything-v4.0/resolve/main/anything-v4.5-pruned.ckpt",str(user_home / r"stable-diffusion-webui" / r"models" / r"Stable-diffusion"),r"anything-v4.5-pruned.ckpt")
|
| 124 |
-
DownLoad(r"https://huggingface.co/ckpt/anything-v4.0/resolve/main/anything-v4.0.vae.pt",str(user_home / r"stable-diffusion-webui" / r"models" / r"Stable-diffusion"),r"anything-v4.0.vae.pt")
|
| 125 |
-
DownLoad(r"https://huggingface.co/gsdf/Counterfeit-V3.0/resolve/main/Counterfeit-V3.0_fp16.safetensors",str(user_home / r"stable-diffusion-webui" / r"models" / r"Stable-diffusion"),r"Counterfeit-V3.0_fp16.safetensors")
|
| 126 |
-
DownLoad(r"https://huggingface.co/WarriorMama777/OrangeMixs/resolve/main/Models/AbyssOrangeMix3/AOM3A1B_orangemixs.safetensors",str(user_home / r"stable-diffusion-webui" / r"models" / r"Stable-diffusion"),r"AOM3A1B_orangemixs.safetensors")
|
| 127 |
-
DownLoad(r"https://huggingface.co/Meina/MeinaPastel/resolve/main/MeinaPastelV5%20-%20Without%20VAE.safetensors",str(user_home / r"stable-diffusion-webui" / r"models" / r"Stable-diffusion"),r"MeinaPastelV5_WithoutVAE.safetensors")
|
| 128 |
-
DownLoad(r"https://civitai.com/api/download/models/9474",str(user_home / r"stable-diffusion-webui" / r"models" / r"Stable-diffusion"),r"chilloutmix_NiPrunedFp16.safetensors")
|
| 129 |
-
|
| 130 |
-
#My customly added models
|
| 131 |
-
DownLoad(r"https://civitai.com/api/download/models/105674?", str(user_home / r"stable-diffusion-webui" / r"models" / r"Stable-diffusion"),r"realisticVisionV30_v30VAE.safetensors")
|
| 132 |
-
DownLoad(r"https://civitai.com/api/download/models/94640", str(user_home / r"stable-diffusion-webui" / r"models" / r"Stable-diffusion"),r"majicmixRealistic_v6.safetensors")
|
| 133 |
-
DownLoad(r"https://civitai.com/api/download/models/109123", str(user_home / r"stable-diffusion-webui" / r"models" / r"Stable-diffusion"),r"dreamshaper_7.safetensors")
|
| 134 |
-
DownLoad(r"https://civitai.com/api/download/models/27392", str(user_home / r"stable-diffusion-webui" / r"models" / r"Stable-diffusion"),r"openjourney_V4.ckpt")
|
| 135 |
-
DownLoad(r"https://civitai.com/api/download/models/95489", str(user_home / r"stable-diffusion-webui" / r"models" / r"Stable-diffusion"),r"anyloraCheckpoint_bakedvaeBlessedFp16.safetensors")
|
| 136 |
-
DownLoad(r"https://civitai.com/api/download/models/90854", str(user_home / r"stable-diffusion-webui" / r"models" / r"Stable-diffusion"),r"AnythingV5Ink_ink.safetensors")
|
| 137 |
-
|
| 138 |
-
#LoRa ?
|
| 139 |
DownLoad(r"https://civitai.com/api/download/models/39885",str(user_home / r"stable-diffusion-webui" / r"extensions" / r"sd-webui-additional-networks" / r"models"/ r"lora"),r"Better_light.safetensors")
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
|
| 149 |
-
|
| 150 |
-
|
| 151 |
-
|
| 152 |
-
|
| 153 |
-
|
| 154 |
-
|
| 155 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
import torch
|
| 3 |
+
import numpy as np
|
| 4 |
+
import modin.pandas as pd
|
| 5 |
+
from PIL import Image
|
| 6 |
+
from diffusers import DiffusionPipeline
|
| 7 |
import os
|
| 8 |
from sys import executable as pyexecutable
|
| 9 |
import subprocess
|
| 10 |
import pathlib
|
| 11 |
import gc
|
| 12 |
+
def Gitclone(URI: str, ClonePath: str = "") -> int:
|
| 13 |
+
if ClonePath == "":
|
| 14 |
+
while True:
|
| 15 |
+
i = subprocess.run(["git", "clone", URI])
|
| 16 |
+
if i.returncode == 0:
|
| 17 |
+
del i
|
| 18 |
+
gc.collect()
|
| 19 |
+
return 0
|
| 20 |
+
else:
|
| 21 |
+
del i
|
| 22 |
+
else:
|
| 23 |
+
while True:
|
| 24 |
+
i = subprocess.run(["git", "clone", URI, ClonePath])
|
| 25 |
+
if i.returncode == 0:
|
| 26 |
+
del i
|
| 27 |
+
gc.collect()
|
| 28 |
+
return 0
|
| 29 |
+
else:
|
| 30 |
+
del i
|
| 31 |
+
def DownLoad(URI: str, DownloadPath: str, DownLoadFileName: str) -> int:
|
| 32 |
while True:
|
| 33 |
+
i = subprocess.run(["aria2c", "-c", "-x", "16", "-s", "16", "-k", "1M", "-m", "0", "--enable-mmap=false", "--console-log-level=error", "-d", DownloadPath, "-o", DownLoadFileName, URI])
|
| 34 |
+
if i.returncode == 0:
|
| 35 |
+
del i
|
| 36 |
+
gc.collect()
|
| 37 |
+
return 0
|
| 38 |
+
else:
|
| 39 |
+
del i
|
| 40 |
+
user_home = pathlib.Path.home().resolve()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
os.chdir(str(user_home))
|
| 42 |
+
os.chdir(user_home / "stable-diffusion-webui")
|
| 43 |
+
# download additional network model
|
| 44 |
+
print("Downloading additional network model")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
DownLoad(r"https://civitai.com/api/download/models/39885",str(user_home / r"stable-diffusion-webui" / r"extensions" / r"sd-webui-additional-networks" / r"models"/ r"lora"),r"Better_light.safetensors")
|
| 46 |
+
# load main models
|
| 47 |
+
device = 'cuda' if torch.cuda.is_available() else 'cpu'
|
| 48 |
+
def load_model(model_url):
|
| 49 |
+
return DiffusionPipeline.from_pretrained(model_url, use_safetensors=True).to(device)
|
| 50 |
+
model_url = "aipicasso/cool-japan-diffusion-2-1-0" # Замените на свою полную ссылку на модель
|
| 51 |
+
pipe = load_model(model_url)
|
| 52 |
+
refiner = DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-xl-refiner-1.0", use_safetensors=True).to(device)
|
| 53 |
+
upscaler = DiffusionPipeline.from_pretrained("stabilityai/sd-x2-latent-upscaler", torch_dtype=torch.float16, use_safetensors=True).to(device)
|
| 54 |
+
def genie(prompt, negative_prompt, height, width, scale, steps, seed, upscaling):
|
| 55 |
+
generator = torch.Generator(device=device).manual_seed(seed)
|
| 56 |
+
int_image = pipe(prompt, negative_prompt=negative_prompt, num_inference_steps=steps, height=height, width=width, guidance_scale=scale, num_images_per_prompt=1, generator=generator, output_type="latent").images
|
| 57 |
+
if upscaling == 'Yes':
|
| 58 |
+
image = refiner(prompt=prompt, image=int_image).images[0]
|
| 59 |
+
upscaled = upscaler(prompt=prompt, negative_prompt=negative_prompt, image=image, num_inference_steps=5, guidance_scale=0).images[0]
|
| 60 |
+
torch.cuda.empty_cache()
|
| 61 |
+
return (image, upscaled)
|
| 62 |
+
else:
|
| 63 |
+
image = refiner(prompt=prompt, negative_prompt=negative_prompt, image=int_image).images[0]
|
| 64 |
+
torch.cuda.empty_cache()
|
| 65 |
+
return (image, image)
|
| 66 |
+
|
| 67 |
+
gr.Interface(fn=genie, inputs=[gr.Textbox(label='Что вы хотите, чтобы ИИ генерировал'),
|
| 68 |
+
gr.Textbox(label='Что вы не хотите, чтобы ИИ генерировал'),
|
| 69 |
+
gr.Slider(512, 1024, 768, step=128, label='Высота картинки'),
|
| 70 |
+
gr.Slider(512, 1024, 768, step=128, label='Ширина картинки'),
|
| 71 |
+
gr.Slider(1, 15, 10, step=.25, label='Шкала расхождения'),
|
| 72 |
+
gr.Slider(25, maximum=100, value=50, step=25, label='Количество итераций'),
|
| 73 |
+
gr.Slider(minimum=1, step=1, maximum=999999999999999999, randomize=True, label='Зерно'),
|
| 74 |
+
gr.Radio(['Да', 'Нет'], label='Ремастеринг?')],
|
| 75 |
+
outputs=['image', 'image'],
|
| 76 |
+
title="Стабильная Диффузия - Japan-SD-2-1-0",
|
| 77 |
+
description="",
|
| 78 |
+
article="
|
| 79 |
+
").launch(debug=True, max_threads=80)
|