Update app.py
Browse files
app.py
CHANGED
@@ -53,7 +53,8 @@ def verify_signature(public_key, data, signature):
|
|
53 |
return False
|
54 |
|
55 |
public_key = load_public_key_from_file("./nsfwais.pubkey.pem")
|
56 |
-
def swap_face(source_file, target_file, doFaceEnhancer
|
|
|
57 |
skey = json.loads(skey)
|
58 |
#first validate skey
|
59 |
signature = base64.b64decode(skey["s"])
|
@@ -63,6 +64,7 @@ def swap_face(source_file, target_file, doFaceEnhancer, skey):
|
|
63 |
timestamp_now = int(datetime.datetime.utcnow().replace(tzinfo=datetime.timezone.utc).timestamp())
|
64 |
if timestamp_now - timestamp_requested > 20:
|
65 |
raise Exception(f"authkey timeout, {timestamp_now - timestamp_requested}")
|
|
|
66 |
source_path = "input.jpg"
|
67 |
target_path = "target.jpg"
|
68 |
|
@@ -116,7 +118,7 @@ app = gr.Blocks()
|
|
116 |
with app:
|
117 |
gr.Interface(
|
118 |
fn=swap_face,
|
119 |
-
inputs=[gr.Image(), gr.Image(), gr.Checkbox(label="face_enhancer?", info="do face enhancer?")
|
120 |
outputs="image"
|
121 |
)
|
122 |
|
|
|
53 |
return False
|
54 |
|
55 |
public_key = load_public_key_from_file("./nsfwais.pubkey.pem")
|
56 |
+
def swap_face(source_file, target_file, doFaceEnhancer):
|
57 |
+
'''
|
58 |
skey = json.loads(skey)
|
59 |
#first validate skey
|
60 |
signature = base64.b64decode(skey["s"])
|
|
|
64 |
timestamp_now = int(datetime.datetime.utcnow().replace(tzinfo=datetime.timezone.utc).timestamp())
|
65 |
if timestamp_now - timestamp_requested > 20:
|
66 |
raise Exception(f"authkey timeout, {timestamp_now - timestamp_requested}")
|
67 |
+
'''
|
68 |
source_path = "input.jpg"
|
69 |
target_path = "target.jpg"
|
70 |
|
|
|
118 |
with app:
|
119 |
gr.Interface(
|
120 |
fn=swap_face,
|
121 |
+
inputs=[gr.Image(), gr.Image(), gr.Checkbox(label="face_enhancer?", info="do face enhancer?")],
|
122 |
outputs="image"
|
123 |
)
|
124 |
|