ZhengPeng7 commited on
Commit
d38161e
·
1 Parent(s): 8bcc400

Update the model switch part.

Browse files
Files changed (1) hide show
  1. app.py +1 -0
app.py CHANGED
@@ -47,6 +47,7 @@ birefnet.eval()
47
  @spaces.GPU
48
  def predict(image, resolution, weights_file):
49
  global weights_path
 
50
  if weights_file != weights_path:
51
  # Load BiRefNet with chosen weights
52
  birefnet = AutoModelForImageSegmentation.from_pretrained(weights_file if weights_file is not None else 'zhengpeng7/BiRefNet', trust_remote_code=True)
 
47
  @spaces.GPU
48
  def predict(image, resolution, weights_file):
49
  global weights_path
50
+ global birefnet
51
  if weights_file != weights_path:
52
  # Load BiRefNet with chosen weights
53
  birefnet = AutoModelForImageSegmentation.from_pretrained(weights_file if weights_file is not None else 'zhengpeng7/BiRefNet', trust_remote_code=True)