Update app.py
Browse files
app.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
from diffusers import
|
| 2 |
from huggingface_hub import hf_hub_download
|
| 3 |
from safetensors.torch import load_file
|
| 4 |
import spaces
|
|
@@ -24,7 +24,7 @@ CSS = """
|
|
| 24 |
# Ensure model and scheduler are initialized in GPU-enabled function
|
| 25 |
if torch.cuda.is_available():
|
| 26 |
unet = UNet2DConditionModel.from_config(base, subfolder="unet").to("cuda", torch.float16)
|
| 27 |
-
pipe =
|
| 28 |
|
| 29 |
|
| 30 |
# Function
|
|
|
|
| 1 |
+
from diffusers import StableDiffusionXLPipeline, UNet2DConditionModel, LCMScheduler
|
| 2 |
from huggingface_hub import hf_hub_download
|
| 3 |
from safetensors.torch import load_file
|
| 4 |
import spaces
|
|
|
|
| 24 |
# Ensure model and scheduler are initialized in GPU-enabled function
|
| 25 |
if torch.cuda.is_available():
|
| 26 |
unet = UNet2DConditionModel.from_config(base, subfolder="unet").to("cuda", torch.float16)
|
| 27 |
+
pipe = StableDiffusionXLPipeline.from_pretrained(base, unet=unet, torch_dtype=torch.float16, variant="fp16").to("cuda")
|
| 28 |
|
| 29 |
|
| 30 |
# Function
|