Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -1,3 +1,4 @@
|
|
|
|
1 |
import time
|
2 |
import subprocess
|
3 |
import os
|
@@ -30,6 +31,7 @@ def inference(img):
|
|
30 |
bgra = cv2.cvtColor(img, cv2.COLOR_RGBA2BGRA)
|
31 |
inputpath = f"input_{index}.jpg"
|
32 |
cv2.imwrite(inputpath, bgra)
|
|
|
33 |
outputpath = f"out_{index}.jpg"
|
34 |
index += 1
|
35 |
print(time.strftime("START!!!!!!!!! %Y-%m-%d %H:%M:%S", time.localtime()))
|
@@ -37,49 +39,35 @@ def inference(img):
|
|
37 |
print(time.strftime("Finish!!!!!!!!! %Y-%m-%d %H:%M:%S", time.localtime()))
|
38 |
return output
|
39 |
|
40 |
-
|
41 |
-
|
|
|
|
|
|
|
|
|
|
|
42 |
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
border: none !important;
|
56 |
-
}}
|
57 |
-
.image-container {{
|
58 |
-
height: {image_height} !important;
|
59 |
-
display: flex;
|
60 |
-
align-items: center;
|
61 |
-
justify-content: center;
|
62 |
-
}}
|
63 |
-
.image-container img {{
|
64 |
-
width: auto !important;
|
65 |
-
height: 100% !important;
|
66 |
-
}}
|
67 |
-
footer {{
|
68 |
-
display: none !important;
|
69 |
-
}}
|
70 |
-
"""
|
71 |
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
process_button = gr.Button("Process Image")
|
77 |
|
78 |
-
|
79 |
-
|
80 |
-
return demo
|
81 |
|
82 |
-
|
83 |
-
outer_demo.load(init_interface)
|
84 |
|
85 |
-
|
|
|
1 |
+
from run import process
|
2 |
import time
|
3 |
import subprocess
|
4 |
import os
|
|
|
31 |
bgra = cv2.cvtColor(img, cv2.COLOR_RGBA2BGRA)
|
32 |
inputpath = f"input_{index}.jpg"
|
33 |
cv2.imwrite(inputpath, bgra)
|
34 |
+
|
35 |
outputpath = f"out_{index}.jpg"
|
36 |
index += 1
|
37 |
print(time.strftime("START!!!!!!!!! %Y-%m-%d %H:%M:%S", time.localtime()))
|
|
|
39 |
print(time.strftime("Finish!!!!!!!!! %Y-%m-%d %H:%M:%S", time.localtime()))
|
40 |
return output
|
41 |
|
42 |
+
title = "Undress AI"
|
43 |
+
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 β"
|
44 |
+
|
45 |
+
examples = [
|
46 |
+
['input.png', 'Test'],
|
47 |
+
['input.jpg', 'Test'],
|
48 |
+
]
|
49 |
|
50 |
+
css = """
|
51 |
+
body {
|
52 |
+
background-color: rgb(17, 24, 39);
|
53 |
+
color: white;
|
54 |
+
overflow: hidden; /* Prevent scrolling */
|
55 |
+
}
|
56 |
+
.gradio-container {
|
57 |
+
background-color: rgb(17, 24, 39) !important;
|
58 |
+
border: none !important;
|
59 |
+
}
|
60 |
+
footer {display: none !important;} /* Hide footer */
|
61 |
+
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
|
63 |
+
with gr.Blocks(css=css) as demo:
|
64 |
+
with gr.Column():
|
65 |
+
image_input = gr.Image(type="numpy", label="Upload Image")
|
66 |
+
process_button = gr.Button("Process Image")
|
|
|
67 |
|
68 |
+
def update_status(img):
|
69 |
+
return inference(img), gr.update(value="Processing complete!")
|
|
|
70 |
|
71 |
+
process_button.click(update_status, inputs=image_input, outputs=[image_input])
|
|
|
72 |
|
73 |
+
demo.launch()
|