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

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -10
app.py CHANGED
@@ -21,8 +21,8 @@ nb_rep=2
21
  nb_mod_dif=20
22
  nb_models=nb_mod_dif*nb_rep
23
 
24
- cache_image=[]
25
- cache_image_actu=[]
26
 
27
  def split_models(models,nb_models):
28
  models_temp=[]
@@ -305,19 +305,22 @@ def load_gallery_actu(gallery):
305
  gallery=add_gallery(c[0],c[1],gallery)
306
  return gallery
307
 
308
- def add_cache_image(o,m,cache_image=cache_image):
309
- cache_image.append((o,m))
310
  #cache_image=sorted(cache_image, key=itemgetter(1))
311
  return
312
- def add_cache_image_actu(o,m,cache_image_actu=cache_image_actu):
313
- cache_image_actu.append((o,m))
314
  #cache_image_actu=sorted(cache_image_actu, key=itemgetter(1))
315
  return
316
- def reset_cache_image(cache_image=cache_image):
317
- cache_image.clear()
 
 
 
318
  return
319
- def reset_cache_image_actu(cache_image_actu=cache_image_actu):
320
- cache_image_actu.clear()
321
  return
322
 
323
  def disp_models(group_model_choice,nb_rep=nb_rep):
@@ -424,6 +427,9 @@ def make_me():
424
  with gr.Row():
425
  #global cache_image
426
  #global cache_image_actu
 
 
 
427
  with gr.Column():
428
  b11 = gr.Button('Load Galerry Actu')
429
  b12 = gr.Button('Load Galerry All')
 
21
  nb_mod_dif=20
22
  nb_models=nb_mod_dif*nb_rep
23
 
24
+ cache_image={}
25
+ cache_image_actu={}
26
 
27
  def split_models(models,nb_models):
28
  models_temp=[]
 
305
  gallery=add_gallery(c[0],c[1],gallery)
306
  return gallery
307
 
308
+ def add_cache_image(o,m,id,cache_image=cache_image):
309
+ cache_image[f"{id}"].append((o,m))
310
  #cache_image=sorted(cache_image, key=itemgetter(1))
311
  return
312
+ def add_cache_image_actu(o,m,id,cache_image_actu=cache_image_actu):
313
+ cache_image_actu[f"{id}"].append((o,m))
314
  #cache_image_actu=sorted(cache_image_actu, key=itemgetter(1))
315
  return
316
+ def reset_cache_image(id,cache_image=cache_image):
317
+ cache_image[f"{id}"].clear()
318
+ return
319
+ def reset_cache_image_actu(id,cache_image_actu=cache_image_actu):
320
+ cache_image_actu[f"{id}"].clear()
321
  return
322
+ def reset_cache_image_all_sessions(cache_image=cache_image):
323
+ cache_image.clear()
324
  return
325
 
326
  def disp_models(group_model_choice,nb_rep=nb_rep):
 
427
  with gr.Row():
428
  #global cache_image
429
  #global cache_image_actu
430
+ id_session=gr.Number(visible=False,value=randint(1,MAX_SEED))
431
+ cache_image[f"{id_session}"]=[]
432
+ cache_image_actu[f"{id_session}"]=[]
433
  with gr.Column():
434
  b11 = gr.Button('Load Galerry Actu')
435
  b12 = gr.Button('Load Galerry All')