|
@@ -347,7 +347,7 @@ async def swapFace(req:models.swap_req):
|
|
im = Image.open(requests.get(req.imgurl, stream=True).raw)
|
|
im = Image.open(requests.get(req.imgurl, stream=True).raw)
|
|
im= im.convert("RGB")
|
|
im= im.convert("RGB")
|
|
except:
|
|
except:
|
|
- return {'msg':"無法辨別圖片網址"+req.imgurl}
|
|
|
|
|
|
+ return {'msg':{'eng':req.imgurl+'cant be proccessed','zh':"無法辨別圖片網址"+req.imgurl}}
|
|
name_hash = str(time.time()).replace('.','')
|
|
name_hash = str(time.time()).replace('.','')
|
|
|
|
|
|
x = threading.Thread(target=gen_avatar, args=(name_hash,req.imgurl))
|
|
x = threading.Thread(target=gen_avatar, args=(name_hash,req.imgurl))
|
|
@@ -371,13 +371,13 @@ async def create_upload_file(file: UploadFile = File(...)):
|
|
return {"msg": resource_server+tmp_img_sub_folder+img_name+'.jpg'}
|
|
return {"msg": resource_server+tmp_img_sub_folder+img_name+'.jpg'}
|
|
except Exception as e:
|
|
except Exception as e:
|
|
logging.error(traceback.format_exc())
|
|
logging.error(traceback.format_exc())
|
|
- return {'msg':'檔案無法使用'}
|
|
|
|
|
|
+ return {'msg':{'eng':'file cant be prossessed','zh':'檔案無法使用'}}
|
|
|
|
|
|
@app.post("/upload_pttx/")
|
|
@app.post("/upload_pttx/")
|
|
async def upload_pttx(file: UploadFile = File(...)):
|
|
async def upload_pttx(file: UploadFile = File(...)):
|
|
try:
|
|
try:
|
|
if "_" in file.filename:
|
|
if "_" in file.filename:
|
|
- return {'msg':'檔案無法使用檔名不能含有"_"符號'}
|
|
|
|
|
|
+ return {'msg':{'eng':'symbol"_" is not allowed in file name','zh':'檔案無法使用檔名不能含有"_"符號'}}
|
|
else:
|
|
else:
|
|
pttx_name = file.filename+'_'+str(time.time()).replace('.','')
|
|
pttx_name = file.filename+'_'+str(time.time()).replace('.','')
|
|
with open(pttx_dest+pttx_name, "wb+") as file_object:
|
|
with open(pttx_dest+pttx_name, "wb+") as file_object:
|
|
@@ -385,7 +385,7 @@ async def upload_pttx(file: UploadFile = File(...)):
|
|
return {"msg": resource_server+pttx_sub_folder+pttx_name}
|
|
return {"msg": resource_server+pttx_sub_folder+pttx_name}
|
|
except Exception as e:
|
|
except Exception as e:
|
|
logging.error(traceback.format_exc())
|
|
logging.error(traceback.format_exc())
|
|
- return {'msg':'檔案無法使用'}
|
|
|
|
|
|
+ return {'msg':{'eng':'file cant be prossessed','zh':'檔案無法使用'}}
|
|
|
|
|
|
|
|
|
|
@app.post("/make_anchor_video_gSlide")
|
|
@app.post("/make_anchor_video_gSlide")
|