Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -17,7 +17,7 @@ import onnxruntime
|
|
| 17 |
import torch
|
| 18 |
from PIL import Image
|
| 19 |
sess_options = onnxruntime.SessionOptions()
|
| 20 |
-
|
| 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 =
|
| 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
|