Amit Gazal commited on
Commit
c167ae6
·
1 Parent(s): 6681382
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -7,6 +7,8 @@ from transformers import AutoModelForImageSegmentation
7
 
8
  model = AutoModelForImageSegmentation.from_pretrained('briaai/RMBG-2.0', trust_remote_code=True)
9
  torch.set_float32_matmul_precision(['high', 'highest'][0])
 
 
10
  model.eval()
11
 
12
  def remove_background(input_image, holiday, message):
@@ -58,8 +60,8 @@ demo = gr.Interface(
58
  gr.Image(type="pil", label="Second Output"),
59
  gr.Image(type="pil", label="Third Output")
60
  ],
61
- title="Background Removal Tool",
62
- description="Upload an image to remove its background"
63
  )
64
 
65
  demo.launch()
 
7
 
8
  model = AutoModelForImageSegmentation.from_pretrained('briaai/RMBG-2.0', trust_remote_code=True)
9
  torch.set_float32_matmul_precision(['high', 'highest'][0])
10
+ if torch.cuda.is_available():
11
+ model = model.to('cuda')
12
  model.eval()
13
 
14
  def remove_background(input_image, holiday, message):
 
60
  gr.Image(type="pil", label="Second Output"),
61
  gr.Image(type="pil", label="Third Output")
62
  ],
63
+ title="Holiday Card Generator",
64
+ description="Upload an image to generate a holiday card"
65
  )
66
 
67
  demo.launch()