Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -50,21 +50,22 @@ set_png_as_page_bg('background.webp')
|
|
| 50 |
# #CNN_class_index = json.load(open(f"{os.getcwd()}F:\Machine Learning Resources\ZebraHorse\model.json"))
|
| 51 |
# return model, CNN_class_index
|
| 52 |
|
| 53 |
-
def load_model():
|
| 54 |
-
if not os.path.isfile('model.h5'):
|
| 55 |
-
subprocess.run(['curl --output model.h5 "https://github.com/KaburaJ/Binary-Image-classification/blob/main/ZebraHorse/CNN%20Application/model.h5"'], shell=True)
|
| 56 |
-
|
| 57 |
-
tf.keras.models.load_model('model.h5', compile=False)
|
| 58 |
-
return model
|
| 59 |
# def load_model():
|
| 60 |
-
#
|
| 61 |
-
#
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
#
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 68 |
|
| 69 |
|
| 70 |
def image_transformation(image):
|
|
|
|
| 50 |
# #CNN_class_index = json.load(open(f"{os.getcwd()}F:\Machine Learning Resources\ZebraHorse\model.json"))
|
| 51 |
# return model, CNN_class_index
|
| 52 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 53 |
# def load_model():
|
| 54 |
+
# if not os.path.isfile('model.h5'):
|
| 55 |
+
# subprocess.run(['curl --output model.h5 "https://github.com/KaburaJ/Binary-Image-classification/blob/main/ZebraHorse/CNN%20Application/model.h5"'], shell=True)
|
| 56 |
+
|
| 57 |
+
# tf.keras.models.load_model('model.h5', compile=False)
|
| 58 |
+
# return model
|
| 59 |
+
|
| 60 |
+
def load_model():
|
| 61 |
+
# Load the model architecture
|
| 62 |
+
with open('model.json', 'r') as f:
|
| 63 |
+
model_from_json(f.read())
|
| 64 |
+
|
| 65 |
+
# Load the model weights
|
| 66 |
+
model.load_weights('model.h5')
|
| 67 |
+
#CNN_class_index = json.load(open(f"{os.getcwd()}F:\Machine Learning Resources\ZebraHorse\model.json"))
|
| 68 |
+
return model
|
| 69 |
|
| 70 |
|
| 71 |
def image_transformation(image):
|