chaojiemao commited on
Commit
4b7a8ad
·
verified ·
1 Parent(s): e628f2d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -3
app.py CHANGED
@@ -13,9 +13,9 @@ DASHSCOPE_API_KEY = os.getenv('DASHSCOPE_API_KEY')
13
  dashscope.api_key = DASHSCOPE_API_KEY
14
 
15
  KEEP_SUCCESS_TASK = 3600 * 10
16
- KEEP_RUNING_TASK = 3600 * 2
17
  # the total running task number in 1800 seconds
18
- LIMIT_RUNING_TASK = 10
19
 
20
  def t2v_generation(prompt, resolution, watermark_wan, seed = -1):
21
  seed = seed if seed >= 0 else random.randint(0, 2147483647)
@@ -102,10 +102,13 @@ task_status = {}
102
 
103
  def allow_task_num():
104
  num = 0
 
105
  for task_id in task_status:
106
  if not task_status[task_id]["status"] and task_status[task_id]["time"] + 1800 > time.time():
107
  num += 1
108
- return num < LIMIT_RUNING_TASK
 
 
109
  def clean_task_status():
110
  # clean the task over 1800 seconds
111
  for task_id in copy.deepcopy(task_status):
@@ -125,6 +128,10 @@ def cost_time(task_id):
125
  return f"{et:.2f}"
126
  else:
127
  return gr.Textbox()
 
 
 
 
128
  def get_process_bar(task_id, status):
129
  clean_task_status()
130
  if task_id not in task_status:
 
13
  dashscope.api_key = DASHSCOPE_API_KEY
14
 
15
  KEEP_SUCCESS_TASK = 3600 * 10
16
+ KEEP_RUNING_TASK = 3600 * 1
17
  # the total running task number in 1800 seconds
18
+ LIMIT_RUNING_TASK = 4
19
 
20
  def t2v_generation(prompt, resolution, watermark_wan, seed = -1):
21
  seed = seed if seed >= 0 else random.randint(0, 2147483647)
 
102
 
103
  def allow_task_num():
104
  num = 0
105
+ total_num = 0
106
  for task_id in task_status:
107
  if not task_status[task_id]["status"] and task_status[task_id]["time"] + 1800 > time.time():
108
  num += 1
109
+ if not task_status[task_id]["status"]:
110
+ total_num += 1
111
+ return num < LIMIT_RUNING_TASK or num < 10
112
  def clean_task_status():
113
  # clean the task over 1800 seconds
114
  for task_id in copy.deepcopy(task_status):
 
128
  return f"{et:.2f}"
129
  else:
130
  return gr.Textbox()
131
+
132
+ def waiting_time():
133
+
134
+
135
  def get_process_bar(task_id, status):
136
  clean_task_status()
137
  if task_id not in task_status: