nsfwalex commited on
Commit
ee7f7d6
β€’
1 Parent(s): 1d4176a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +29 -41
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
- def update_status(img):
41
- return inference(img), gr.update(value="Processing complete!")
 
 
 
 
 
42
 
43
- def init_interface(request: gr.Request):
44
- query_params = request.query_params
45
- bg_color = query_params.get('bg_color', 'rgb(17, 24, 39)')
46
- image_height = query_params.get('image_height', '90%')
47
- css = f"""
48
- body {{
49
- background-color: {bg_color};
50
- color: white;
51
- overflow: hidden;
52
- }}
53
- .gradio-container {{
54
- background-color: {bg_color} !important;
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
- with gr.Blocks(css=css) as demo:
73
- with gr.Column():
74
- with gr.Row(elem_id="image-container"):
75
- image_input = gr.Image(type="numpy", label="Upload Image")
76
- process_button = gr.Button("Process Image")
77
 
78
- process_button.click(update_status, inputs=image_input, outputs=[image_input])
79
-
80
- return demo
81
 
82
- with gr.Blocks() as outer_demo:
83
- outer_demo.load(init_interface)
84
 
85
- outer_demo.launch()
 
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()