Abdullah-Habib commited on
Commit
6815e34
·
1 Parent(s): 92d9f1d

testing with 2 loras

Browse files
Files changed (1) hide show
  1. app.py +3 -19
app.py CHANGED
@@ -23,7 +23,7 @@ with open('loras.json', 'r') as f:
23
  loras = json.load(f)
24
 
25
  # Initialize the base model
26
- base_model = "stabilityai/stable-diffusion-xl-base-1.0"
27
  pipe = DiffusionPipeline.from_pretrained(base_model, torch_dtype=torch.float16)
28
  pipe.to("cuda")
29
 
@@ -92,7 +92,7 @@ def run_lora(prompt, negative_prompt, cfg_scale, steps, selected_index, schedule
92
  generator = torch.Generator(device="cuda").manual_seed(seed)
93
 
94
  # Generate image
95
- logo_image = pipe(
96
  prompt=f"{prompt} logo, logoredmaf, icons",
97
  negative_prompt=negative_prompt,
98
  num_inference_steps=steps,
@@ -105,24 +105,8 @@ def run_lora(prompt, negative_prompt, cfg_scale, steps, selected_index, schedule
105
 
106
  # Unload LoRA weights
107
  pipe.unload_lora_weights()
108
- pipe.load_lora_weights("Abdullah-Habib/icon-lora", scale=1)
109
 
110
- # Pass the generated logo through the icon LoRA
111
- rounded_square_image = pipe(
112
- prompt="rounded square icon",
113
- image=logo_image, # Pass the generated logo image
114
- num_inference_steps=10,
115
- guidance_scale=cfg_scale,
116
- width=width,
117
- height=height,
118
- generator=generator,
119
- ).images[0]
120
-
121
- # Unload the icon LoRA
122
- pipe.unload_lora_weights()
123
-
124
- return rounded_square_image
125
- # return image
126
 
127
  with gr.Blocks(theme=gr.themes.Soft()) as app:
128
 
 
23
  loras = json.load(f)
24
 
25
  # Initialize the base model
26
+ base_model = "stabilityai/stable-diffusion-xl-refiner-1.0"
27
  pipe = DiffusionPipeline.from_pretrained(base_model, torch_dtype=torch.float16)
28
  pipe.to("cuda")
29
 
 
92
  generator = torch.Generator(device="cuda").manual_seed(seed)
93
 
94
  # Generate image
95
+ image = pipe(
96
  prompt=f"{prompt} logo, logoredmaf, icons",
97
  negative_prompt=negative_prompt,
98
  num_inference_steps=steps,
 
105
 
106
  # Unload LoRA weights
107
  pipe.unload_lora_weights()
 
108
 
109
+ return image
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
110
 
111
  with gr.Blocks(theme=gr.themes.Soft()) as app:
112