diff --git a/.DS_Store b/.DS_Store index 05b1181b9932e1fa6db029eff06f2c8d12d5ee7f..44a31c3ce1be29a182fe0e8843de1892fcf68af9 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/Datas/.DS_Store b/Datas/.DS_Store index 9b3c2b7bf1769788d9ab2604625d63f4869d65a2..373e2cb18155c4e4c2fbb805f053509d8a66e7d5 100644 Binary files a/Datas/.DS_Store and b/Datas/.DS_Store differ diff --git a/Datas/UserRecord_1/Ips/127.0.0.1.pkl b/Datas/UserRecord_1/Ips/127.0.0.1.pkl new file mode 100644 index 0000000000000000000000000000000000000000..dbd736bdc14d5607f8459589965a1e5c5d4864ec Binary files /dev/null and b/Datas/UserRecord_1/Ips/127.0.0.1.pkl differ diff --git a/Datas/UserRecord_3/Ips/127.0.0.1.pkl b/Datas/UserRecord_3/Ips/127.0.0.1.pkl new file mode 100644 index 0000000000000000000000000000000000000000..80bac92c016ad8a05bf2f13e2d511a4221c5c04b Binary files /dev/null and b/Datas/UserRecord_3/Ips/127.0.0.1.pkl differ diff --git a/Datas/UserRecord_4/Ips/127.0.0.1.pkl b/Datas/UserRecord_4/Ips/127.0.0.1.pkl new file mode 100644 index 0000000000000000000000000000000000000000..8a2bef7ddfe8315081732bbaecfd1255d75c5558 Binary files /dev/null and b/Datas/UserRecord_4/Ips/127.0.0.1.pkl differ diff --git a/Datas/UserRecord_5/Ips/127.0.0.1.pkl b/Datas/UserRecord_5/Ips/127.0.0.1.pkl new file mode 100644 index 0000000000000000000000000000000000000000..0b811e9db245b663f5e2cd9b91e9c8eee3f394ea Binary files /dev/null and b/Datas/UserRecord_5/Ips/127.0.0.1.pkl differ diff --git a/Datas/UserRecord_6/Ips/127.0.0.1.pkl b/Datas/UserRecord_6/Ips/127.0.0.1.pkl new file mode 100644 index 0000000000000000000000000000000000000000..ca4ed79cd1c69079444bcc3564cdab9967685570 Binary files /dev/null and b/Datas/UserRecord_6/Ips/127.0.0.1.pkl differ diff --git a/Datas/task1/.DS_Store b/Datas/task1/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..baaef7f5878cf72d4ea04896d42143f3204ba258 Binary files /dev/null and b/Datas/task1/.DS_Store differ diff --git a/Datas/task1/showcases/.DS_Store b/Datas/task1/showcases/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..5008ddfcf53c02e82d7eee2e57c38e5672ef89f6 Binary files /dev/null and b/Datas/task1/showcases/.DS_Store differ diff --git a/Datas/task1/showcases/src01_seg.png b/Datas/task1/showcases/src01_seg.png new file mode 100644 index 0000000000000000000000000000000000000000..98267c98b048c2a1c58f00a53a174bff1b5fb5ae Binary files /dev/null and b/Datas/task1/showcases/src01_seg.png differ diff --git a/Datas/task1/srcs/.DS_Store b/Datas/task1/srcs/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..982e1a1c186fe758cf7cab9cd1e9a9793c127740 Binary files /dev/null and b/Datas/task1/srcs/.DS_Store differ diff --git a/Datas/task1/srcs/src01.jpg b/Datas/task1/srcs/src01.jpg new file mode 100644 index 0000000000000000000000000000000000000000..0f6aa77c884953b952680c3bb56c0af7d9c627e4 Binary files /dev/null and b/Datas/task1/srcs/src01.jpg differ diff --git a/Datas/task1/temps/.DS_Store b/Datas/task1/temps/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..5008ddfcf53c02e82d7eee2e57c38e5672ef89f6 Binary files /dev/null and b/Datas/task1/temps/.DS_Store differ diff --git a/Datas/task1/temps/caption.jpg b/Datas/task1/temps/caption.jpg new file mode 100644 index 0000000000000000000000000000000000000000..706b98b255efcaf7c44272813a4a17071433c916 Binary files /dev/null and b/Datas/task1/temps/caption.jpg differ diff --git a/Datas/task3/.DS_Store b/Datas/task3/.DS_Store index 4ffd87e6173015455aeef8d9d568bca93625823e..fe14a353f9f9354ee11d8f26c3184a6b7c0f866c 100644 Binary files a/Datas/task3/.DS_Store and b/Datas/task3/.DS_Store differ diff --git a/Datas/task4/.DS_Store b/Datas/task4/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..e34f9f08a5cd1b0090c94f2889b322c4335beb55 Binary files /dev/null and b/Datas/task4/.DS_Store differ diff --git a/Datas/task4/showcases/.DS_Store b/Datas/task4/showcases/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..afe02482d41d3a1698ae2d2eceb08cf116f4a85b Binary files /dev/null and b/Datas/task4/showcases/.DS_Store differ diff --git a/Datas/task4/showcases/src01_vivienne.jpg b/Datas/task4/showcases/src01_vivienne.jpg new file mode 100644 index 0000000000000000000000000000000000000000..f46a01b5af85658e4fc995b361e3a5ac65e464fd Binary files /dev/null and b/Datas/task4/showcases/src01_vivienne.jpg differ diff --git a/Datas/task4/showcases/src02_nia.jpg b/Datas/task4/showcases/src02_nia.jpg new file mode 100644 index 0000000000000000000000000000000000000000..b58a50a2174c011e3d9376307c6365ff80c70e22 Binary files /dev/null and b/Datas/task4/showcases/src02_nia.jpg differ diff --git a/Datas/task4/showcases/src02_vivienne.jpg b/Datas/task4/showcases/src02_vivienne.jpg new file mode 100644 index 0000000000000000000000000000000000000000..525ffbab1161104bd7da25f562f4986c10af53ce Binary files /dev/null and b/Datas/task4/showcases/src02_vivienne.jpg differ diff --git a/Datas/task4/showcases/src03_male.jpg b/Datas/task4/showcases/src03_male.jpg new file mode 100644 index 0000000000000000000000000000000000000000..b209254b835827ddd5f7004e022eae56cf3b9b7e Binary files /dev/null and b/Datas/task4/showcases/src03_male.jpg differ diff --git a/Datas/task4/showcases/src04_balle.jpg b/Datas/task4/showcases/src04_balle.jpg new file mode 100644 index 0000000000000000000000000000000000000000..d7b9659650a73ee0314429b267f918b7b11071e3 Binary files /dev/null and b/Datas/task4/showcases/src04_balle.jpg differ diff --git a/Datas/task4/srcs/.DS_Store b/Datas/task4/srcs/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..982e1a1c186fe758cf7cab9cd1e9a9793c127740 Binary files /dev/null and b/Datas/task4/srcs/.DS_Store differ diff --git a/Datas/task4/srcs/src01.jpg b/Datas/task4/srcs/src01.jpg new file mode 100644 index 0000000000000000000000000000000000000000..67b4a8f0e9dad26e1197ef86c249966eb8f3cd5e Binary files /dev/null and b/Datas/task4/srcs/src01.jpg differ diff --git a/Datas/task4/srcs/src03.jpg b/Datas/task4/srcs/src03.jpg new file mode 100644 index 0000000000000000000000000000000000000000..c72da1bf23d380bbb2a533c392e9f58f5614e844 Binary files /dev/null and b/Datas/task4/srcs/src03.jpg differ diff --git a/Datas/task4/srcs/src04.jpg b/Datas/task4/srcs/src04.jpg new file mode 100644 index 0000000000000000000000000000000000000000..24ededda821039ed0b28e1fde56ea28345d80094 Binary files /dev/null and b/Datas/task4/srcs/src04.jpg differ diff --git a/Datas/task4/temps/.DS_Store b/Datas/task4/temps/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..ba9ac82eca8028c1f4acdc4f30716561a8314615 Binary files /dev/null and b/Datas/task4/temps/.DS_Store differ diff --git a/Datas/task4/temps/Ava.jpg b/Datas/task4/temps/Ava.jpg new file mode 100644 index 0000000000000000000000000000000000000000..3784b8006dfa2750efbc4d52e74665a31386dc60 Binary files /dev/null and b/Datas/task4/temps/Ava.jpg differ diff --git a/Datas/task4/temps/Bella.jpg b/Datas/task4/temps/Bella.jpg new file mode 100644 index 0000000000000000000000000000000000000000..b89edc4d4626b3596afd53e6d83f8fe140523e33 Binary files /dev/null and b/Datas/task4/temps/Bella.jpg differ diff --git a/Datas/task4/temps/Leo.jpg b/Datas/task4/temps/Leo.jpg new file mode 100644 index 0000000000000000000000000000000000000000..3e685c52a573392fe16670756f5ca52e26b15e2e Binary files /dev/null and b/Datas/task4/temps/Leo.jpg differ diff --git a/Datas/task4/temps/Luna.jpg b/Datas/task4/temps/Luna.jpg new file mode 100644 index 0000000000000000000000000000000000000000..9ae5069d0654fd67c12fefac422da3d4d975621f Binary files /dev/null and b/Datas/task4/temps/Luna.jpg differ diff --git a/Datas/task4/temps/Naoko.jpg b/Datas/task4/temps/Naoko.jpg new file mode 100644 index 0000000000000000000000000000000000000000..d13752d7f710320936f3185b36e76cca9d4e7120 Binary files /dev/null and b/Datas/task4/temps/Naoko.jpg differ diff --git a/Datas/task4/temps/Nia.jpg b/Datas/task4/temps/Nia.jpg new file mode 100644 index 0000000000000000000000000000000000000000..cbaba1a31695e52a97f8888f3674b816cba69813 Binary files /dev/null and b/Datas/task4/temps/Nia.jpg differ diff --git a/Datas/task4/temps/Sophie.jpg b/Datas/task4/temps/Sophie.jpg new file mode 100644 index 0000000000000000000000000000000000000000..51050b7a65ef73231b8a4139c3be762931cba085 Binary files /dev/null and b/Datas/task4/temps/Sophie.jpg differ diff --git a/Datas/task4/temps/Vivienne.jpg b/Datas/task4/temps/Vivienne.jpg new file mode 100644 index 0000000000000000000000000000000000000000..9cc6aa38c89da4f4ab4964bcaaa26c4dd24b8a6d Binary files /dev/null and b/Datas/task4/temps/Vivienne.jpg differ diff --git a/Datas/task5/.DS_Store b/Datas/task5/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..7bf21b6a2781840380334e64e6726c19b8f92199 Binary files /dev/null and b/Datas/task5/.DS_Store differ diff --git a/Datas/task5/showcases/.DS_Store b/Datas/task5/showcases/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..afe02482d41d3a1698ae2d2eceb08cf116f4a85b Binary files /dev/null and b/Datas/task5/showcases/.DS_Store differ diff --git a/Datas/task5/showcases/src01_street.jpg b/Datas/task5/showcases/src01_street.jpg new file mode 100644 index 0000000000000000000000000000000000000000..fef44bca3a2c2b83d9168d6094597af724b3e605 Binary files /dev/null and b/Datas/task5/showcases/src01_street.jpg differ diff --git a/Datas/task5/showcases/src01_walk.jpg b/Datas/task5/showcases/src01_walk.jpg new file mode 100644 index 0000000000000000000000000000000000000000..c9e7a8c25eb24a3673d6f7db643dd1a06814107f Binary files /dev/null and b/Datas/task5/showcases/src01_walk.jpg differ diff --git a/Datas/task5/srcs/.DS_Store b/Datas/task5/srcs/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..982e1a1c186fe758cf7cab9cd1e9a9793c127740 Binary files /dev/null and b/Datas/task5/srcs/.DS_Store differ diff --git a/Datas/task5/srcs/src01.jpg b/Datas/task5/srcs/src01.jpg new file mode 100644 index 0000000000000000000000000000000000000000..0a5d06cfd6050b731747bc1e7a23840c3f0a6749 Binary files /dev/null and b/Datas/task5/srcs/src01.jpg differ diff --git a/Datas/task5/temps/.DS_Store b/Datas/task5/temps/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..ba9ac82eca8028c1f4acdc4f30716561a8314615 Binary files /dev/null and b/Datas/task5/temps/.DS_Store differ diff --git a/Datas/task5/temps/caption.jpg b/Datas/task5/temps/caption.jpg new file mode 100644 index 0000000000000000000000000000000000000000..d040e861e868312515efa7a2c98c15b6fd15a03d Binary files /dev/null and b/Datas/task5/temps/caption.jpg differ diff --git a/Datas/task6/.DS_Store b/Datas/task6/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..37bdb8af98428a4eda90ba460547f4d268f13639 Binary files /dev/null and b/Datas/task6/.DS_Store differ diff --git a/Datas/task6/showcases/.DS_Store b/Datas/task6/showcases/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..a1abd3c82f80284f37c0d2492bb692052ba10a66 Binary files /dev/null and b/Datas/task6/showcases/.DS_Store differ diff --git a/Datas/task6/showcases/src01_niantu.jpg b/Datas/task6/showcases/src01_niantu.jpg new file mode 100644 index 0000000000000000000000000000000000000000..5136234eeb92a189abaa9b4b065eb4bb749754ec Binary files /dev/null and b/Datas/task6/showcases/src01_niantu.jpg differ diff --git a/Datas/task6/showcases/src02_shouban.jpg b/Datas/task6/showcases/src02_shouban.jpg new file mode 100644 index 0000000000000000000000000000000000000000..f8062f57feb046985fb48658ba6cf7f97e04a835 Binary files /dev/null and b/Datas/task6/showcases/src02_shouban.jpg differ diff --git a/Datas/task6/srcs/.DS_Store b/Datas/task6/srcs/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..982e1a1c186fe758cf7cab9cd1e9a9793c127740 Binary files /dev/null and b/Datas/task6/srcs/.DS_Store differ diff --git a/Datas/task6/srcs/src01.jpg b/Datas/task6/srcs/src01.jpg new file mode 100644 index 0000000000000000000000000000000000000000..2fee9bb20fe168c3e416607e9f42bb29d77f21a3 Binary files /dev/null and b/Datas/task6/srcs/src01.jpg differ diff --git a/Datas/task6/temps/.DS_Store b/Datas/task6/temps/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..ba9ac82eca8028c1f4acdc4f30716561a8314615 Binary files /dev/null and b/Datas/task6/temps/.DS_Store differ diff --git a/Datas/task6/temps/3d-shouban.jpg b/Datas/task6/temps/3d-shouban.jpg new file mode 100644 index 0000000000000000000000000000000000000000..141478712ab5b59750aa34fb3a510a60eff2d3f8 Binary files /dev/null and b/Datas/task6/temps/3d-shouban.jpg differ diff --git a/Datas/task6/temps/niantu.jpg b/Datas/task6/temps/niantu.jpg new file mode 100644 index 0000000000000000000000000000000000000000..c39e5783ace02fdced2cb505a6afdb83fcbb19f4 Binary files /dev/null and b/Datas/task6/temps/niantu.jpg differ diff --git a/__pycache__/config.cpython-312.pyc b/__pycache__/config.cpython-312.pyc index f9a5e3289bdabe461c100c24a1321dd834f8aa21..7988c0152b91703ede92f3e92915fd8597e51cbd 100644 Binary files a/__pycache__/config.cpython-312.pyc and b/__pycache__/config.cpython-312.pyc differ diff --git a/__pycache__/utils.cpython-312.pyc b/__pycache__/utils.cpython-312.pyc index a45381f7f6dab2c50261aab4eccf0f2f2aff7ca5..f05e18f959c58de49b60acd6adbd46c430952d41 100644 Binary files a/__pycache__/utils.cpython-312.pyc and b/__pycache__/utils.cpython-312.pyc differ diff --git a/app.py b/app.py index f399411612827a984fda2be0d7dfc53b7556a282..e0c35ff351aed82d6b74ad2ae03de98fde3d1c0f 100644 --- a/app.py +++ b/app.py @@ -97,15 +97,14 @@ with gr.Blocks(css=css) as demo: with gr.Row(): with gr.Column(): with gr.Column(): - temp_image = gr.Image(sources='clipboard', type="filepath", label="Choose a template", - value=temp_examples[0][0]) - temp_example = gr.Examples(inputs=[temp_image], - examples_per_page=9, examples=temp_examples) + temp_image = gr.Image(sources='clipboard', type="filepath", label=TempLabel, + value=temp_examples[0][0], visible=TempVisible) + temp_example = gr.Examples(inputs=[temp_image], examples_per_page=9, + examples=temp_examples, visible=TempVisible) with gr.Column(): with gr.Column(): - user_image = gr.Image(value=None, type="numpy", label="product photo") - caption_text = gr.Textbox(value="", interactive=True, - label='English caption text (optional)') + user_image = gr.Image(value=None, type="numpy", label=UserLabel) + caption_text = gr.Textbox(value="", interactive=True, label=CaptionLabel, visible=CapVisible) with gr.Column(): with gr.Column(): res_image = gr.Image(label="generate image", value=None, type="filepath") diff --git a/config.py b/config.py index f6444638a9c915b7b15d1e09f114bbe2c4d6e62d..58702e83bd8fe49137f0f39b462e332b5fa644cb 100644 --- a/config.py +++ b/config.py @@ -14,15 +14,101 @@ import gradio as gr from collections import OrderedDict -taskType = "3" +taskType = "4" +CapVisible = True + if taskType=="3": # 是否显示token输入框 is_show_token = True # 标题 title = r""" -

