remove one imagebox
Browse files
app.py
CHANGED
@@ -1,36 +1,13 @@
|
|
1 |
-
from run import process
|
2 |
import time
|
3 |
-
import subprocess
|
4 |
-
import os
|
5 |
-
import argparse
|
6 |
import cv2
|
7 |
-
import sys
|
8 |
-
from PIL import Image
|
9 |
-
import torch
|
10 |
import gradio as gr
|
11 |
|
12 |
-
|
13 |
-
TESTdevice = "cpu"
|
14 |
-
|
15 |
index = 1
|
16 |
|
17 |
-
|
18 |
-
"""
|
19 |
-
main.py
|
20 |
-
|
21 |
-
How to run:
|
22 |
-
python main.py
|
23 |
-
|
24 |
-
"""
|
25 |
-
|
26 |
-
|
27 |
def mainTest(inputpath, outpath):
|
28 |
watermark = deep_nude_process(inputpath)
|
29 |
watermark1 = cv2.cvtColor(watermark, cv2.COLOR_BGRA2RGBA)
|
30 |
-
#cv2.imwrite(outpath, watermark1)
|
31 |
return watermark1
|
32 |
-
#
|
33 |
-
|
34 |
|
35 |
def deep_nude_process(inputpath):
|
36 |
dress = cv2.imread(inputpath)
|
@@ -41,7 +18,6 @@ def deep_nude_process(inputpath):
|
|
41 |
watermark = cv2.resize(watermark, (w, h), interpolation=cv2.INTER_CUBIC)
|
42 |
return watermark
|
43 |
|
44 |
-
|
45 |
def inference(img):
|
46 |
global index
|
47 |
bgra = cv2.cvtColor(img, cv2.COLOR_RGBA2BGRA)
|
@@ -55,7 +31,6 @@ def inference(img):
|
|
55 |
print(time.strftime("Finish!!!!!!!!! %Y-%m-%d %H:%M:%S", time.localtime()))
|
56 |
return output
|
57 |
|
58 |
-
|
59 |
title = "Undress AI"
|
60 |
description = "β Input photos of people, similar to the test picture at the bottom, and undress pictures will be produced. You may have to wait 30 seconds for a picture. π Do not upload personal photos π There is a queue system. According to the logic of first come, first served, only one picture will be made at a time. Must be able to at least see the outline of a human body β"
|
61 |
|
@@ -64,14 +39,15 @@ examples = [
|
|
64 |
['input.jpg', 'Test'],
|
65 |
]
|
66 |
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
|
|
75 |
|
76 |
if __name__ == '__main__':
|
77 |
web.launch()
|
|
|
|
|
1 |
import time
|
|
|
|
|
|
|
2 |
import cv2
|
|
|
|
|
|
|
3 |
import gradio as gr
|
4 |
|
|
|
|
|
|
|
5 |
index = 1
|
6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
def mainTest(inputpath, outpath):
|
8 |
watermark = deep_nude_process(inputpath)
|
9 |
watermark1 = cv2.cvtColor(watermark, cv2.COLOR_BGRA2RGBA)
|
|
|
10 |
return watermark1
|
|
|
|
|
11 |
|
12 |
def deep_nude_process(inputpath):
|
13 |
dress = cv2.imread(inputpath)
|
|
|
18 |
watermark = cv2.resize(watermark, (w, h), interpolation=cv2.INTER_CUBIC)
|
19 |
return watermark
|
20 |
|
|
|
21 |
def inference(img):
|
22 |
global index
|
23 |
bgra = cv2.cvtColor(img, cv2.COLOR_RGBA2BGRA)
|
|
|
31 |
print(time.strftime("Finish!!!!!!!!! %Y-%m-%d %H:%M:%S", time.localtime()))
|
32 |
return output
|
33 |
|
|
|
34 |
title = "Undress AI"
|
35 |
description = "β Input photos of people, similar to the test picture at the bottom, and undress pictures will be produced. You may have to wait 30 seconds for a picture. π Do not upload personal photos π There is a queue system. According to the logic of first come, first served, only one picture will be made at a time. Must be able to at least see the outline of a human body β"
|
36 |
|
|
|
39 |
['input.jpg', 'Test'],
|
40 |
]
|
41 |
|
42 |
+
web = gr.Interface(
|
43 |
+
fn=inference,
|
44 |
+
inputs=gr.Image(type="pil", label="Input Image"),
|
45 |
+
outputs=gr.Image(type="pil", label="Processed Image"),
|
46 |
+
title=title,
|
47 |
+
description=description,
|
48 |
+
examples=examples,
|
49 |
+
allow_flagging="never"
|
50 |
+
)
|
51 |
|
52 |
if __name__ == '__main__':
|
53 |
web.launch()
|