rogerxavier
commited on
Commit
•
df66546
1
Parent(s):
726fca1
Update api.py
Browse files
api.py
CHANGED
@@ -102,31 +102,6 @@ async def execute_py_file(file_name: str,background_tasks: BackgroundTasks):
|
|
102 |
|
103 |
|
104 |
#保证既要提交队列后返回给用户,又要先完成前面的video生成步骤再执行后面的submit函数,还有兼顾allow_submit的值
|
105 |
-
|
106 |
-
# @app.get("/execute_all_task")
|
107 |
-
# async def execute_all_task(background_tasks: BackgroundTasks, file_list: List[str] = Query(["1removeMask", "2magiDialogCut", "3mergeDialogToVideo"]),
|
108 |
-
# bili_meta_data: dict = None, cover_image: UploadFile = File(...), mp4_out_file: str = 'mp4_out/output.mp4',
|
109 |
-
# allow_submit: bool = False, cover_path: str = '/cover'
|
110 |
-
# ):
|
111 |
-
# print("获取到file_list是:", file_list)
|
112 |
-
# tasks = []
|
113 |
-
# for file_name in file_list:
|
114 |
-
# tasks.append(file_executer(file_name))
|
115 |
-
|
116 |
-
# # await asyncio.gather(*tasks) #尝试不用这个能否运行,老是这里报错
|
117 |
-
|
118 |
-
# if allow_submit:
|
119 |
-
# cover_img = cover_image.file.read()
|
120 |
-
# cover_img_data = Image.open(io.BytesIO(cover_img)).convert("L").convert("RGB")
|
121 |
-
# cover_path_to_image = os.path.join(cover_path, f"cover.jpg")
|
122 |
-
# cover_img_data.save(cover_path_to_image)
|
123 |
-
# background_tasks.add_task(upload_video, bili_meta_data, cover_path_to_image)
|
124 |
-
# return {"message": "提交video任务已加入队列"}
|
125 |
-
|
126 |
-
# return {"message": "Tasks added to the queue"}
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
@app.get("/execute_all_task")
|
131 |
async def execute_all_task(background_tasks: BackgroundTasks, file_list: List[str] = Query(["1removeMask", "2magiDialogCut", "3mergeDialogToVideo"]),
|
132 |
bili_meta_data: dict = None, cover_image: UploadFile = File(...), mp4_out_file: str = 'mp4_out/output.mp4',
|
@@ -137,6 +112,7 @@ async def execute_all_task(background_tasks: BackgroundTasks, file_list: List[st
|
|
137 |
return {"message": "提交成功"}
|
138 |
|
139 |
def process_tasks_and_upload(file_list, bili_meta_data, cover_image, cover_path,background_tasks):
|
|
|
140 |
tasks = []
|
141 |
for file_name in file_list:
|
142 |
tasks.append(file_executer(file_name))
|
|
|
102 |
|
103 |
|
104 |
#保证既要提交队列后返回给用户,又要先完成前面的video生成步骤再执行后面的submit函数,还有兼顾allow_submit的值
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
105 |
@app.get("/execute_all_task")
|
106 |
async def execute_all_task(background_tasks: BackgroundTasks, file_list: List[str] = Query(["1removeMask", "2magiDialogCut", "3mergeDialogToVideo"]),
|
107 |
bili_meta_data: dict = None, cover_image: UploadFile = File(...), mp4_out_file: str = 'mp4_out/output.mp4',
|
|
|
112 |
return {"message": "提交成功"}
|
113 |
|
114 |
def process_tasks_and_upload(file_list, bili_meta_data, cover_image, cover_path,background_tasks):
|
115 |
+
print("获取到的用户bili_meta_data是:",bili_meta_data)
|
116 |
tasks = []
|
117 |
for file_name in file_list:
|
118 |
tasks.append(file_executer(file_name))
|