KaburaJ commited on
Commit
d3d4e02
·
1 Parent(s): d34f45c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -9
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
- def load_model():
52
- # Load the model architecture
53
- with open('https://github.com/KaburaJ/Binary-Image-classification/blob/main/ZebraHorse/CNN%20Application/model.json', 'r') as f:
54
- model = model_from_json(f.read())
55
-
56
- # Load the model weights
57
- model.load_weights('https://github.com/KaburaJ/Binary-Image-classification/blob/main/ZebraHorse/CNN%20Application/model.h5')
58
- #CNN_class_index = json.load(open(f"{os.getcwd()}F:\Machine Learning Resources\ZebraHorse\model.json"))
59
- return model
 
 
 
 
 
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):