Spaces:
Build error
Build error
Commit
·
66fad2f
1
Parent(s):
fbe03e2
Add weights option to BiRefNet trained in all different settings.
Browse files
app.py
CHANGED
|
@@ -57,7 +57,9 @@ def predict(image, resolution, weights_file):
|
|
| 57 |
global birefnet
|
| 58 |
if weights_file != weights_path:
|
| 59 |
# Load BiRefNet with chosen weights
|
| 60 |
-
|
|
|
|
|
|
|
| 61 |
birefnet.to(device)
|
| 62 |
birefnet.eval()
|
| 63 |
weights_path = weights_file
|
|
|
|
| 57 |
global birefnet
|
| 58 |
if weights_file != weights_path:
|
| 59 |
# Load BiRefNet with chosen weights
|
| 60 |
+
_weights_file = '/'.join(('zhengpeng7', usage_to_weights_file[weights_file] if weights_file is not None else 'BiRefNet'))
|
| 61 |
+
print('Change weights to:', _weights_file)
|
| 62 |
+
birefnet = AutoModelForImageSegmentation.from_pretrained(_weights_file, trust_remote_code=True)
|
| 63 |
birefnet.to(device)
|
| 64 |
birefnet.eval()
|
| 65 |
weights_path = weights_file
|