fffiloni commited on
Commit
eb7ac3e
·
verified ·
1 Parent(s): 97a751a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -4
app.py CHANGED
@@ -47,15 +47,23 @@ def load_b_lora_to_unet(pipe, content_lora_model_id: str = '', style_lora_model_
47
  except Exception as e:
48
  raise type(e)(f'failed to load_b_lora_to_unet, due to: {e}')
49
 
50
- def main(prompt, negative_prompt, seed, randomize_seed, width, height, guidance_scale, num_inference_steps):
51
 
52
  if randomize_seed:
53
  seed = random.randint(0, MAX_SEED)
54
 
55
  generator = torch.Generator().manual_seed(seed)
 
 
 
 
 
 
 
 
 
 
56
 
57
- content_B_LoRA_path = ''
58
- style_B_LoRA_path = 'fffiloni/b_lora_tardi_4'
59
  content_alpha,style_alpha = 1,1.1
60
 
61
  load_b_lora_to_unet(pipeline, content_B_LoRA_path, style_B_LoRA_path, content_alpha, style_alpha)
@@ -91,6 +99,10 @@ with gr.Blocks(css=css) as demo:
91
  # Text-to-Image Gradio Template
92
  Currently running on {power_device}.
93
  """)
 
 
 
 
94
 
95
  with gr.Row():
96
 
@@ -163,7 +175,7 @@ with gr.Blocks(css=css) as demo:
163
 
164
  run_button.click(
165
  fn = main,
166
- inputs = [prompt, negative_prompt, seed, randomize_seed, width, height, guidance_scale, num_inference_steps],
167
  outputs = [result]
168
  )
169
 
 
47
  except Exception as e:
48
  raise type(e)(f'failed to load_b_lora_to_unet, due to: {e}')
49
 
50
+ def main(content_b_lora, style_b_lora, prompt, negative_prompt, seed, randomize_seed, width, height, guidance_scale, num_inference_steps):
51
 
52
  if randomize_seed:
53
  seed = random.randint(0, MAX_SEED)
54
 
55
  generator = torch.Generator().manual_seed(seed)
56
+
57
+ if content_b_lora is None:
58
+ content_B_LoRA_path = ''
59
+ else:
60
+ content_B_LoRA_path = content_b_lora
61
+
62
+ if style_b_lora is None:
63
+ style_B_LoRA_path = ''
64
+ else:
65
+ style_B_LoRA_path = style_b_lora
66
 
 
 
67
  content_alpha,style_alpha = 1,1.1
68
 
69
  load_b_lora_to_unet(pipeline, content_B_LoRA_path, style_B_LoRA_path, content_alpha, style_alpha)
 
99
  # Text-to-Image Gradio Template
100
  Currently running on {power_device}.
101
  """)
102
+
103
+ with gr.Row():
104
+ content_b_lora = gr.Textbox(label="B-LoRa for content")
105
+ style_b_lora = gr.Textbox(label="B-LoRa for style")
106
 
107
  with gr.Row():
108
 
 
175
 
176
  run_button.click(
177
  fn = main,
178
+ inputs = [content_b_lora, style_b_lora, prompt, negative_prompt, seed, randomize_seed, width, height, guidance_scale, num_inference_steps],
179
  outputs = [result]
180
  )
181