DemiPoto commited on
Commit
be736d4
·
verified ·
1 Parent(s): 279502f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -9
app.py CHANGED
@@ -257,8 +257,8 @@ def make_me():
257
  with gr.Accordion("Advanced", open=False, visible=True):
258
  neg_input = gr.Textbox(label='Negative prompt:', lines=1, interactive = True)
259
  with gr.Row():
260
- width = gr.Slider(label="Width", info="If 0, the default value is used.", maximum=1216, step=32, value=0, interactive = True)
261
- height = gr.Slider(label="Height", info="If 0, the default value is used.", maximum=1216, step=32, value=0, interactive = True)
262
  with gr.Row():
263
  choice_ratio = gr.Dropdown(label="Ratio Width/Height",
264
  info="OverWrite Width and Height (W*H<1024*1024)",
@@ -268,19 +268,28 @@ def make_me():
268
  steps = gr.Slider(label="Number of inference steps", info="If 0, the default value is used.", maximum=100, step=1, value=0, interactive = True)
269
  cfg = gr.Slider(label="Guidance scale", info="If 0, the default value is used.", maximum=30.0, step=0.1, value=0, interactive = True)
270
  seed = gr.Slider(label="Seed", info="Randomize Seed if -1.", minimum=-1, maximum=MAX_SEED, step=1, value=-1, interactive = True)
271
- gen_button = gr.Button('Generate images', scale=3)
272
- stop_button = gr.Button('Stop', variant='secondary', interactive=False, scale=1)
273
- gen_button.click(lambda: gr.update(interactive=True), None, stop_button)
274
 
275
- list_param_actu=[txt_input,neg_input,width,height,steps,cfg,seed]
276
- examples=[["prompt","neg p",1024,800,50,3.0],["prompt 2","neg p 2",720,1200,30,2.5]]
 
 
 
 
 
 
 
 
 
 
277
 
278
- examples_gradio = gr.Examples(
279
- examples=examples,
280
  inputs=[txt_input,neg_input,width,height,steps,cfg,seed],
281
  outputs=[txt_input,neg_input,width,height,steps,cfg,seed],
282
  )
283
 
 
 
284
 
285
  js_code = """
286
 
 
257
  with gr.Accordion("Advanced", open=False, visible=True):
258
  neg_input = gr.Textbox(label='Negative prompt:', lines=1, interactive = True)
259
  with gr.Row():
260
+ width = gr.Slider(label="Width", info="If 0, the default value is used.", maximum=2024, step=32, value=0, interactive = True)
261
+ height = gr.Slider(label="Height", info="If 0, the default value is used.", maximum=2024, step=32, value=0, interactive = True)
262
  with gr.Row():
263
  choice_ratio = gr.Dropdown(label="Ratio Width/Height",
264
  info="OverWrite Width and Height (W*H<1024*1024)",
 
268
  steps = gr.Slider(label="Number of inference steps", info="If 0, the default value is used.", maximum=100, step=1, value=0, interactive = True)
269
  cfg = gr.Slider(label="Guidance scale", info="If 0, the default value is used.", maximum=30.0, step=0.1, value=0, interactive = True)
270
  seed = gr.Slider(label="Seed", info="Randomize Seed if -1.", minimum=-1, maximum=MAX_SEED, step=1, value=-1, interactive = True)
 
 
 
271
 
272
+ param_actu=[txt_input,neg_input,width,height,steps,cfg,seed]
273
+ list_param=[["prompt","neg p",1024,800,50,3.0],["prompt 2","neg p 2",720,1200,30,2.5]]
274
+
275
+ add_param=gr.Button("add to the list")
276
+ del_param=gr.Button("delete to the list")
277
+ #gen_button = gr.Button('Generate images', scale=3)
278
+ #stop_button = gr.Button('Stop', variant='secondary', interactive=False, scale=1)
279
+ #gen_button.click(lambda: gr.update(interactive=True), None, stop_button)
280
+ def fonc_add_param(param_actu,disp_param):
281
+ disp_param.exemples=disp_param.append(param_actu)
282
+ return
283
+
284
 
285
+ disp_param = gr.Examples(
286
+ examples=list_param,
287
  inputs=[txt_input,neg_input,width,height,steps,cfg,seed],
288
  outputs=[txt_input,neg_input,width,height,steps,cfg,seed],
289
  )
290
 
291
+ add_param.click(fonc_add_param,[param_actu,disp_param],[])
292
+
293
 
294
  js_code = """
295