nsfwalex commited on
Commit
71be84f
β€’
1 Parent(s): 00af50b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -3
app.py CHANGED
@@ -1,9 +1,16 @@
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)
@@ -20,16 +27,17 @@ def deep_nude_process(inputpath):
20
 
21
  def inference(img):
22
  global index
 
23
  bgra = cv2.cvtColor(img, cv2.COLOR_RGBA2BGRA)
24
- inputpath = "input_" + str(index) + ".jpg"
25
  cv2.imwrite(inputpath, bgra)
26
 
27
- outputpath = "out_" + str(index) + ".jpg"
28
  index += 1
29
  print(time.strftime("START!!!!!!!!! %Y-%m-%d %H:%M:%S", time.localtime()))
30
  output = mainTest(inputpath, outputpath)
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 β›”"
 
1
  import time
2
  import cv2
3
+ import numpy as np
4
  import gradio as gr
5
+ from PIL import Image
6
 
7
  index = 1
8
 
9
+ def process(dress):
10
+ # Dummy processing function for demonstration
11
+ # Replace with your actual processing logic
12
+ return cv2.GaussianBlur(dress, (15, 15), 0)
13
+
14
  def mainTest(inputpath, outpath):
15
  watermark = deep_nude_process(inputpath)
16
  watermark1 = cv2.cvtColor(watermark, cv2.COLOR_BGRA2RGBA)
 
27
 
28
  def inference(img):
29
  global index
30
+ img = np.array(img) # Convert PIL image to NumPy array
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()))
38
  output = mainTest(inputpath, outputpath)
39
  print(time.strftime("Finish!!!!!!!!! %Y-%m-%d %H:%M:%S", time.localtime()))
40
+ return Image.fromarray(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 β›”"