Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -133,15 +133,20 @@ eulera_scheduler = EulerAncestralDiscreteScheduler.from_pretrained("stabilityai/
|
|
133 |
ckpt_dir_pony = snapshot_download(repo_id="John6666/pony-realism-v21main-sdxl")
|
134 |
ckpt_dir_cyber = snapshot_download(repo_id="John6666/cyberrealistic-pony-v61-sdxl")
|
135 |
ckpt_dir_stallion = snapshot_download(repo_id="John6666/stallion-dreams-pony-realistic-v1-sdxl")
|
|
|
|
|
136 |
|
137 |
# Load the models
|
138 |
vae_pony = AutoencoderKL.from_pretrained(os.path.join(ckpt_dir_pony, "vae"), torch_dtype=torch.float16)
|
139 |
vae_cyber = AutoencoderKL.from_pretrained(os.path.join(ckpt_dir_cyber, "vae"), torch_dtype=torch.float16)
|
140 |
vae_stallion = AutoencoderKL.from_pretrained(os.path.join(ckpt_dir_stallion, "vae"), torch_dtype=torch.float16)
|
|
|
|
|
141 |
|
142 |
controlnet_pony = ControlNetModel.from_pretrained("xinsir/controlnet-union-sdxl-1.0", torch_dtype=torch.float16)
|
143 |
controlnet_cyber = ControlNetModel.from_pretrained("xinsir/controlnet-union-sdxl-1.0", torch_dtype=torch.float16)
|
144 |
controlnet_stallion = ControlNetModel.from_pretrained("xinsir/controlnet-union-sdxl-1.0", torch_dtype=torch.float16)
|
|
|
145 |
|
146 |
pipe_pony = StableDiffusionXLControlNetPipeline.from_pretrained(
|
147 |
ckpt_dir_pony, controlnet=controlnet_pony, vae=vae_pony, torch_dtype=torch.float16, scheduler=eulera_scheduler
|
@@ -152,10 +157,15 @@ pipe_cyber = StableDiffusionXLControlNetPipeline.from_pretrained(
|
|
152 |
pipe_stallion = StableDiffusionXLControlNetPipeline.from_pretrained(
|
153 |
ckpt_dir_stallion, controlnet=controlnet_stallion, vae=vae_stallion, torch_dtype=torch.float16, scheduler=eulera_scheduler
|
154 |
)
|
|
|
|
|
|
|
|
|
155 |
|
156 |
pipe_pony.to(device)
|
157 |
pipe_cyber.to(device)
|
158 |
pipe_stallion.to(device)
|
|
|
159 |
|
160 |
MAX_SEED = np.iinfo(np.int32).max
|
161 |
processor = HEDdetector.from_pretrained('lllyasviel/Annotators')
|
@@ -232,12 +242,16 @@ def run(
|
|
232 |
generator = torch.Generator(device=device).manual_seed(seed)
|
233 |
|
234 |
# Select the appropriate pipe based on the model choice
|
235 |
-
if model_choice == "
|
|
|
|
|
236 |
pipe = pipe_pony
|
237 |
elif model_choice == "Cyber Realistic Pony v61":
|
238 |
pipe = pipe_cyber
|
239 |
-
|
240 |
pipe = pipe_stallion
|
|
|
|
|
241 |
|
242 |
if use_canny:
|
243 |
out = pipe(
|
@@ -281,7 +295,7 @@ with gr.Blocks(css="style.css", js=js_func) as demo:
|
|
281 |
prompt = gr.Textbox(label="Prompt")
|
282 |
style = gr.Dropdown(label="Style", choices=STYLE_NAMES, value=DEFAULT_STYLE_NAME)
|
283 |
model_choice = gr.Dropdown(
|
284 |
-
["Pony Realism v21", "Cyber Realistic Pony v61", "Stallion Dreams Pony Realistic v1"],
|
285 |
label="Model Choice",
|
286 |
value="Pony Realism v21"
|
287 |
)
|
|
|
133 |
ckpt_dir_pony = snapshot_download(repo_id="John6666/pony-realism-v21main-sdxl")
|
134 |
ckpt_dir_cyber = snapshot_download(repo_id="John6666/cyberrealistic-pony-v61-sdxl")
|
135 |
ckpt_dir_stallion = snapshot_download(repo_id="John6666/stallion-dreams-pony-realistic-v1-sdxl")
|
136 |
+
ckpt_dir_stable = snapshot_download(repo_id="stabilityai/stable-diffusion-xl-base-1.0")
|
137 |
+
|
138 |
|
139 |
# Load the models
|
140 |
vae_pony = AutoencoderKL.from_pretrained(os.path.join(ckpt_dir_pony, "vae"), torch_dtype=torch.float16)
|
141 |
vae_cyber = AutoencoderKL.from_pretrained(os.path.join(ckpt_dir_cyber, "vae"), torch_dtype=torch.float16)
|
142 |
vae_stallion = AutoencoderKL.from_pretrained(os.path.join(ckpt_dir_stallion, "vae"), torch_dtype=torch.float16)
|
143 |
+
vae_stable = AutoencoderKL.from_pretrained(os.path.join(ckpt_dir_stable, "vae"), torch_dtype=torch.float16)
|
144 |
+
|
145 |
|
146 |
controlnet_pony = ControlNetModel.from_pretrained("xinsir/controlnet-union-sdxl-1.0", torch_dtype=torch.float16)
|
147 |
controlnet_cyber = ControlNetModel.from_pretrained("xinsir/controlnet-union-sdxl-1.0", torch_dtype=torch.float16)
|
148 |
controlnet_stallion = ControlNetModel.from_pretrained("xinsir/controlnet-union-sdxl-1.0", torch_dtype=torch.float16)
|
149 |
+
controlnet_stable = ControlNetModel.from_pretrained("xinsir/controlnet-union-sdxl-1.0", torch_dtype=torch.float16)
|
150 |
|
151 |
pipe_pony = StableDiffusionXLControlNetPipeline.from_pretrained(
|
152 |
ckpt_dir_pony, controlnet=controlnet_pony, vae=vae_pony, torch_dtype=torch.float16, scheduler=eulera_scheduler
|
|
|
157 |
pipe_stallion = StableDiffusionXLControlNetPipeline.from_pretrained(
|
158 |
ckpt_dir_stallion, controlnet=controlnet_stallion, vae=vae_stallion, torch_dtype=torch.float16, scheduler=eulera_scheduler
|
159 |
)
|
160 |
+
pipe_stable = StableDiffusionXLControlNetPipeline.from_pretrained(
|
161 |
+
ckpt_dir_stable, controlnet=controlnet_stable, vae=vae_stable, torch_dtype=torch.float16, scheduler=eulera_scheduler
|
162 |
+
)
|
163 |
+
|
164 |
|
165 |
pipe_pony.to(device)
|
166 |
pipe_cyber.to(device)
|
167 |
pipe_stallion.to(device)
|
168 |
+
pipe_stable.to(device)
|
169 |
|
170 |
MAX_SEED = np.iinfo(np.int32).max
|
171 |
processor = HEDdetector.from_pretrained('lllyasviel/Annotators')
|
|
|
242 |
generator = torch.Generator(device=device).manual_seed(seed)
|
243 |
|
244 |
# Select the appropriate pipe based on the model choice
|
245 |
+
if model_choice == "Stable Diffusion XL":
|
246 |
+
pipe = pipe_stable
|
247 |
+
elif model_choice == "Pony Realism v21":
|
248 |
pipe = pipe_pony
|
249 |
elif model_choice == "Cyber Realistic Pony v61":
|
250 |
pipe = pipe_cyber
|
251 |
+
elif model_choice == "Stallion Dreams Pony Realistic v1":
|
252 |
pipe = pipe_stallion
|
253 |
+
else:
|
254 |
+
raise ValueError("Invalid model choice")
|
255 |
|
256 |
if use_canny:
|
257 |
out = pipe(
|
|
|
295 |
prompt = gr.Textbox(label="Prompt")
|
296 |
style = gr.Dropdown(label="Style", choices=STYLE_NAMES, value=DEFAULT_STYLE_NAME)
|
297 |
model_choice = gr.Dropdown(
|
298 |
+
["Pony Realism v21", "Cyber Realistic Pony v61", "Stallion Dreams Pony Realistic v1", "Stable Diffusion XL"],
|
299 |
label="Model Choice",
|
300 |
value="Pony Realism v21"
|
301 |
)
|