Lisandro commited on
Commit
85408e4
·
1 Parent(s): e423e8d

bugfix select sólo se puede llamar dentro de un grupo blocks

Browse files
Files changed (1) hide show
  1. app.py +12 -11
app.py CHANGED
@@ -44,6 +44,16 @@ def infer (selected_index, prompt, style_prompt, inf_steps, guidance_scale, widt
44
  return new_result
45
 
46
 
 
 
 
 
 
 
 
 
 
 
47
 
48
 
49
  css="""
@@ -175,18 +185,9 @@ with gr.Blocks(css=css) as demo:
175
  inputs = [selected_index, prompt_in, style_prompt_in, inf_steps, guidance_scale, width, height, seed, lora_weight],
176
  outputs = [image_out, last_used_seed, used_prompt]
177
  )
 
 
178
 
179
- def update_selection(evt: gr.SelectData):
180
- selected_lora = loras[evt.index]
181
- new_placeholder = f"Type a prompt for {selected_lora['title']}"
182
- lora_repo = selected_lora["repo"]
183
- updated_text = f"### Selected: [{lora_repo}](https://huggingface.co/{lora_repo}) ✨"
184
- return (
185
- gr.update(placeholder=new_placeholder),
186
- updated_text,
187
- evt.index
188
- )
189
 
190
- gallery.select(update_selection, outputs=[prompt_in, selected_info, selected_index])
191
 
192
  demo.launch()
 
44
  return new_result
45
 
46
 
47
+ def update_selection(evt: gr.SelectData):
48
+ selected_lora = loras[evt.index]
49
+ new_placeholder = f"Type a prompt for {selected_lora['title']}"
50
+ lora_repo = selected_lora["repo"]
51
+ updated_text = f"### Selected: [{lora_repo}](https://huggingface.co/{lora_repo}) ✨"
52
+ return (
53
+ gr.update(placeholder=new_placeholder),
54
+ updated_text,
55
+ evt.index
56
+ )
57
 
58
 
59
  css="""
 
185
  inputs = [selected_index, prompt_in, style_prompt_in, inf_steps, guidance_scale, width, height, seed, lora_weight],
186
  outputs = [image_out, last_used_seed, used_prompt]
187
  )
188
+ gallery.select(update_selection, outputs=[prompt_in, selected_info, selected_index])
189
+
190
 
 
 
 
 
 
 
 
 
 
 
191
 
 
192
 
193
  demo.launch()