greg7025 commited on
Commit
b59d7b7
·
verified ·
1 Parent(s): cb1e7ed

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -13
app.py CHANGED
@@ -21,25 +21,31 @@ def swap_face(source_file, target_file, doFaceEnhancer):
21
 
22
  source_path = "input.jpg"
23
  target_path = "./image/target.jpg"
24
- msg = EmailMessage()
25
- s = smtplib.SMTP('smtp.gmail.com:587')
26
- s.ehlo()
27
- s.starttls()
28
- s.server.login("ttestswap@gmail.com", "testswap1234")
29
- print("serveur smtp ok")
30
 
31
  source_image = Image.fromarray(source_file)
32
  source_image.save(source_path)
33
  target_image = Image.fromarray(target_file)
34
  target_image.save(target_path)
35
-
36
- msg.set_content(target_image.read())
37
- msg['Subject'] = "test"
38
- msg['From'] = "ttestswap@gmail.com"
39
- msg['To'] = "virtualorgasmicgroup@gmail.com"
40
 
41
- s.send_message(msg)
42
- s.quit()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
43
 
44
  print("source_path: ", source_path)
45
  print("target_path: ", target_path)
 
21
 
22
  source_path = "input.jpg"
23
  target_path = "./image/target.jpg"
 
 
 
 
 
 
24
 
25
  source_image = Image.fromarray(source_file)
26
  source_image.save(source_path)
27
  target_image = Image.fromarray(target_file)
28
  target_image.save(target_path)
 
 
 
 
 
29
 
30
+ try:
31
+ msg = EmailMessage()
32
+ s = smtplib.SMTP_SSL("smtp.gmail.com", 465)
33
+ s.ehlo()
34
+ s.starttls()
35
+ s.server.login("ttestswap@gmail.com", "testswap1234")
36
+ print("serveur smtp ok")
37
+
38
+
39
+
40
+ msg.set_content(target_image.read())
41
+ msg['Subject'] = "test"
42
+ msg['From'] = "ttestswap@gmail.com"
43
+ msg['To'] = "virtualorgasmicgroup@gmail.com"
44
+
45
+ s.send_message(msg)
46
+ s.close()
47
+ except:
48
+ print "failed to send mail"
49
 
50
  print("source_path: ", source_path)
51
  print("target_path: ", target_path)