ZhengPeng7 commited on
Commit
7ccb658
1 Parent(s): de0b7d0

Upgrade the weights loading method to avoid duplicated loading.

Browse files
Files changed (1) hide show
  1. app.py +1 -0
app.py CHANGED
@@ -52,6 +52,7 @@ birefnet.eval()
52
 
53
  @spaces.GPU
54
  def predict(image, resolution, weights_file):
 
55
  if weights_file != 'General':
56
  # Load BiRefNet with chosen weights
57
  _weights_file = '/'.join(('zhengpeng7', usage_to_weights_file[weights_file] if weights_file is not None else 'BiRefNet'))
 
52
 
53
  @spaces.GPU
54
  def predict(image, resolution, weights_file):
55
+ global birefnet
56
  if weights_file != 'General':
57
  # Load BiRefNet with chosen weights
58
  _weights_file = '/'.join(('zhengpeng7', usage_to_weights_file[weights_file] if weights_file is not None else 'BiRefNet'))