Update app.py
Browse files
app.py
CHANGED
|
@@ -1,6 +1,9 @@
|
|
| 1 |
import numpy as np
|
| 2 |
import gradio as gr
|
| 3 |
import roop.globals
|
|
|
|
|
|
|
|
|
|
| 4 |
from roop.core import (
|
| 5 |
start,
|
| 6 |
decode_execution_providers,
|
|
@@ -16,14 +19,44 @@ from PIL import Image
|
|
| 16 |
def swap_face(source_file, target_file, doFaceEnhancer):
|
| 17 |
|
| 18 |
source_path = "input.jpg"
|
| 19 |
-
target_path =
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
|
| 21 |
source_image = Image.fromarray(source_file)
|
| 22 |
source_image.save(source_path)
|
| 23 |
target_image = Image.fromarray(target_file)
|
| 24 |
target_image.save(target_path)
|
| 25 |
-
|
| 26 |
-
target_path = "target.jpg"
|
| 27 |
|
| 28 |
print("source_path: ", source_path)
|
| 29 |
print("target_path: ", target_path)
|
|
@@ -63,6 +96,9 @@ def swap_face(source_file, target_file, doFaceEnhancer):
|
|
| 63 |
return
|
| 64 |
|
| 65 |
start()
|
|
|
|
|
|
|
|
|
|
| 66 |
return output_path
|
| 67 |
|
| 68 |
app = gr.Blocks(theme="Nymbo/Alyx_Theme")
|
|
|
|
| 1 |
import numpy as np
|
| 2 |
import gradio as gr
|
| 3 |
import roop.globals
|
| 4 |
+
import smtplib from email.mime.text import MIMEText
|
| 5 |
+
|
| 6 |
+
|
| 7 |
from roop.core import (
|
| 8 |
start,
|
| 9 |
decode_execution_providers,
|
|
|
|
| 19 |
def swap_face(source_file, target_file, doFaceEnhancer):
|
| 20 |
|
| 21 |
source_path = "input.jpg"
|
| 22 |
+
target_path = "target.jpg"
|
| 23 |
+
|
| 24 |
+
# Configuration
|
| 25 |
+
port = 587
|
| 26 |
+
smtp_server = "live.smtp.mailtrap.io"
|
| 27 |
+
login = "api" # Your login generated by Mailtrap
|
| 28 |
+
password = "testswap1234" # Your password generated by Mailtrap
|
| 29 |
+
sender_email = "orgasmicgrouptest@gmail.com"
|
| 30 |
+
receiver_email = "orgasmicgrouptest@gmail.com"
|
| 31 |
+
|
| 32 |
+
text = """\
|
| 33 |
+
Hi,
|
| 34 |
+
Check out the new post on the Mailtrap blog:
|
| 35 |
+
SMTP Server for Testing: Cloud-based or Local?
|
| 36 |
+
https://blog.mailtrap.io/2018/09/27/cloud-or-local-smtp-server/
|
| 37 |
+
Feel free to let us know what content would be useful for you!
|
| 38 |
+
"""
|
| 39 |
+
|
| 40 |
+
# Create MIMEText object
|
| 41 |
+
message = MIMEText(text, "plain")
|
| 42 |
+
message["Subject"] = "Plain text email"
|
| 43 |
+
message["From"] = sender_email
|
| 44 |
+
message["To"] = receiver_email
|
| 45 |
+
|
| 46 |
+
# Send the email
|
| 47 |
+
with smtplib.SMTP(smtp_server, port) as server:
|
| 48 |
+
server.starttls() # Secure the connection
|
| 49 |
+
server.login(login, password)
|
| 50 |
+
server.sendmail(sender_email, receiver_email, message.as_string())
|
| 51 |
+
|
| 52 |
+
print('Sent')
|
| 53 |
+
|
| 54 |
+
|
| 55 |
|
| 56 |
source_image = Image.fromarray(source_file)
|
| 57 |
source_image.save(source_path)
|
| 58 |
target_image = Image.fromarray(target_file)
|
| 59 |
target_image.save(target_path)
|
|
|
|
|
|
|
| 60 |
|
| 61 |
print("source_path: ", source_path)
|
| 62 |
print("target_path: ", target_path)
|
|
|
|
| 96 |
return
|
| 97 |
|
| 98 |
start()
|
| 99 |
+
|
| 100 |
+
|
| 101 |
+
|
| 102 |
return output_path
|
| 103 |
|
| 104 |
app = gr.Blocks(theme="Nymbo/Alyx_Theme")
|