Bordoglor commited on
Commit
ac06ba8
·
verified ·
1 Parent(s): d7ea4fa

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -5
app.py CHANGED
@@ -36,9 +36,15 @@ def infer(
36
  torch_dtype = torch.float16
37
  else:
38
  torch_dtype = torch.float32
39
-
40
- pipe = DiffusionPipeline.from_pretrained(model, torch_dtype=torch_dtype)
41
- pipe = pipe.to(device)
 
 
 
 
 
 
42
 
43
  image = pipe(
44
  prompt=prompt,
@@ -66,7 +72,7 @@ with gr.Blocks(css=css) as demo:
66
 
67
  with gr.Row():
68
  model = gr.Dropdown(
69
- choices=["stabilityai/sdxl-turbo", "CompVis/stable-diffusion-v1-4"],
70
  value=model_repo_id,
71
  label="Model",
72
  info="Choose which diffusion model to use"
@@ -157,4 +163,4 @@ with gr.Blocks(css=css) as demo:
157
  )
158
 
159
  if __name__ == "__main__":
160
- demo.launch()
 
36
  torch_dtype = torch.float16
37
  else:
38
  torch_dtype = torch.float32
39
+
40
+ if model == "Ramzes":
41
+ pipe = StableDiffusionPipeline.from_pretrained("stable-diffusion-v1-5/stable-diffusion-v1-5", torch_dtype=torch_dtype)
42
+ pipe.unet = PeftModel.from_pretrained(pipe_v5_2.unet, "Bordoglor/Ramzes_adapter_sd_v1.5/unet")
43
+ pipe.text_encoder = PeftModel.from_pretrained(pipe_v5_2.text_encoder, "Bordoglor/Ramzes_adapter_sd_v1.5/text_encoder")
44
+ pipe = pipe.to(device)
45
+ else:
46
+ pipe = DiffusionPipeline.from_pretrained(model, torch_dtype=torch_dtype)
47
+ pipe = pipe.to(device)
48
 
49
  image = pipe(
50
  prompt=prompt,
 
72
 
73
  with gr.Row():
74
  model = gr.Dropdown(
75
+ choices=["stabilityai/sdxl-turbo", "CompVis/stable-diffusion-v1-4", "Ramzes"],
76
  value=model_repo_id,
77
  label="Model",
78
  info="Choose which diffusion model to use"
 
163
  )
164
 
165
  if __name__ == "__main__":
166
+ demo.launch()