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