Update app.py
Browse files
app.py
CHANGED
@@ -3,7 +3,7 @@ import gradio as gr
|
|
3 |
import numpy as np
|
4 |
import spaces
|
5 |
import torch
|
6 |
-
from diffusers import
|
7 |
|
8 |
# 添加导入语句
|
9 |
from sd_embed.embedding_funcs import get_weighted_text_embeddings_sdxl
|
@@ -18,7 +18,7 @@ if torch.cuda.is_available():
|
|
18 |
vae = AutoencoderKL.from_pretrained(
|
19 |
"madebyollin/sdxl-vae-fp16-fix", torch_dtype=torch.float16
|
20 |
)
|
21 |
-
pipe =
|
22 |
"John6666/noobai-xl-nai-xl-epsilonpred075version-sdxl",
|
23 |
vae=vae,
|
24 |
torch_dtype=torch.float16,
|
@@ -38,7 +38,7 @@ def randomize_seed_fn(seed: int, randomize_seed: bool) -> int:
|
|
38 |
def infer(
|
39 |
prompt: str,
|
40 |
negative_prompt: str = "",
|
41 |
-
use_negative_prompt: bool =
|
42 |
seed: int = 1,
|
43 |
width: int = 512,
|
44 |
height: int = 768,
|
@@ -77,10 +77,10 @@ def infer(
|
|
77 |
negative_pooled_prompt_embeds = None
|
78 |
|
79 |
image = pipe(
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
width=width,
|
85 |
height=height,
|
86 |
guidance_scale=guidance_scale,
|
|
|
3 |
import numpy as np
|
4 |
import spaces
|
5 |
import torch
|
6 |
+
from diffusers import StableDiffusionXLPipeline, AutoencoderKL # , EulerDiscreteScheduler
|
7 |
|
8 |
# 添加导入语句
|
9 |
from sd_embed.embedding_funcs import get_weighted_text_embeddings_sdxl
|
|
|
18 |
vae = AutoencoderKL.from_pretrained(
|
19 |
"madebyollin/sdxl-vae-fp16-fix", torch_dtype=torch.float16
|
20 |
)
|
21 |
+
pipe = StableDiffusionXLPipeline.from_pretrained(
|
22 |
"John6666/noobai-xl-nai-xl-epsilonpred075version-sdxl",
|
23 |
vae=vae,
|
24 |
torch_dtype=torch.float16,
|
|
|
38 |
def infer(
|
39 |
prompt: str,
|
40 |
negative_prompt: str = "",
|
41 |
+
use_negative_prompt: bool = True,
|
42 |
seed: int = 1,
|
43 |
width: int = 512,
|
44 |
height: int = 768,
|
|
|
77 |
negative_pooled_prompt_embeds = None
|
78 |
|
79 |
image = pipe(
|
80 |
+
prompt_embeds=prompt_embeds,
|
81 |
+
prompt_neg_embeds=prompt_neg_embeds,
|
82 |
+
pooled_prompt_embeds=pooled_prompt_embeds,
|
83 |
+
negative_pooled_prompt_embeds=negative_pooled_prompt_embeds,
|
84 |
width=width,
|
85 |
height=height,
|
86 |
guidance_scale=guidance_scale,
|