Bordoglor commited on
Commit
f0e9326
·
verified ·
1 Parent(s): 19df656

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -5
app.py CHANGED
@@ -37,9 +37,15 @@ def infer(
37
  torch_dtype = torch.float16
38
  else:
39
  torch_dtype = torch.float32
40
-
41
- pipe = DiffusionPipeline.from_pretrained(model, torch_dtype=torch_dtype)
42
- pipe = pipe.to(device)
 
 
 
 
 
 
43
 
44
  image = pipe(
45
  prompt=prompt,
@@ -67,7 +73,7 @@ with gr.Blocks(css=css) as demo:
67
 
68
  with gr.Row():
69
  model = gr.Dropdown(
70
- choices=["stabilityai/sdxl-turbo", "CompVis/stable-diffusion-v1-4"],
71
  value=model_repo_id,
72
  label="Model",
73
  info="Choose which diffusion model to use"
@@ -137,7 +143,7 @@ with gr.Blocks(css=css) as demo:
137
  minimum=1,
138
  maximum=50,
139
  step=1,
140
- value=20, # Replace with defaults that work for your model
141
  )
142
 
143
  gr.on(
 
37
  torch_dtype = torch.float16
38
  else:
39
  torch_dtype = torch.float32
40
+
41
+ if model == "Ramzes":
42
+ pipe = StableDiffusionPipeline.from_pretrained("stable-diffusion-v1-5/stable-diffusion-v1-5", torch_dtype=torch_dtype)
43
+ pipe.unet = PeftModel.from_pretrained(pipe_v5_2.unet, "Bordoglor/Ramzes_adapter_sd_v1.5/unet")
44
+ pipe.text_encoder = PeftModel.from_pretrained(pipe_v5_2.text_encoder, "Bordoglor/Ramzes_adapter_sd_v1.5/text_encoder")
45
+ pipe = pipe.to(device)
46
+ else:
47
+ pipe = DiffusionPipeline.from_pretrained(model, torch_dtype=torch_dtype)
48
+ pipe = pipe.to(device)
49
 
50
  image = pipe(
51
  prompt=prompt,
 
73
 
74
  with gr.Row():
75
  model = gr.Dropdown(
76
+ choices=["stabilityai/sdxl-turbo", "CompVis/stable-diffusion-v1-4", "Ramzes"],
77
  value=model_repo_id,
78
  label="Model",
79
  info="Choose which diffusion model to use"
 
143
  minimum=1,
144
  maximum=50,
145
  step=1,
146
+ value=3, # Replace with defaults that work for your model
147
  )
148
 
149
  gr.on(