Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -16,6 +16,10 @@ HF_TOKEN = os.environ.get("HF_TOKEN") if os.environ.get("HF_TOKEN") else None #
|
|
16 |
nb_req_simult=80 ########
|
17 |
nb_gallery_model=5
|
18 |
|
|
|
|
|
|
|
|
|
19 |
now2 = 0
|
20 |
inference_timeout = 300
|
21 |
MAX_SEED = 2**32-1
|
@@ -171,6 +175,7 @@ def set_session(id):
|
|
171 |
cache_list_task[f"{randTemp}"]=[]
|
172 |
cache_text_actu[f"{randTemp}"]={}
|
173 |
from_reload[f"{randTemp}"]=False
|
|
|
174 |
return gr.Number(visible=False,value=randTemp)
|
175 |
else :
|
176 |
return id
|
@@ -353,11 +358,36 @@ def fonc_update_actu(text_actu,id):
|
|
353 |
s+=str(d)
|
354 |
if i%10==0:
|
355 |
s+=" "
|
|
|
|
|
356 |
s+="\n"
|
357 |
s+=f"images remaining: {cache_text_actu[str(id)]['nb_tasks_to_do']}/{cache_text_actu[str(id)]['nb_tasks_tot']}\n"
|
358 |
s+=f"fail attempt: {cache_text_actu[str(id)]['nb_fail']}"
|
359 |
return gr.Textbox(s)
|
360 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
361 |
def cutStrg(longStrg,start,end):
|
362 |
shortStrg=''
|
363 |
for i in range(end-start):
|
@@ -635,10 +665,12 @@ def make_me():
|
|
635 |
cont=gr.Checkbox(True,visible=False)
|
636 |
button_start.click(lambda:True,[],[cont])
|
637 |
button_stop.click(lambda:False,[],[cont])
|
638 |
-
text_actu=gr.Textbox("",label="in progress",interactive=False,lines=6)
|
|
|
639 |
update_actu=gr.Number(0,visible=False)
|
640 |
-
update_actu.change(fonc_update_actu,[text_actu,id_session],[text_actu])
|
641 |
-
button_start.click(fonc_update_actu,[text_actu,id_session],[text_actu])
|
|
|
642 |
|
643 |
with gr.Accordion("Gallery Parameters",open=False) :
|
644 |
with gr.Row():
|
|
|
16 |
nb_req_simult=80 ########
|
17 |
nb_gallery_model=5
|
18 |
|
19 |
+
|
20 |
+
tempo_update_actu=3.0
|
21 |
+
#incr_update_actu={}
|
22 |
+
|
23 |
now2 = 0
|
24 |
inference_timeout = 300
|
25 |
MAX_SEED = 2**32-1
|
|
|
175 |
cache_list_task[f"{randTemp}"]=[]
|
176 |
cache_text_actu[f"{randTemp}"]={}
|
177 |
from_reload[f"{randTemp}"]=False
|
178 |
+
#incr_update_actu[f"{randTemp}"]=0
|
179 |
return gr.Number(visible=False,value=randTemp)
|
180 |
else :
|
181 |
return id
|
|
|
358 |
s+=str(d)
|
359 |
if i%10==0:
|
360 |
s+=" "
|
361 |
+
if i%50==0:
|
362 |
+
s+="\n"
|
363 |
s+="\n"
|
364 |
s+=f"images remaining: {cache_text_actu[str(id)]['nb_tasks_to_do']}/{cache_text_actu[str(id)]['nb_tasks_tot']}\n"
|
365 |
s+=f"fail attempt: {cache_text_actu[str(id)]['nb_fail']}"
|
366 |
return gr.Textbox(s)
|
367 |
|
368 |
+
def fonc_update_actu_2(id):
|
369 |
+
if id == 0:
|
370 |
+
return gr.Textbox("waiting...")
|
371 |
+
s=""
|
372 |
+
s+=f"modules: {cache_text_actu[str(id)]['nb_modules_use']}/{nb_req_simult}\n"
|
373 |
+
s+=f"models remaining: {cache_text_actu[str(id)]['nb_models_to_do']}/{cache_text_actu[str(id)]['nb_models_tot']}\n"
|
374 |
+
i=0
|
375 |
+
for d in cache_text_actu[str(id)]['progress']:
|
376 |
+
i+=1
|
377 |
+
s+=str(d)
|
378 |
+
if i%10==0:
|
379 |
+
s+=" "
|
380 |
+
if i%50==0:
|
381 |
+
s+="\n"
|
382 |
+
s+="\n"
|
383 |
+
s+=f"images remaining: {cache_text_actu[str(id)]['nb_tasks_to_do']}/{cache_text_actu[str(id)]['nb_tasks_tot']}\n"
|
384 |
+
s+=f"fail attempt: {cache_text_actu[str(id)]['nb_fail']}\n"
|
385 |
+
#s+=f"{tempo_update_actu*incr_update_actu[str(id)]} s"
|
386 |
+
#incr_update_actu[str(id)]+=1
|
387 |
+
s+=f"{randint(1,MAX_SEED)}"
|
388 |
+
return gr.Textbox(s)
|
389 |
+
|
390 |
+
|
391 |
def cutStrg(longStrg,start,end):
|
392 |
shortStrg=''
|
393 |
for i in range(end-start):
|
|
|
665 |
cont=gr.Checkbox(True,visible=False)
|
666 |
button_start.click(lambda:True,[],[cont])
|
667 |
button_stop.click(lambda:False,[],[cont])
|
668 |
+
#text_actu=gr.Textbox("",label="in progress",interactive=False,lines=6)
|
669 |
+
text_actu=gr.Textbox(fonc_update_actu_2,inputs=id_session,every=tempo_update_actu,label="in progress",interactive=False,lines=6)
|
670 |
update_actu=gr.Number(0,visible=False)
|
671 |
+
#update_actu.change(fonc_update_actu,[text_actu,id_session],[text_actu])
|
672 |
+
#button_start.click(fonc_update_actu,[text_actu,id_session],[text_actu])
|
673 |
+
#button_start.click(lambda:gr.Number(0),[],[incr_update_actu])
|
674 |
|
675 |
with gr.Accordion("Gallery Parameters",open=False) :
|
676 |
with gr.Row():
|