Spaces:
Runtime error
Runtime error
Commit ·
23c48ea
1
Parent(s): 703a7f7
Update app.py
Browse files
app.py
CHANGED
|
@@ -11,7 +11,6 @@ keras.utils.get_custom_objects()['recall'] = utils.recall
|
|
| 11 |
keras.utils.get_custom_objects()['precision'] = utils.precision
|
| 12 |
keras.utils.get_custom_objects()['f1'] = utils.f1
|
| 13 |
|
| 14 |
-
|
| 15 |
def teachable_machine_classification(img=None, model=None):
|
| 16 |
"""Performs inference on image uploaded"""
|
| 17 |
|
|
@@ -34,7 +33,7 @@ def teachable_machine_classification(img=None, model=None):
|
|
| 34 |
# run the inference
|
| 35 |
prediction = model.predict(data)
|
| 36 |
|
| 37 |
-
|
| 38 |
return prediction[0][
|
| 39 |
1
|
| 40 |
] # np.argmax(prediction) # return position of the highest probability
|
|
@@ -54,7 +53,7 @@ def load_model(weights_file=None):
|
|
| 54 |
model = keras.models.load_model(
|
| 55 |
weights_file, custom_objects=dependencies, compile=False
|
| 56 |
)
|
| 57 |
-
|
| 58 |
return model
|
| 59 |
except Exception as e:
|
| 60 |
logging.error("ERROR: ", e)
|
|
|
|
| 11 |
keras.utils.get_custom_objects()['precision'] = utils.precision
|
| 12 |
keras.utils.get_custom_objects()['f1'] = utils.f1
|
| 13 |
|
|
|
|
| 14 |
def teachable_machine_classification(img=None, model=None):
|
| 15 |
"""Performs inference on image uploaded"""
|
| 16 |
|
|
|
|
| 33 |
# run the inference
|
| 34 |
prediction = model.predict(data)
|
| 35 |
|
| 36 |
+
logging.info("Prediction", prediction)
|
| 37 |
return prediction[0][
|
| 38 |
1
|
| 39 |
] # np.argmax(prediction) # return position of the highest probability
|
|
|
|
| 53 |
model = keras.models.load_model(
|
| 54 |
weights_file, custom_objects=dependencies, compile=False
|
| 55 |
)
|
| 56 |
+
logging.info("Model successfully loaded.")
|
| 57 |
return model
|
| 58 |
except Exception as e:
|
| 59 |
logging.error("ERROR: ", e)
|