Selfit AI App: Product poster background generation

+

Selfit AI App: Poster Background Generation

+ """ + # 标题下的描述 + description = r""" + Go to HeyBeauty for Faster and Free AI App! 🤗 .
+ + 1. Please wait for a while after submitting the task, you will get the result within 30 seconds. + 2. After exhausted all trial attempts, you can find your api key here .
+ 3. Share app with your friends and enjoy! 😊.
+ """ + # 组件信息 + TempLabel = "Choose a template" + TempVisible = True + UserLabel = "product photo" + CaptionLabel = "English caption text (optional)" + +elif taskType=="4": + # 是否显示token输入框 + is_show_token = True + # 标题 + title = r""" +

Selfit AI App: AI Model Replace

+ """ + # 标题下的描述 + description = r""" + Go to HeyBeauty for Faster and Free AI App! 🤗 .
+ + 1. Please wait for a while after submitting the task, you will get the result within 30 seconds. + 2. After exhausted all trial attempts, you can find your api key here .
+ 3. Share app with your friends and enjoy! 😊.
+ """ + # 组件信息 + TempLabel = "Choose a Model" + TempVisible = True + UserLabel = "upload photo" + CaptionLabel = "English caption text (optional)" + +elif taskType=="6": + # 是否显示token输入框 + is_show_token = True + # 标题 + title = r""" +

