Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -323,8 +323,10 @@ def reset_cache_image_actu(id,cache_image_actu=cache_image_actu):
|
|
| 323 |
cache_image_actu[f"{id}"].clear()
|
| 324 |
return
|
| 325 |
def reset_cache_image_all_sessions(cache_image=cache_image):
|
| 326 |
-
cache_image
|
|
|
|
| 327 |
return
|
|
|
|
| 328 |
def set_session(id):
|
| 329 |
if id==0:
|
| 330 |
randTemp=randint(1,MAX_SEED)
|
|
@@ -333,6 +335,14 @@ def set_session(id):
|
|
| 333 |
return gr.Number(visible=False,value=randTemp)
|
| 334 |
else :
|
| 335 |
return id
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 336 |
|
| 337 |
def disp_models(group_model_choice,nb_rep=nb_rep):
|
| 338 |
listTemp=[]
|
|
@@ -472,15 +482,20 @@ def make_me():
|
|
| 472 |
with gr.Column():
|
| 473 |
b21 = gr.Button('Reset Gallery')
|
| 474 |
b22 = gr.Button('Reset Gallery All')
|
|
|
|
|
|
|
| 475 |
b11.click(load_gallery_actu,[gallery,id_session],gallery)
|
| 476 |
b12.click(load_gallery,[gallery,id_session],gallery)
|
| 477 |
b21.click(reset_gallery,[gallery],gallery)
|
| 478 |
b22.click(reset_cache_image,[id_session],gallery)
|
|
|
|
|
|
|
| 479 |
for m, o in zip(current_models, output):
|
| 480 |
#o.change(add_gallery, [o, m, gallery], [gallery])
|
| 481 |
o.change(add_cache_image,[o,m,id_session],[])
|
| 482 |
o.change(add_cache_image_actu,[o,m,id_session],[])
|
| 483 |
gen_button.click(reset_cache_image_actu, [id_session], [])
|
|
|
|
| 484 |
|
| 485 |
with gr.Group():
|
| 486 |
with gr.Row():
|
|
|
|
| 323 |
cache_image_actu[f"{id}"].clear()
|
| 324 |
return
|
| 325 |
def reset_cache_image_all_sessions(cache_image=cache_image):
|
| 326 |
+
for key, list in cache_image:
|
| 327 |
+
list.clear()
|
| 328 |
return
|
| 329 |
+
|
| 330 |
def set_session(id):
|
| 331 |
if id==0:
|
| 332 |
randTemp=randint(1,MAX_SEED)
|
|
|
|
| 335 |
return gr.Number(visible=False,value=randTemp)
|
| 336 |
else :
|
| 337 |
return id
|
| 338 |
+
def print_info_sessions():
|
| 339 |
+
lenTot=0
|
| 340 |
+
print("numbre of sessions : "+str(len(cache_image)))
|
| 341 |
+
for key, list in cache_image:
|
| 342 |
+
print(key+str(len(list)))
|
| 343 |
+
lenTot+=len(list)
|
| 344 |
+
print("images total = "+str(lenTot))
|
| 345 |
+
return
|
| 346 |
|
| 347 |
def disp_models(group_model_choice,nb_rep=nb_rep):
|
| 348 |
listTemp=[]
|
|
|
|
| 482 |
with gr.Column():
|
| 483 |
b21 = gr.Button('Reset Gallery')
|
| 484 |
b22 = gr.Button('Reset Gallery All')
|
| 485 |
+
b23 = gr.Button('Reset All Sessions')
|
| 486 |
+
b24 = gr.Button('print info sessions')
|
| 487 |
b11.click(load_gallery_actu,[gallery,id_session],gallery)
|
| 488 |
b12.click(load_gallery,[gallery,id_session],gallery)
|
| 489 |
b21.click(reset_gallery,[gallery],gallery)
|
| 490 |
b22.click(reset_cache_image,[id_session],gallery)
|
| 491 |
+
b23.click(reset_cache_image_all_sessions,[],[])
|
| 492 |
+
b24.click(print_info_sessions,[],[])
|
| 493 |
for m, o in zip(current_models, output):
|
| 494 |
#o.change(add_gallery, [o, m, gallery], [gallery])
|
| 495 |
o.change(add_cache_image,[o,m,id_session],[])
|
| 496 |
o.change(add_cache_image_actu,[o,m,id_session],[])
|
| 497 |
gen_button.click(reset_cache_image_actu, [id_session], [])
|
| 498 |
+
gen_button.click(lambda id:gr.Button('Load Galerry All ('+str(len(cache_image_actu[f"{id}"]))+")"), [id_session], [b12])
|
| 499 |
|
| 500 |
with gr.Group():
|
| 501 |
with gr.Row():
|