Spaces:
Running
Running
Delete main.py
Browse files
main.py
DELETED
@@ -1,49 +0,0 @@
|
|
1 |
-
# coding=utf-8
|
2 |
-
import sys
|
3 |
-
import cv2
|
4 |
-
import argparse
|
5 |
-
import os
|
6 |
-
import sys
|
7 |
-
import subprocess
|
8 |
-
import time
|
9 |
-
|
10 |
-
from run import process
|
11 |
-
|
12 |
-
"""
|
13 |
-
main.py
|
14 |
-
|
15 |
-
How to run:
|
16 |
-
python main.py
|
17 |
-
|
18 |
-
"""
|
19 |
-
|
20 |
-
|
21 |
-
def main(inputpath, outpath, show):
|
22 |
-
if isinstance(inputpath, list):
|
23 |
-
for item in inputpath:
|
24 |
-
watermark = deep_nude_process(item)
|
25 |
-
cv2.imwrite("output_"+item, watermark)
|
26 |
-
else:
|
27 |
-
watermark = deep_nude_process(inputpath)
|
28 |
-
cv2.imwrite(outpath, watermark)
|
29 |
-
|
30 |
-
def deep_nude_process(item):
|
31 |
-
print('Processing {}'.format(item))
|
32 |
-
dress = cv2.imread(item)
|
33 |
-
h = dress.shape[0]
|
34 |
-
w = dress.shape[1]
|
35 |
-
dress = cv2.resize(dress, (512,512), interpolation=cv2.INTER_CUBIC)
|
36 |
-
watermark = process(dress)
|
37 |
-
watermark = cv2.resize(watermark, (w,h), interpolation=cv2.INTER_CUBIC)
|
38 |
-
return watermark
|
39 |
-
|
40 |
-
if __name__ == '__main__':
|
41 |
-
parser = argparse.ArgumentParser(description="simple deep nude script tool")
|
42 |
-
parser.add_argument("-i", "--input", action="store", nargs = "*", default="input.png", help = "Use to enter input one or more files's name")
|
43 |
-
parser.add_argument("-o", "--output", action="store", default="output.png", help = "Use to enter output file name")
|
44 |
-
parser.add_argument("-s", "--show", action="store", default="false", help = "Use to automatically display or not display generated images")
|
45 |
-
inputpath, outputpath, show = parser.parse_args().input, parser.parse_args().output, parser.parse_args().show
|
46 |
-
|
47 |
-
print (time.strftime("START!!!!!!!!! %Y-%m-%d %H:%M:%S", time.localtime()))
|
48 |
-
main(inputpath, outputpath, show)
|
49 |
-
print (time.strftime("FINISH!!!!!!!!! %Y-%m-%d %H:%M:%S", time.localtime()))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|