Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -10,7 +10,7 @@ import numpy as np
|
|
| 10 |
import PIL.Image
|
| 11 |
import spaces
|
| 12 |
import torch
|
| 13 |
-
from diffusers import AutoencoderKL, DiffusionPipeline
|
| 14 |
|
| 15 |
DESCRIPTION = "# SDXL"
|
| 16 |
if not torch.cuda.is_available():
|
|
@@ -26,7 +26,21 @@ ENABLE_USE_LORA = os.getenv("ENABLE_USE_LORA", "1") == "1"
|
|
| 26 |
ENABLE_USE_VAE = os.getenv("ENABLE_USE_VAE", "1") == "1"
|
| 27 |
|
| 28 |
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
|
| 29 |
-
models = ["
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
|
| 31 |
def randomize_seed_fn(seed: int, randomize_seed: bool) -> int:
|
| 32 |
if randomize_seed:
|
|
@@ -62,12 +76,10 @@ def generate(
|
|
| 62 |
|
| 63 |
if not use_vae:
|
| 64 |
pipe = DiffusionPipeline.from_pretrained(dropdown_model, torch_dtype=torch.float16)
|
| 65 |
-
pipe.scheduler = DPMSolverMultistepScheduler.from_config(pipe.scheduler.config)
|
| 66 |
|
| 67 |
if use_vae:
|
| 68 |
vae = AutoencoderKL.from_pretrained(vaecall, torch_dtype=torch.float16)
|
| 69 |
pipe = DiffusionPipeline.from_pretrained(dropdown_model, vae=vae, torch_dtype=torch.float16)
|
| 70 |
-
pipe.scheduler = DPMSolverMultistepScheduler.from_config(pipe.scheduler.config)
|
| 71 |
|
| 72 |
if use_lora:
|
| 73 |
pipe.load_lora_weights(lora)
|
|
|
|
| 10 |
import PIL.Image
|
| 11 |
import spaces
|
| 12 |
import torch
|
| 13 |
+
from diffusers import AutoencoderKL, DiffusionPipeline
|
| 14 |
|
| 15 |
DESCRIPTION = "# SDXL"
|
| 16 |
if not torch.cuda.is_available():
|
|
|
|
| 26 |
ENABLE_USE_VAE = os.getenv("ENABLE_USE_VAE", "1") == "1"
|
| 27 |
|
| 28 |
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
|
| 29 |
+
models = ["runwayml/stable-diffusion-v1-5",
|
| 30 |
+
"stabilityai/stable-diffusion-xl-base-1.0",
|
| 31 |
+
"stablediffusionapi/juggernaut-xl-v8",
|
| 32 |
+
"emilianJR/epiCRealism",
|
| 33 |
+
"SG161222/Realistic_Vision_V5.1_noVAE",
|
| 34 |
+
"cagliostrolab/animagine-xl-3.0",
|
| 35 |
+
"misri/cyberrealistic_v41BackToBasics",
|
| 36 |
+
"malcolmrey/serenity",
|
| 37 |
+
"SG161222/RealVisXL_V3.0",
|
| 38 |
+
"stablediffusionapi/realistic-stock-photo-v2",
|
| 39 |
+
"stablediffusionapi/pixel-art-diffusion-xl",
|
| 40 |
+
"playgroundai/playground-v2-1024px-aesthetic",
|
| 41 |
+
"dataautogpt3/ProteusV0.3",
|
| 42 |
+
"stablediffusionapi/disney-pixar-cartoon",
|
| 43 |
+
"RunDiffusion/Juggernaut-XL-Lightning"]
|
| 44 |
|
| 45 |
def randomize_seed_fn(seed: int, randomize_seed: bool) -> int:
|
| 46 |
if randomize_seed:
|
|
|
|
| 76 |
|
| 77 |
if not use_vae:
|
| 78 |
pipe = DiffusionPipeline.from_pretrained(dropdown_model, torch_dtype=torch.float16)
|
|
|
|
| 79 |
|
| 80 |
if use_vae:
|
| 81 |
vae = AutoencoderKL.from_pretrained(vaecall, torch_dtype=torch.float16)
|
| 82 |
pipe = DiffusionPipeline.from_pretrained(dropdown_model, vae=vae, torch_dtype=torch.float16)
|
|
|
|
| 83 |
|
| 84 |
if use_lora:
|
| 85 |
pipe.load_lora_weights(lora)
|