Spaces:
Runtime error
Runtime error
fix: update ONNX model cache handling in inference functions
Browse files
app.py
CHANGED
|
@@ -93,7 +93,7 @@ _onnx_model_cache = {}
|
|
| 93 |
|
| 94 |
def infer_onnx_model(hf_model_id, preprocessed_image_np, model_config: dict):
|
| 95 |
try:
|
| 96 |
-
ort_session, _, _ = get_onnx_model_from_cache(hf_model_id)
|
| 97 |
|
| 98 |
# Debug: Print expected input shape from ONNX model
|
| 99 |
for input_meta in ort_session.get_inputs():
|
|
@@ -134,7 +134,9 @@ class ONNXModelWrapper:
|
|
| 134 |
|
| 135 |
def load(self):
|
| 136 |
if self._session is None:
|
| 137 |
-
self._session, self._preprocessor_config, self._model_config = get_onnx_model_from_cache(
|
|
|
|
|
|
|
| 138 |
logger.info(f"ONNX model {self.hf_model_id} loaded into wrapper.")
|
| 139 |
|
| 140 |
def __call__(self, image_np):
|
|
|
|
| 93 |
|
| 94 |
def infer_onnx_model(hf_model_id, preprocessed_image_np, model_config: dict):
|
| 95 |
try:
|
| 96 |
+
ort_session, _, _ = get_onnx_model_from_cache(hf_model_id, _onnx_model_cache, load_onnx_model_and_preprocessor)
|
| 97 |
|
| 98 |
# Debug: Print expected input shape from ONNX model
|
| 99 |
for input_meta in ort_session.get_inputs():
|
|
|
|
| 134 |
|
| 135 |
def load(self):
|
| 136 |
if self._session is None:
|
| 137 |
+
self._session, self._preprocessor_config, self._model_config = get_onnx_model_from_cache(
|
| 138 |
+
self.hf_model_id, _onnx_model_cache, load_onnx_model_and_preprocessor
|
| 139 |
+
)
|
| 140 |
logger.info(f"ONNX model {self.hf_model_id} loaded into wrapper.")
|
| 141 |
|
| 142 |
def __call__(self, image_np):
|