Saad0KH commited on
Commit
7ca1694
Β·
verified Β·
1 Parent(s): 739eb5d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -0
app.py CHANGED
@@ -46,6 +46,7 @@ def save_image(img):
46
  img.save(unique_name)
47
  return unique_name
48
 
 
49
  def rm_background(image):
50
  im = load_img(image, output_type="pil")
51
  im = im.convert("RGB")
@@ -62,6 +63,7 @@ def rm_background(image):
62
  image.putalpha(mask)
63
  return image
64
 
 
65
  def detect_and_segment_persons(image, clothes):
66
  img = np.array(image)
67
  img = img[:, :, ::-1] # RGB -> BGR
@@ -93,6 +95,7 @@ def detect_and_segment_persons(image, clothes):
93
 
94
  return all_segmented_images
95
 
 
96
  def process_image(input_image):
97
  try:
98
  clothes = ["Upper-clothes", "Skirt", "Pants", "Dress"]
 
46
  img.save(unique_name)
47
  return unique_name
48
 
49
+ @spaces.GPU
50
  def rm_background(image):
51
  im = load_img(image, output_type="pil")
52
  im = im.convert("RGB")
 
63
  image.putalpha(mask)
64
  return image
65
 
66
+ @spaces.GPU
67
  def detect_and_segment_persons(image, clothes):
68
  img = np.array(image)
69
  img = img[:, :, ::-1] # RGB -> BGR
 
95
 
96
  return all_segmented_images
97
 
98
+ @spaces.GPU
99
  def process_image(input_image):
100
  try:
101
  clothes = ["Upper-clothes", "Skirt", "Pants", "Dress"]