Saad0KH commited on
Commit
3a6ca62
Β·
verified Β·
1 Parent(s): 89085bd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -74,14 +74,14 @@ def encode_image_to_base64(image):
74
  image.save(buffered, format="PNG") # Use PNG for compatibility with RGBA
75
  return base64.b64encode(buffered.getvalue()).decode('utf-8')
76
 
77
- @spaces.GPU
78
  def rm_background(image):
79
  im = load_img(image, output_type="pil")
80
  im = im.convert("RGB")
81
  image_size = im.size
82
  origin = im.copy()
83
  image = load_img(im)
84
- input_images = transform_image(image).unsqueeze(0).to("cuda")
85
  # Prediction
86
  with torch.no_grad():
87
  preds = birefnet(input_images)[-1].sigmoid().cpu()
 
74
  image.save(buffered, format="PNG") # Use PNG for compatibility with RGBA
75
  return base64.b64encode(buffered.getvalue()).decode('utf-8')
76
 
77
+ # @spaces.GPU
78
  def rm_background(image):
79
  im = load_img(image, output_type="pil")
80
  im = im.convert("RGB")
81
  image_size = im.size
82
  origin = im.copy()
83
  image = load_img(im)
84
+ input_images = transform_image(image).unsqueeze(0).to("cpu")
85
  # Prediction
86
  with torch.no_grad():
87
  preds = birefnet(input_images)[-1].sigmoid().cpu()