crytion commited on
Commit
fcaff26
1 Parent(s): ee2fbc8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -8
app.py CHANGED
@@ -26,15 +26,16 @@ main.py
26
 
27
  def mainTest(inputpath, outpath):
28
  watermark = deep_nude_process(inputpath)
29
- #cv2.imwrite(outpath, watermark)
 
30
  return watermark
31
  #
32
 
33
 
34
  def deep_nude_process(item):
35
  # print('Processing {}'.format(item))
36
- # dress = cv2.imread(item)
37
- dress = (item)
38
  h = dress.shape[0]
39
  w = dress.shape[1]
40
  dress = cv2.resize(dress, (512, 512), interpolation=cv2.INTER_CUBIC)
@@ -45,13 +46,15 @@ def deep_nude_process(item):
45
 
46
  def inference(img):
47
  global index
48
- # inputpath = "input/" + str(index) + ".jpg"
 
 
 
49
  outputpath = "out_" + str(index) + ".jpg"
50
- # cv2.imwrite(inputpath, img)
51
  index += 1
52
- print(time.strftime("开始时间!!!!!!!!! %Y-%m-%d %H:%M:%S", time.localtime()))
53
- output = mainTest(img, outputpath)
54
- print(time.strftime("完成时间!!!!!!!!! %Y-%m-%d %H:%M:%S", time.localtime()))
55
  return output
56
 
57
 
 
26
 
27
  def mainTest(inputpath, outpath):
28
  watermark = deep_nude_process(inputpath)
29
+ watermark1 = cv2.cvtColor(watermark, cv2.COLOR_RGBA2BGRA)
30
+ cv2.imwrite(outpath, watermark1)
31
  return watermark
32
  #
33
 
34
 
35
  def deep_nude_process(item):
36
  # print('Processing {}'.format(item))
37
+ dress = cv2.imread(item)
38
+ dress = cv2.cvtColor(dress, cv2.COLOR_BGRA2RGBA)
39
  h = dress.shape[0]
40
  w = dress.shape[1]
41
  dress = cv2.resize(dress, (512, 512), interpolation=cv2.INTER_CUBIC)
 
46
 
47
  def inference(img):
48
  global index
49
+ bgra = cv2.cvtColor(img, cv2.COLOR_RGBA2BGRA)
50
+ inputpath = "input_" + str(index) + ".jpg"
51
+ cv2.imwrite(inputpath, bgra)
52
+
53
  outputpath = "out_" + str(index) + ".jpg"
 
54
  index += 1
55
+ print(time.strftime("开始!!!!!!!!! %Y-%m-%d %H:%M:%S", time.localtime()))
56
+ output = mainTest(inputpath, outputpath)
57
+ print(time.strftime("结束!!!!!!!!! %Y-%m-%d %H:%M:%S", time.localtime()))
58
  return output
59
 
60