anodev commited on
Commit
0fdeab1
·
verified ·
1 Parent(s): da9ce74

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -17,7 +17,7 @@ import onnxruntime
17
  import torch
18
  from PIL import Image
19
  sess_options = onnxruntime.SessionOptions()
20
- model = onnxruntime.InferenceSession('lama_fp32.onnx', sess_options=sess_options)
21
 
22
  # Source https://github.com/advimman/lama
23
  def get_image(image):
@@ -99,7 +99,7 @@ def predict(jpg, msk):
99
 
100
  image, mask = prepare_img_and_mask(imagex.resize((512, 512)), mask.resize((512, 512)), 'cpu')
101
  # Run the model
102
- outputs = model.run(None, {'image': image.numpy().astype(np.float32), 'mask': mask.numpy().astype(np.float32)})
103
 
104
  output = outputs[0][0]
105
  # Postprocess the outputs
 
17
  import torch
18
  from PIL import Image
19
  sess_options = onnxruntime.SessionOptions()
20
+ rmodel = onnxruntime.InferenceSession('lama_fp32.onnx', sess_options=sess_options)
21
 
22
  # Source https://github.com/advimman/lama
23
  def get_image(image):
 
99
 
100
  image, mask = prepare_img_and_mask(imagex.resize((512, 512)), mask.resize((512, 512)), 'cpu')
101
  # Run the model
102
+ outputs = rmodel.run(None, {'image': image.numpy().astype(np.float32), 'mask': mask.numpy().astype(np.float32)})
103
 
104
  output = outputs[0][0]
105
  # Postprocess the outputs