DemiPoto commited on
Commit
005e741
1 Parent(s): 1dda856

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -17
app.py CHANGED
@@ -14,7 +14,7 @@ HF_TOKEN = os.environ.get("HF_TOKEN") if os.environ.get("HF_TOKEN") else None #
14
 
15
 
16
  nb_req_simult=80 ########
17
- max_pending=8
18
  nb_gallery_model=5
19
 
20
 
@@ -517,7 +517,7 @@ def fonc_start(id_session,id_module,s,cont,list_models_to_gen):
517
 
518
  if model_actu == "":
519
  for model_plus_tasks in cache_list_task[f"{id_session}"]:
520
- if model_plus_tasks["id_module"]==id_module:
521
  try:
522
  task_actu=model_plus_tasks["task"].pop()
523
  except:
@@ -525,26 +525,14 @@ def fonc_start(id_session,id_module,s,cont,list_models_to_gen):
525
  model_actu=model_plus_tasks["model"]
526
  model_plus_tasks["pending_task"]+=1
527
  print(f"find model : {model_actu}\n")
528
- break
529
-
530
- if model_actu=="":
531
- for model_plus_tasks in cache_list_task[f"{id_session}"]:
532
- if model_plus_tasks["id_module"]==-1 :
533
- if model_actu=="":
534
-
535
- try:
536
- task_actu=model_plus_tasks["task"].pop()
537
- except:
538
- continue
539
- model_actu=model_plus_tasks["model"]
540
- model_plus_tasks["pending_task"]+=1
541
- model_plus_tasks["id_module"]=id_module
542
- print(f"module num {id_module} take {model_actu}\n")
543
  i=0
544
  for model in list_models_to_gen:
545
  if model_actu==model:
546
  cache_text_actu[f"{id_session}"]['progress'][i]=1
547
  i+=1
 
 
548
 
549
  if model_actu=="":
550
  cache_text_actu[f"{id_session}"]["nb_modules_use"]-=1
 
14
 
15
 
16
  nb_req_simult=80 ########
17
+ max_pending=4
18
  nb_gallery_model=5
19
 
20
 
 
517
 
518
  if model_actu == "":
519
  for model_plus_tasks in cache_list_task[f"{id_session}"]:
520
+ if model_plus_tasks["pending_task"]==0:
521
  try:
522
  task_actu=model_plus_tasks["task"].pop()
523
  except:
 
525
  model_actu=model_plus_tasks["model"]
526
  model_plus_tasks["pending_task"]+=1
527
  print(f"find model : {model_actu}\n")
528
+ if len(model_plus_tasks["task"])==cache_text_actu[f"{id_session}"]["nb_tasks_by_model"]-1:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
529
  i=0
530
  for model in list_models_to_gen:
531
  if model_actu==model:
532
  cache_text_actu[f"{id_session}"]['progress'][i]=1
533
  i+=1
534
+ break
535
+
536
 
537
  if model_actu=="":
538
  cache_text_actu[f"{id_session}"]["nb_modules_use"]-=1