Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -8,7 +8,7 @@ class ONNXModel:
|
|
8 |
def __init__(self, dir_path) -> None:
|
9 |
"""Method to get name of model file. Assumes model is in the parent directory for script."""
|
10 |
model_dir = os.path.dirname(dir_path)
|
11 |
-
with open(os.path.join(model_dir, "
|
12 |
self.signature = json.load(f)
|
13 |
self.model_file = os.path.join(model_dir, self.signature.get("filename"))
|
14 |
if not os.path.isfile(self.model_file):
|
@@ -88,7 +88,7 @@ class ONNXModel:
|
|
88 |
sorted_output = {"predictions": sorted(output, key=lambda k: k["confidence"], reverse=True)}
|
89 |
return sorted_output
|
90 |
EXPORT_MODEL_VERSION=1
|
91 |
-
model = ONNXModel(dir_path="
|
92 |
model.load()
|
93 |
|
94 |
def predict(image):
|
|
|
8 |
def __init__(self, dir_path) -> None:
|
9 |
"""Method to get name of model file. Assumes model is in the parent directory for script."""
|
10 |
model_dir = os.path.dirname(dir_path)
|
11 |
+
with open(os.path.join(model_dir, "signature.json"), "r") as f:
|
12 |
self.signature = json.load(f)
|
13 |
self.model_file = os.path.join(model_dir, self.signature.get("filename"))
|
14 |
if not os.path.isfile(self.model_file):
|
|
|
88 |
sorted_output = {"predictions": sorted(output, key=lambda k: k["confidence"], reverse=True)}
|
89 |
return sorted_output
|
90 |
EXPORT_MODEL_VERSION=1
|
91 |
+
model = ONNXModel(dir_path="model.onnx")
|
92 |
model.load()
|
93 |
|
94 |
def predict(image):
|