Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -22,6 +22,13 @@ if torch.cuda.is_available():
|
|
22 |
unet = UNet2DConditionModel.from_pretrained("UCLA-AGI/SPIN-Diffusion-iter3", subfolder="unet", torch_dtype=torch.float16)
|
23 |
pipe.unet = unet
|
24 |
pipe = pipe.to("cuda")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
|
26 |
@spaces.GPU(enable_queue=True)
|
27 |
def generate(prompt: str, num_images: int=5, guidance_scale=7.5):
|
|
|
22 |
unet = UNet2DConditionModel.from_pretrained("UCLA-AGI/SPIN-Diffusion-iter3", subfolder="unet", torch_dtype=torch.float16)
|
23 |
pipe.unet = unet
|
24 |
pipe = pipe.to("cuda")
|
25 |
+
else:
|
26 |
+
pipe = StableDiffusionPipeline.from_pretrained("runwayml/stable-diffusion-v1-5", torch_dtype=torch.float32)
|
27 |
+
|
28 |
+
unet = UNet2DConditionModel.from_pretrained("UCLA-AGI/SPIN-Diffusion-iter3", subfolder="unet", torch_dtype=torch.float32)
|
29 |
+
pipe.unet = unet
|
30 |
+
pipe = pipe.to("cpu")
|
31 |
+
|
32 |
|
33 |
@spaces.GPU(enable_queue=True)
|
34 |
def generate(prompt: str, num_images: int=5, guidance_scale=7.5):
|