Mrlongpro commited on
Commit
91a4856
1 Parent(s): 35e2e09

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -1
app.py CHANGED
@@ -3,9 +3,12 @@ import subprocess
3
  import shutil
4
  import os
5
  from datetime import datetime
 
6
 
7
  def run_scripts(target, source, use_face_enhancer):
8
  outputfile=[]
 
 
9
  for target_file in target :
10
  target_extension = os.path.splitext(target_file.name)[-1]
11
  target_name = os.path.splitext(target_file.name)[1]
@@ -15,8 +18,11 @@ def run_scripts(target, source, use_face_enhancer):
15
  cmd1 = ["python3", "run.py", "-s", source.name, "-t", target_file.name, "-o", output_path1, "--frame-processor", "face_swapper","face_enhancer",'--many-faces']
16
  subprocess.run(cmd1)
17
  outputfile.append(output_path1)
 
18
 
19
- return outputfile
 
 
20
 
21
  iface = gr.Interface(
22
  fn=run_scripts,
 
3
  import shutil
4
  import os
5
  from datetime import datetime
6
+ import zipfile
7
 
8
  def run_scripts(target, source, use_face_enhancer):
9
  outputfile=[]
10
+ zip_filename = datetime.now().strftime("%Y%m%d%H%M%S") +".zip"
11
+ zipf=zipfile.ZipFile(zip_filename, "w")
12
  for target_file in target :
13
  target_extension = os.path.splitext(target_file.name)[-1]
14
  target_name = os.path.splitext(target_file.name)[1]
 
18
  cmd1 = ["python3", "run.py", "-s", source.name, "-t", target_file.name, "-o", output_path1, "--frame-processor", "face_swapper","face_enhancer",'--many-faces']
19
  subprocess.run(cmd1)
20
  outputfile.append(output_path1)
21
+ zipf.write(output_path1)
22
 
23
+ return zip_filename
24
+
25
+ #return outputfile
26
 
27
  iface = gr.Interface(
28
  fn=run_scripts,