DemiPoto commited on
Commit
098483c
·
verified ·
1 Parent(s): 8583df7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -5
app.py CHANGED
@@ -250,9 +250,11 @@ list_ratios=[["None",[None,None]],
250
  ["1:4 (512 x 2048)",[512,2048]]]
251
 
252
  def fonc_add_param(lp,txt_input,neg_input,width,height,steps,cfg,seed):
253
- print(lp)
254
  lp.append([txt_input,neg_input,width,height,steps,cfg,seed])
255
- print(lp)
 
 
 
256
  return gr.Dataset(samples=lp) , gr.Dropdown(choices=[["a",lp]], value=lp)
257
 
258
  def make_me():
@@ -275,8 +277,7 @@ def make_me():
275
  cfg = gr.Slider(label="Guidance scale", info="If 0, the default value is used.", maximum=30.0, step=0.1, value=0, interactive = True)
276
  seed = gr.Slider(label="Seed", info="Randomize Seed if -1.", minimum=-1, maximum=MAX_SEED, step=1, value=-1, interactive = True)
277
  param_actu=[txt_input,neg_input,width,height,steps,cfg,seed]
278
- list_param=[["prompt","neg p",1024,800,50,3.0],["prompt 2","neg p 2",720,1200,30,2.5]]
279
- lp=gr.Dropdown(choices=[["a",list_param]], value=list_param, visible=False)
280
 
281
  add_param=gr.Button("add to the list")
282
  del_param=gr.Button("delete to the list")
@@ -291,7 +292,8 @@ def make_me():
291
  outputs=[txt_input,neg_input,width,height,steps,cfg,seed],
292
  )
293
 
294
- add_param.click(fonc_add_param,[lp,txt_input,neg_input,width,height,steps,cfg,seed],[disp_param.dataset,lp])
 
295
 
296
 
297
  js_code = """
 
250
  ["1:4 (512 x 2048)",[512,2048]]]
251
 
252
  def fonc_add_param(lp,txt_input,neg_input,width,height,steps,cfg,seed):
 
253
  lp.append([txt_input,neg_input,width,height,steps,cfg,seed])
254
+ return gr.Dataset(samples=lp) , gr.Dropdown(choices=[["a",lp]], value=lp)
255
+ def fonc_del_param(lp,txt_input,neg_input,width,height,steps,cfg,seed):
256
+ if [txt_input,neg_input,width,height,steps,cfg,seed] in lp :
257
+ lp.del([txt_input,neg_input,width,height,steps,cfg,seed])
258
  return gr.Dataset(samples=lp) , gr.Dropdown(choices=[["a",lp]], value=lp)
259
 
260
  def make_me():
 
277
  cfg = gr.Slider(label="Guidance scale", info="If 0, the default value is used.", maximum=30.0, step=0.1, value=0, interactive = True)
278
  seed = gr.Slider(label="Seed", info="Randomize Seed if -1.", minimum=-1, maximum=MAX_SEED, step=1, value=-1, interactive = True)
279
  param_actu=[txt_input,neg_input,width,height,steps,cfg,seed]
280
+ list_param=gr.Dropdown(choices=[["a",[]]], value=[], visible=False)
 
281
 
282
  add_param=gr.Button("add to the list")
283
  del_param=gr.Button("delete to the list")
 
292
  outputs=[txt_input,neg_input,width,height,steps,cfg,seed],
293
  )
294
 
295
+ add_param.click(fonc_add_param,[list_param,txt_input,neg_input,width,height,steps,cfg,seed],[disp_param.dataset,list_param])
296
+ del_param.click(fonc_del_param,[list_param,txt_input,neg_input,width,height,steps,cfg,seed],[disp_param.dataset,list_param])
297
 
298
 
299
  js_code = """