Spaces:
Build error
Build error
initial commit
Browse files- app.py +4 -1
- requirements.txt +1 -1
app.py
CHANGED
|
@@ -21,7 +21,10 @@ def post_process(img: np.array) -> np.array:
|
|
| 21 |
|
| 22 |
|
| 23 |
def inference(model_path: str, img_array: np.array) -> np.array:
|
| 24 |
-
|
|
|
|
|
|
|
|
|
|
| 25 |
ort_inputs = {ort_session.get_inputs()[0].name: img_array}
|
| 26 |
ort_outs = ort_session.run(None, ort_inputs)
|
| 27 |
|
|
|
|
| 21 |
|
| 22 |
|
| 23 |
def inference(model_path: str, img_array: np.array) -> np.array:
|
| 24 |
+
options = onnxruntime.SessionOptions()
|
| 25 |
+
options.intra_op_num_threads = 1
|
| 26 |
+
options.inter_op_num_threads = 1
|
| 27 |
+
ort_session = onnxruntime.InferenceSession(model_path, options)
|
| 28 |
ort_inputs = {ort_session.get_inputs()[0].name: img_array}
|
| 29 |
ort_outs = ort_session.run(None, ort_inputs)
|
| 30 |
|
requirements.txt
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
numpy
|
| 2 |
-
onnxruntime
|
| 3 |
opencv-python-headless
|
|
|
|
| 1 |
numpy
|
| 2 |
+
onnxruntime
|
| 3 |
opencv-python-headless
|