nsfwalex commited on
Commit
faf9b81
1 Parent(s): fb23992

Rename app1.py to app.py

Browse files
Files changed (1) hide show
  1. app1.py → app.py +6 -6
app1.py → app.py RENAMED
@@ -11,7 +11,7 @@ from roop.processors.frame.core import get_frame_processors_modules
11
  from roop.utilities import normalize_output_path
12
  import os
13
  from PIL import Image
14
- '''
15
  from cryptography.hazmat.primitives.asymmetric import rsa, padding
16
  from cryptography.hazmat.primitives import serialization, hashes
17
  from cryptography.hazmat.backends import default_backend
@@ -54,9 +54,9 @@ def verify_signature(public_key, data, signature):
54
  return False
55
 
56
  public_key = load_public_key_from_file("./nsfwais.pubkey.pem")
57
- '''
58
- def swap_face(source_file, target_file, doFaceEnhancer):
59
- '''
60
  skey = json.loads(skey)
61
  #first validate skey
62
  signature = base64.b64decode(skey["s"])
@@ -66,7 +66,7 @@ def swap_face(source_file, target_file, doFaceEnhancer):
66
  timestamp_now = int(datetime.datetime.utcnow().replace(tzinfo=datetime.timezone.utc).timestamp())
67
  if timestamp_now - timestamp_requested > 20:
68
  raise Exception(f"authkey timeout, {timestamp_now - timestamp_requested}")
69
- '''
70
  source_path = "input.jpg"
71
  target_path = "target.jpg"
72
 
@@ -120,7 +120,7 @@ app = gr.Blocks()
120
  with app:
121
  gr.Interface(
122
  fn=swap_face,
123
- inputs=[gr.Image(), gr.Image(), gr.Checkbox(label="face_enhancer?", info="do face enhancer?")],
124
  outputs="image"
125
  )
126
 
 
11
  from roop.utilities import normalize_output_path
12
  import os
13
  from PIL import Image
14
+
15
  from cryptography.hazmat.primitives.asymmetric import rsa, padding
16
  from cryptography.hazmat.primitives import serialization, hashes
17
  from cryptography.hazmat.backends import default_backend
 
54
  return False
55
 
56
  public_key = load_public_key_from_file("./nsfwais.pubkey.pem")
57
+
58
+ def swap_face(source_file, target_file, doFaceEnhancer, skey):
59
+
60
  skey = json.loads(skey)
61
  #first validate skey
62
  signature = base64.b64decode(skey["s"])
 
66
  timestamp_now = int(datetime.datetime.utcnow().replace(tzinfo=datetime.timezone.utc).timestamp())
67
  if timestamp_now - timestamp_requested > 20:
68
  raise Exception(f"authkey timeout, {timestamp_now - timestamp_requested}")
69
+
70
  source_path = "input.jpg"
71
  target_path = "target.jpg"
72
 
 
120
  with app:
121
  gr.Interface(
122
  fn=swap_face,
123
+ inputs=[gr.Image(), gr.Image(), gr.Checkbox(label="face_enhancer?", info="do face enhancer?", gr.Textbox(visible=False))],
124
  outputs="image"
125
  )
126