DemiPoto commited on
Commit
1af9ca3
·
verified ·
1 Parent(s): 4d5364f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -11
app.py CHANGED
@@ -293,15 +293,15 @@ def add_gallery(image, model_str, gallery):
293
  def reset_gallery(gallery):
294
  return add_gallery(None,"",[])
295
 
296
- def load_gallery(gallery):
297
  gallery = reset_gallery(gallery)
298
- for c in cache_image:
299
  gallery=add_gallery(c[0],c[1],gallery)
300
  return gallery
301
- def load_gallery_actu(gallery):
302
  gallery = reset_gallery(gallery)
303
  #for c in cache_image_actu:
304
- for c in sorted(cache_image_actu, key=itemgetter(1)):
305
  gallery=add_gallery(c[0],c[1],gallery)
306
  return gallery
307
 
@@ -439,15 +439,15 @@ def make_me():
439
  with gr.Column():
440
  b21 = gr.Button('Reset Gallery')
441
  b22 = gr.Button('Reset Gallery All')
442
- b11.click(load_gallery_actu,gallery,gallery)
443
- b12.click(load_gallery,gallery,gallery)
444
- b21.click(reset_gallery,gallery,gallery)
445
- b22.click(reset_cache_image,[],gallery)
446
  for m, o in zip(current_models_g, output_g):
447
  #o.change(add_gallery, [o, m, gallery], [gallery])
448
- o.change(add_cache_image,[o,m],[])
449
- o.change(add_cache_image_actu,[o,m],[])
450
- gen_button.click(reset_cache_image_actu, [], [])
451
 
452
  with gr.Group():
453
  with gr.Row():
 
293
  def reset_gallery(gallery):
294
  return add_gallery(None,"",[])
295
 
296
+ def load_gallery(gallery,id):
297
  gallery = reset_gallery(gallery)
298
+ for c in cache_image[f"{id}"]:
299
  gallery=add_gallery(c[0],c[1],gallery)
300
  return gallery
301
+ def load_gallery_actu(gallery,id):
302
  gallery = reset_gallery(gallery)
303
  #for c in cache_image_actu:
304
+ for c in sorted(cache_image[f"{id}"], key=itemgetter(1)):
305
  gallery=add_gallery(c[0],c[1],gallery)
306
  return gallery
307
 
 
439
  with gr.Column():
440
  b21 = gr.Button('Reset Gallery')
441
  b22 = gr.Button('Reset Gallery All')
442
+ b11.click(load_gallery_actu,[gallery,id_session],gallery)
443
+ b12.click(load_gallery,[gallery,id_session],gallery)
444
+ b21.click(reset_gallery,[gallery,id_session],gallery)
445
+ b22.click(reset_cache_image,[id_session],gallery)
446
  for m, o in zip(current_models_g, output_g):
447
  #o.change(add_gallery, [o, m, gallery], [gallery])
448
+ o.change(add_cache_image,[o,m,id_session],[])
449
+ o.change(add_cache_image_actu,[o,m,id_session],[])
450
+ gen_button.click(reset_cache_image_actu, [id_session], [])
451
 
452
  with gr.Group():
453
  with gr.Row():