Spaces:
Running
on
T4
Running
on
T4
Commit
·
5c1a385
1
Parent(s):
ecce9fa
Update app.py
Browse files
app.py
CHANGED
@@ -8,22 +8,8 @@ hf_token = os.getenv("HF_TOKEN")
|
|
8 |
model_id = int(os.getenv("Model"))
|
9 |
nsfw_filter = int(os.getenv("Safe"))
|
10 |
|
11 |
-
#stable-diffusion-xl-base-1.0 0 - base model
|
12 |
-
#Colossus_Project_XL 1 - better people
|
13 |
-
#AlbedoBaseXL_v11 2 - realistic
|
14 |
-
#JuggernautXL_v7 3 - better faces
|
15 |
-
#RealVisXL_V2.0 4 - better photorealism
|
16 |
-
|
17 |
-
model_url_list = ["stabilityai/stable-diffusion-xl-base-1.0/blob/main/sd_xl_base_1.0.safetensors",
|
18 |
-
"Krebzonide/Colossus_Project_XL/blob/main/colossusProjectXLSFW_v202BakedVAE.safetensors",
|
19 |
-
"Krebzonide/AlbedoBaseXL_v11/blob/main/albedobaseXL_v11.safetensors",
|
20 |
-
"Krebzonide/JuggernautXL_version5/blob/main/juggernautXL_v7Rundiffusion.safetensors",
|
21 |
-
"SG161222/RealVisXL_V2.0/blob/main/RealVisXL_V2.0.safetensors",
|
22 |
-
"Krebzonide/AcornIsSpinning_acornXLV1/blob/main/acornIsSpinning_acornxlV1.safetensors"]
|
23 |
-
|
24 |
naughtyWords = ["nude", "nsfw", "naked", "porn", "boob", "tit", "nipple", "vagina", "pussy", "panties", "underwear", "upskirt", "bottomless", "topless", "petite", "xxx"]
|
25 |
|
26 |
-
|
27 |
css = """
|
28 |
.btn-green {
|
29 |
background-image: linear-gradient(to bottom right, #6dd178, #00a613) !important;
|
@@ -56,10 +42,7 @@ def generate(prompt, samp_steps, batch_size, seed, progress=gr.Progress(track_tq
|
|
56 |
).images
|
57 |
return gr.update(value = [(img, f"Image {i+1}") for i, img in enumerate(images)], height=height+90), seed
|
58 |
|
59 |
-
def set_base_model(
|
60 |
-
vae = AutoencoderKL.from_pretrained("madebyollin/sdxl-vae-fp16-fix", torch_dtype=torch.float16)
|
61 |
-
global model_url_list
|
62 |
-
model_url = "https://huggingface.co/" + model_url_list[base_model_id]
|
63 |
pipe = AutoPipelineForText2Image.from_pretrained(
|
64 |
"stabilityai/sdxl-turbo",
|
65 |
torch_dtype = torch.float16,
|
@@ -81,5 +64,5 @@ with gr.Blocks(css=css) as demo:
|
|
81 |
gallery = gr.Gallery(show_label=False, preview=True, container=False)
|
82 |
submit_btn.click(generate, [prompt, samp_steps, batch_size, seed], [gallery, lastSeed], queue=True)
|
83 |
|
84 |
-
pipe = set_base_model(
|
85 |
demo.launch(debug=True)
|
|
|
8 |
model_id = int(os.getenv("Model"))
|
9 |
nsfw_filter = int(os.getenv("Safe"))
|
10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
naughtyWords = ["nude", "nsfw", "naked", "porn", "boob", "tit", "nipple", "vagina", "pussy", "panties", "underwear", "upskirt", "bottomless", "topless", "petite", "xxx"]
|
12 |
|
|
|
13 |
css = """
|
14 |
.btn-green {
|
15 |
background-image: linear-gradient(to bottom right, #6dd178, #00a613) !important;
|
|
|
42 |
).images
|
43 |
return gr.update(value = [(img, f"Image {i+1}") for i, img in enumerate(images)], height=height+90), seed
|
44 |
|
45 |
+
def set_base_model():
|
|
|
|
|
|
|
46 |
pipe = AutoPipelineForText2Image.from_pretrained(
|
47 |
"stabilityai/sdxl-turbo",
|
48 |
torch_dtype = torch.float16,
|
|
|
64 |
gallery = gr.Gallery(show_label=False, preview=True, container=False)
|
65 |
submit_btn.click(generate, [prompt, samp_steps, batch_size, seed], [gallery, lastSeed], queue=True)
|
66 |
|
67 |
+
pipe = set_base_model()
|
68 |
demo.launch(debug=True)
|