Update app.py
Browse files
app.py
CHANGED
@@ -9,14 +9,14 @@ import torch
|
|
9 |
|
10 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
11 |
model_repo_id = "stable-diffusion-v1-5/stable-diffusion-v1-5" # Replace to the model you would like to use
|
12 |
-
|
13 |
if torch.cuda.is_available():
|
14 |
torch_dtype = torch.float16
|
15 |
else:
|
16 |
torch_dtype = torch.float32
|
17 |
|
18 |
pipe = DiffusionPipeline.from_pretrained(model_repo_id, torch_dtype=torch_dtype)
|
19 |
-
pipe.unet.load_adapter("um235/cartoon_cat_stickers")
|
|
|
20 |
pipe = pipe.to(device)
|
21 |
|
22 |
MAX_SEED = np.iinfo(np.int32).max
|
@@ -42,7 +42,7 @@ def infer(
|
|
42 |
generator = torch.Generator().manual_seed(seed)
|
43 |
|
44 |
pipe = DiffusionPipeline.from_pretrained(model_id, torch_dtype=torch_dtype)
|
45 |
-
if (model_repo_id=="stable-diffusion-v1-5/stable-diffusion-v1-5"): pipe.unet.
|
46 |
pipe = pipe.to(device)
|
47 |
|
48 |
image = pipe(
|
|
|
9 |
|
10 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
11 |
model_repo_id = "stable-diffusion-v1-5/stable-diffusion-v1-5" # Replace to the model you would like to use
|
|
|
12 |
if torch.cuda.is_available():
|
13 |
torch_dtype = torch.float16
|
14 |
else:
|
15 |
torch_dtype = torch.float32
|
16 |
|
17 |
pipe = DiffusionPipeline.from_pretrained(model_repo_id, torch_dtype=torch_dtype)
|
18 |
+
#pipe.unet.load_adapter("um235/cartoon_cat_stickers")
|
19 |
+
pipe.unet = PeftModel.from_pretrained("um235/cartoon_cat_stickers")
|
20 |
pipe = pipe.to(device)
|
21 |
|
22 |
MAX_SEED = np.iinfo(np.int32).max
|
|
|
42 |
generator = torch.Generator().manual_seed(seed)
|
43 |
|
44 |
pipe = DiffusionPipeline.from_pretrained(model_id, torch_dtype=torch_dtype)
|
45 |
+
if (model_repo_id=="stable-diffusion-v1-5/stable-diffusion-v1-5"): pipe.unet = PeftModel.from_pretrained("um235/cartoon_cat_stickers")
|
46 |
pipe = pipe.to(device)
|
47 |
|
48 |
image = pipe(
|