Browse Source

add save src face

ming 3 years ago
parent
commit
7254759e81
1 changed files with 5 additions and 4 deletions
  1. 5 4
      api/main.py

+ 5 - 4
api/main.py

@@ -178,15 +178,16 @@ def gen_video(name_hash,name,text_content, image_urls,avatar,client_id):
 
 
 def gen_avatar(name_hash, imgurl):
+
+    im = Image.open(requests.get(imgurl, stream=True).raw)
+    im= im.convert("RGB")
+    im.save('../../face_swap/tmp_face/'+name_hash+'.jpg')
     c = rpyc.connect("localhost", 8868)
     c._config['sync_request_timeout'] = None
     remote_svc = c.root
     my_answer = remote_svc.call_avatar(name_hash) # method call
 
-    im = Image.open(requests.get(imgurl, stream=True).raw)
-    im= im.convert("RGB")
-    im.save('../../face_swap/tmp_face/'+name_hash+'.jpg')
-   
+
     shutil.copy(tmp_avatar_dir+name_hash+'.mp4',avatar_dest+name_hash+'.mp4')
     os.remove(tmp_avatar_dir+name_hash+'.mp4')