Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -13,7 +13,8 @@ torch.set_float32_matmul_precision("high")
|
|
| 13 |
birefnet = AutoModelForImageSegmentation.from_pretrained(
|
| 14 |
"ZhengPeng7/BiRefNet", trust_remote_code=True
|
| 15 |
)
|
| 16 |
-
|
|
|
|
| 17 |
|
| 18 |
# Image transformation
|
| 19 |
transform_image = transforms.Compose([
|
|
|
|
| 13 |
birefnet = AutoModelForImageSegmentation.from_pretrained(
|
| 14 |
"ZhengPeng7/BiRefNet", trust_remote_code=True
|
| 15 |
)
|
| 16 |
+
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
| 17 |
+
birefnet.to(device)
|
| 18 |
|
| 19 |
# Image transformation
|
| 20 |
transform_image = transforms.Compose([
|