Spaces:
Sleeping
Sleeping
File size: 2,551 Bytes
a02077e 7157ea6 a02077e 7157ea6 a02077e 7157ea6 a02077e 7157ea6 a02077e |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
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}
}
|