rogerxavier
commited on
Commit
•
184af71
1
Parent(s):
bb26efc
Update api.py
Browse files
api.py
CHANGED
@@ -13,8 +13,13 @@ import subprocess
|
|
13 |
from fastapi import BackgroundTasks
|
14 |
import time
|
15 |
from bilibili_api import sync, video_uploader, Credential#bili上传部分
|
|
|
|
|
|
|
|
|
16 |
app = FastAPI()
|
17 |
|
|
|
18 |
@app.get("/inference")
|
19 |
def inference():
|
20 |
return "<p>Hello, World!</p>"
|
@@ -94,9 +99,11 @@ async def execute_py_file(file_name: str,background_tasks: BackgroundTasks):
|
|
94 |
|
95 |
|
96 |
|
97 |
-
#收到图片后为了后台任务的顺序,单独设定一个函数依次将自定义执行顺序加入队列
|
98 |
@app.get("/execute_all_task")
|
99 |
-
async def execute_all_task(background_tasks: BackgroundTasks,file_list: list = ["1removeMask", "2magiDialogCut", "3mergeDialogToVideo"]
|
|
|
|
|
100 |
for file_name in file_list:
|
101 |
background_tasks.add_task(file_executer, file_name)
|
102 |
return {"message": "Tasks added to the queue"}
|
@@ -121,9 +128,7 @@ def returnRandomSubscribeUrl(background_tasks: BackgroundTasks)->str:
|
|
121 |
|
122 |
|
123 |
|
124 |
-
|
125 |
-
bili_jct = os.getenv('bili_jct')
|
126 |
-
buvid3 = os.getenv('buvid3')
|
127 |
async def upload_video():
|
128 |
credential = Credential(sessdata=sessdata,
|
129 |
bili_jct=bili_jct,
|
|
|
13 |
from fastapi import BackgroundTasks
|
14 |
import time
|
15 |
from bilibili_api import sync, video_uploader, Credential#bili上传部分
|
16 |
+
|
17 |
+
sessdata = os.getenv('sessdata')
|
18 |
+
bili_jct = os.getenv('bili_jct')
|
19 |
+
buvid3 = os.getenv('buvid3')
|
20 |
app = FastAPI()
|
21 |
|
22 |
+
|
23 |
@app.get("/inference")
|
24 |
def inference():
|
25 |
return "<p>Hello, World!</p>"
|
|
|
99 |
|
100 |
|
101 |
|
102 |
+
#收到图片后为了后台任务的顺序,单独设定一个函数依次将自定义执行顺序加入队列 ,有默认参数的写后面-并且和bili合并,不然还要等output.mp4生成后才能发起提交请求
|
103 |
@app.get("/execute_all_task")
|
104 |
+
async def execute_all_task(background_tasks: BackgroundTasks,file_list: list = ["1removeMask", "2magiDialogCut", "3mergeDialogToVideo","4biliSubmit"],
|
105 |
+
bili_meta_data:dict = None,cover_path:str = 'cover/cover.jpg',mp4_out_file:str='mp4_out/output.mp4'
|
106 |
+
):
|
107 |
for file_name in file_list:
|
108 |
background_tasks.add_task(file_executer, file_name)
|
109 |
return {"message": "Tasks added to the queue"}
|
|
|
128 |
|
129 |
|
130 |
|
131 |
+
|
|
|
|
|
132 |
async def upload_video():
|
133 |
credential = Credential(sessdata=sessdata,
|
134 |
bili_jct=bili_jct,
|