Selfit AI App: Image Style Filter

+ """ + # 标题下的描述 + description = r""" + Go to HeyBeauty for Faster and Free AI App! 🤗 .
+ + 1. Please wait for a while after submitting the task, you will get the result within 30 seconds. + 2. After exhausted all trial attempts, you can find your api key here .
+ 3. Share app with your friends and enjoy! 😊.
+ """ + # 组件信息 + TempLabel = "Choose a Style" + TempVisible = True + UserLabel = "upload photo" + CaptionLabel = "English caption text (optional)" + +elif taskType=="5": + # 是否显示token输入框 + is_show_token = True + # 标题 + title = r""" +

Selfit AI App: Poster(human) Background Swap

+ """ + # 标题下的描述 + description = r""" + Go to HeyBeauty for Faster and Free AI App! 🤗 .
+ + 1. Please wait for a while after submitting the task, you will get the result within 30 seconds. + 2. After exhausted all trial attempts, you can find your api key here .
+ 3. Share app with your friends and enjoy! 😊.
+ """ + # 组件信息 + TempLabel = "background info" + TempVisible = True + UserLabel = "upload photo" + CaptionLabel = "English caption text (optional)" + +elif taskType=="1": + # 是否显示token输入框 + is_show_token = True + # 标题 + title = r""" +

