um235 commited on
Commit
4624b23
·
verified ·
1 Parent(s): 47501a2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -6
app.py CHANGED
@@ -44,12 +44,14 @@ def infer(
44
  generator = torch.Generator().manual_seed(seed)
45
 
46
  pipe = None
47
- if (model_id=="stable-diffusion-v1-5/stable-diffusion-v1-5 with lora"):
48
  pipe=DiffusionPipeline.from_pretrained("stable-diffusion-v1-5/stable-diffusion-v1-5", torch_dtype=torch_dtype)
49
- pipe.unet = PeftModel.from_pretrained(pipe.unet,"um235/cartoon_cat_stickers/unet")
50
- pipe.text_encoder= PeftModel.from_pretrained(pipe.text_encoder,"um235/cartoon_cat_stickers/text_encoder")
 
 
 
51
  else:
52
- print("stable-diffusion-v1-5/stable-diffusion-v1-5 with lora")
53
  pipe=DiffusionPipeline.from_pretrained(model_id, torch_dtype=torch_dtype)
54
  pipe = pipe.to(device)
55
 
@@ -99,9 +101,10 @@ with gr.Blocks(css=css) as demo:
99
  choices=[
100
  "stable-diffusion-v1-5/stable-diffusion-v1-5",
101
  "CompVis/stable-diffusion-v1-4",
102
- "stable-diffusion-v1-5/stable-diffusion-v1-5 with lora",
 
103
  ],
104
- value="stable-diffusion-v1-5/stable-diffusion-v1-5 with lora",
105
  show_label=True,
106
  type="value",
107
  )
 
44
  generator = torch.Generator().manual_seed(seed)
45
 
46
  pipe = None
47
+ if (model_id=="stable-diffusion-v1-5/stable-diffusion-v1-5 with lora with text encoder"):
48
  pipe=DiffusionPipeline.from_pretrained("stable-diffusion-v1-5/stable-diffusion-v1-5", torch_dtype=torch_dtype)
49
+ pipe.unet = PeftModel.from_pretrained(pipe.unet,"um235/VanillaCat/unet")
50
+ pipe.text_encoder= PeftModel.from_pretrained(pipe.text_encoder,"um235/VanillaCat/text_encoder")
51
+ elif (model_id=="stable-diffusion-v1-5/stable-diffusion-v1-5 without lora with text encoder"):
52
+ pipe=DiffusionPipeline.from_pretrained("stable-diffusion-v1-5/stable-diffusion-v1-5", torch_dtype=torch_dtype)
53
+ pipe.unet = PeftModel.from_pretrained(pipe.unet,"um235/cartoon_cat_stickers")
54
  else:
 
55
  pipe=DiffusionPipeline.from_pretrained(model_id, torch_dtype=torch_dtype)
56
  pipe = pipe.to(device)
57
 
 
101
  choices=[
102
  "stable-diffusion-v1-5/stable-diffusion-v1-5",
103
  "CompVis/stable-diffusion-v1-4",
104
+ "stable-diffusion-v1-5/stable-diffusion-v1-5 with lora with text encoder",
105
+ "stable-diffusion-v1-5/stable-diffusion-v1-5 with lora without text encoder"
106
  ],
107
+ value="stable-diffusion-v1-5/stable-diffusion-v1-5 with lora with text encoder",
108
  show_label=True,
109
  type="value",
110
  )