|
@@ -8,8 +8,8 @@ class swap_face():
|
|
|
self.imgurl = imgurl
|
|
|
def run(self):
|
|
|
name_hash = str(time.time()).replace('.','')
|
|
|
- src_img = 'FaceSwap/src_img/'+name_hash+'.jpg'
|
|
|
- sv_path = '../html/swap_save'+name_hash+'.avi'
|
|
|
+ src_img = './FaceSwap/src_img/'+name_hash+'.jpg'
|
|
|
+ sv_path = '../html/swap_save/'+name_hash+'.avi'
|
|
|
|
|
|
try:
|
|
|
im = Image.open(requests.get(self.imgurl, stream=True).raw)
|
|
@@ -20,11 +20,6 @@ class swap_face():
|
|
|
|
|
|
x = threading.Thread(target=self.runthreadswap, args=(src_img,sv_path))
|
|
|
x.start()
|
|
|
-
|
|
|
- return '生成中請稍候'
|
|
|
-
|
|
|
- def runthreadswap(self,src_img,sv_path):
|
|
|
- os.system('python3 FaceSwap/main_video.py --src_img '+src_img+' --video_path FaceSwap/nina_noGesture_adj.mp4 --correct_color --save_path '+sv_path)
|
|
|
while True:
|
|
|
print('waiting...')
|
|
|
if os.path.exists(sv_path):
|
|
@@ -32,6 +27,11 @@ class swap_face():
|
|
|
time.sleep(5)
|
|
|
print('waiting...')
|
|
|
notify_group('成功,影片在:www.choozmo.com:8168/swap_save/'+name_hash+'.avi')
|
|
|
+ return '生成中請稍候'
|
|
|
+
|
|
|
+ def runthreadswap(self,src_img,sv_path):
|
|
|
+ os.system('python3 FaceSwap/main_video.py --src_img '+src_img+' --video_path ./FaceSwap/nina_noGesture_adj.mp4 --correct_color --save_path '+sv_path)
|
|
|
+
|
|
|
|
|
|
def notify_group(self,msg):
|
|
|
headers = {
|