taskManager / taskMap.py
rogerxavier's picture
Update taskMap.py
7157ea6 verified
raw
history blame
2.55 kB
from task import _0上传遮罩, _1批量顺序上传原始图片到服务器manga, _2发送任务请求一次执行全部流程, \
_3检测output_video效果
from faker import Faker
fake = Faker()#伪造请求头
fake_user_agent = fake.user_agent()
fake_headers = {
'scheme': 'https',
'Accept': '*/*',
'Accept-Encoding': 'gzip, deflate, br, zstd',
'Accept-Language': 'zh-CN,zh;q=0.9',
'Dnt': '1',
'Priority': 'u=1, i',
'Sec-Ch-Ua': '"Chromium";v="124", "Google Chrome";v="124", "Not-A.Brand";v="99"',
'Sec-Ch-Ua-Mobile': '?0',
'Sec-Ch-Ua-Platform': '"Windows"',
'Sec-Fetch-Dest': 'empty',
'Sec-Fetch-Mode': 'cors',
'Sec-Fetch-Site': 'same-origin',
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36'
}
fake_headers['User-Agent'] = fake_user_agent
bili_meta_data = {
"act_reserve_create": 0,
"copyright": 1, # 2是转载
"source": "",
"desc": '點精心设计乳猪份巷',
"desc_format_id": 0,
"dynamic": "",
"interactive": 0,
"no_reprint": 1,
"open_elec": 0,
"origin_state": 0,
"subtitles": {
"lan": "",
"open": 0
},
"tag": "动漫解说,漫画, 标动画,动漫杂谈,恋爱,吐槽,漫画推荐",
"tid": 210,
"title": '鬼畜英雄13',
"up_close_danmaku": False,
"up_close_reply": False,
"up_selection_reply": False,
"dtime": 0
}
defaultBaseUrl = 'https://rogerxavier-moviepy-with-manga-test.hf.space'#比如https否则method not allowed
# 函数映射简化执行输入
# 定义任务函数映射字典
task_functions = {
"0": _0上传遮罩.upload_mask_to_space,
"1": _1批量顺序上传原始图片到服务器manga.upload_manga_to_space,
"2": _2发送任务请求一次执行全部流程.task_submit_to_space,
"3": _3检测output_video效果.download_output_video
}
# 定义函数名称和参数的元组列表,可以用**的写法将dict传递参数字典给函数
tasks_params = {
"0": {"baseUrl": defaultBaseUrl, "mask_path": 'mask',"fake_headers":fake_headers},
"1": {"baseUrl": defaultBaseUrl, "manga_path": 'manga',"fake_headers":fake_headers},
"2": {"baseUrl": defaultBaseUrl,
"task_list": ["0filterImage", "1removeMask", "2magiDialogCut", "3mergeDialogToVideo"],
"bili_meta": bili_meta_data, "allow_submit": False,"fake_headers":fake_headers
},
"3": {"baseUrl": defaultBaseUrl, "save_path": "output_video.mp4","fake_headers":fake_headers}
}