Selfit AI App: Object Segment

""" # 标题下的描述 description = r""" @@ -32,12 +118,19 @@ if taskType=="3": 2. After exhausted all trial attempts, you can find your api key here .
3. Share app with your friends and enjoy! 😊.
""" + # 组件信息 + TempLabel = "guide" + TempVisible = True + UserLabel = "upload photo" + CaptionLabel = "English caption text (optional)" + CapVisible = False + else: # 是否显示token输入框 is_show_token = False # 标题 title = r""" -

Selfit AI App: Product poster background generation

+

Selfit AI App: Poster(product) background generation

""" # 标题下的描述 description = r""" diff --git a/utils.py b/utils.py index e9c4dfefa4eddd08bd2d95822b92c0d1770ecba7..3e7d5cb4a632498b4ed58a775f959d092783cd04 100644 --- a/utils.py +++ b/utils.py @@ -23,6 +23,7 @@ def load_pkl(path): return pickle.load(f) def save_pkl(data, path, reweite=False): + os.makedirs(os.path.dirname(path), exist_ok=True) if not os.path.exists(path) or reweite: # 不存在或者强制重写 with open(path,'wb') as file: pickle.dump(data, file, protocol=4) @@ -55,7 +56,7 @@ class UserRecorder(object): def __init__(self, ): super(UserRecorder, self).__init__() - record_dir = os.path.join(data_dir, 'UserRecord') + record_dir = os.path.join(data_dir, f'UserRecord_{taskType}') self.ip_dir = os.path.join(record_dir, 'Ips') self.token_dir = os.path.join(record_dir, 'Tokens') os.makedirs(self.ip_dir, exist_ok=True) @@ -165,6 +166,30 @@ def get_showcase_examples(taskType): ["task3/temps/mountain-water.jpg", "task3/srcs/src01.jpg", "task3/showcases/src01_mountain-water.jpg"], ["task3/temps/rock-on-water.jpg", "task3/srcs/src01.jpg", "task3/showcases/src01_rock-on-water.jpg"], ] + elif taskType=="4": + examples=[ + ["task4/temps/Vivienne.jpg", "task4/srcs/src02.jpg", "task4/showcases/src02_vivienne.jpg"], + ["task4/temps/Bella.jpg", "task4/srcs/src04.jpg", "task4/showcases/src04_balle.jpg"], + ["task4/temps/Nia.jpg", "task4/srcs/src02.jpg", "task4/showcases/src02_nia.jpg"], + ["task4/temps/Leo.jpg", "task4/srcs/src03.jpg", "task4/showcases/src03_male.jpg"], + ] + elif taskType=="6": + examples=[ + ["task6/temps/niantu.jpg", "task6/srcs/src01.jpg", "task6/showcases/src01_niantu.jpg"], + ["task6/temps/3d-shouban.jpg", "task6/srcs/src02.jpg", "task6/showcases/src02_shouban.jpg"], + ] + + elif taskType=="5": + examples=[ + ["task5/temps/caption.jpg", "task5/srcs/src01.jpg", "task5/showcases/src01_street.jpg"], + ["task5/temps/caption.jpg", "task5/srcs/src01.jpg", "task5/showcases/src01_walk.jpg"], + ] + + elif taskType=="1": + examples=[ + ["task1/temps/caption.jpg", "task1/srcs/src01.jpg", "task1/showcases/src01_seg.png"], + ] + for i in range(len(examples)): for j in range(len(examples[i])): examples[i][j] = os.path.join(data_dir, examples[i][j]) @@ -200,9 +225,12 @@ def upload_user_img(clientIp, img): def publicSelfitTask(image, temp_image, caption_text): - temp_name = os.path.basename(temp_image).split('.')[0] + if taskType in ['5']: # 无模板 + temp_name = '' + else: + temp_name = os.path.basename(temp_image).split('.')[0] params = {'openId':openId, 'apiKey':apiKey, 'image':image, 'mask':"", - "image_type":"2", "task_type":"3", 'param1':temp_name, + "image_type":"2", "task_type":taskType, 'param1':temp_name, 'param2':str(caption_text), 'param3':"1", 'param4':"", 'param5':""} session = requests.session() ret = requests.post(f"{apiUrl}/public", data=json.dumps(params))