DemiPoto commited on
Commit
611f7de
·
verified ·
1 Parent(s): 3673052

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -10
app.py CHANGED
@@ -14,6 +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
  nb_gallery_model=5
18
 
19
 
@@ -502,16 +503,17 @@ def fonc_start(id_session,id_module,s,cont,list_models_to_gen):
502
  for model_plus_tasks in cache_list_task[f"{id_session}"]:
503
  if model_actu == "":
504
  if model_plus_tasks["model"] in warm_models:
505
- try:
506
- task_actu=model_plus_tasks["task"].pop()
507
- except:
508
- continue
509
- model_actu=model_plus_tasks["model"]
510
- model_plus_tasks["pending_task"]+=1
511
- use_warm_model=True
512
- cache_text_actu[f"{id_session}"]["nb_warm_in_use"]+=1
513
- print(f"warm model : {model_actu}\n")
514
- break
 
515
 
516
  if model_actu == "":
517
  for model_plus_tasks in cache_list_task[f"{id_session}"]:
 
14
 
15
 
16
  nb_req_simult=80 ########
17
+ max_pending=8
18
  nb_gallery_model=5
19
 
20
 
 
503
  for model_plus_tasks in cache_list_task[f"{id_session}"]:
504
  if model_actu == "":
505
  if model_plus_tasks["model"] in warm_models:
506
+ if model_plus_tasks["pending_task"]<max_pending:
507
+ try:
508
+ task_actu=model_plus_tasks["task"].pop()
509
+ except:
510
+ continue
511
+ model_actu=model_plus_tasks["model"]
512
+ model_plus_tasks["pending_task"]+=1
513
+ use_warm_model=True
514
+ cache_text_actu[f"{id_session}"]["nb_warm_in_use"]+=1
515
+ print(f"warm model : {model_actu}\n")
516
+ break
517
 
518
  if model_actu == "":
519
  for model_plus_tasks in cache_list_task[f"{id_session}"]: