|
@@ -111,6 +111,22 @@ async def progress_page():
|
|
|
|
|
|
@app.post("/make_anchor_video_v2")
|
|
|
async def make_anchor_video_v2(req:request):
|
|
|
+ for txt in req.text_content:
|
|
|
+ if re.search('[a-zA-Z]', txt) !=None:
|
|
|
+ return {'msg':'輸入字串不能包含英文字!'}
|
|
|
+
|
|
|
+ for imgu in image_urls:
|
|
|
+ try:
|
|
|
+ if get_url_type(imgu) =='video/mp4':
|
|
|
+ r=requests.get(imgu)
|
|
|
+ f=open(dir_photo+name_hash+"/"+str(img_num)+".mp4",'wb')
|
|
|
+ else:
|
|
|
+ im = Image.open(requests.get(imgu, stream=True).raw)
|
|
|
+ im= im.convert("RGB")
|
|
|
+ except:
|
|
|
+ return {'msg':"無法辨別圖片網址"+imgu}
|
|
|
+
|
|
|
+
|
|
|
db = dataset.connect('mysql://choozmo:pAssw0rd@db.ptt.cx:3306/AI_anchor?charset=utf8mb4')
|
|
|
log_table = db['history_input']
|
|
|
txt_content_seperate_by_dot = ''
|