multimodalart HF staff commited on
Commit
07d3eff
1 Parent(s): 7039ded

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -3
app.py CHANGED
@@ -134,6 +134,9 @@ def run_lora(prompt, cfg_scale, steps, selected_index, seed, width, height, lora
134
 
135
  return image
136
 
 
 
 
137
  with gr.Blocks(theme=gr.themes.Soft()) as app:
138
  gr.Markdown("# FLUX.1 LoRA the Explorer")
139
  selected_index = gr.State(None)
@@ -141,7 +144,7 @@ with gr.Blocks(theme=gr.themes.Soft()) as app:
141
  with gr.Column(scale=3):
142
  prompt = gr.Textbox(label="Prompt", lines=1, placeholder="Type a prompt after selecting a LoRA")
143
  with gr.Column(scale=1):
144
- generate_button = gr.Button("Generate", variant="primary")
145
  with gr.Row():
146
  with gr.Column(scale=2):
147
  selected_info = gr.Markdown("")
@@ -174,8 +177,9 @@ with gr.Blocks(theme=gr.themes.Soft()) as app:
174
  lora_scale = gr.Slider(label="LoRA Scale", minimum=0, maximum=1, step=0.01, value=1)
175
 
176
  gallery.select(update_selection, outputs=[prompt, selected_info, selected_index])
177
-
178
- generate_button.click(
 
179
  fn=run_lora,
180
  inputs=[prompt, cfg_scale, steps, selected_index, seed, width, height, lora_scale],
181
  outputs=[result]
 
134
 
135
  return image
136
 
137
+ '''
138
+ #gen_btn{height: 100%}
139
+ '''
140
  with gr.Blocks(theme=gr.themes.Soft()) as app:
141
  gr.Markdown("# FLUX.1 LoRA the Explorer")
142
  selected_index = gr.State(None)
 
144
  with gr.Column(scale=3):
145
  prompt = gr.Textbox(label="Prompt", lines=1, placeholder="Type a prompt after selecting a LoRA")
146
  with gr.Column(scale=1):
147
+ generate_button = gr.Button("Generate", variant="primary", elem_id="gen_btn")
148
  with gr.Row():
149
  with gr.Column(scale=2):
150
  selected_info = gr.Markdown("")
 
177
  lora_scale = gr.Slider(label="LoRA Scale", minimum=0, maximum=1, step=0.01, value=1)
178
 
179
  gallery.select(update_selection, outputs=[prompt, selected_info, selected_index])
180
+
181
+ gr.on(
182
+ triggers=[generate_button.click, prompt.submit],
183
  fn=run_lora,
184
  inputs=[prompt, cfg_scale, steps, selected_index, seed, width, height, lora_scale],
185
  outputs=[result]