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

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -3,7 +3,9 @@ import base64
3
  import streamlit as st
4
  from PIL import Image
5
  import numpy as np
6
- from keras.models import model_from_json
 
 
7
 
8
  st.markdown('<h1 style="color:white;">Image Classification App</h1>', unsafe_allow_html=True)
9
  st.markdown('<h2 style="color:white;">for classifying **zebras** and **horses**</h2>', unsafe_allow_html=True)
@@ -45,13 +47,14 @@ set_png_as_page_bg('background.webp')
45
  # #model= tf.keras.load_model('model.h5')
46
  # #CNN_class_index = json.load(open(f"{os.getcwd()}F:\Machine Learning Resources\ZebraHorse\model.json"))
47
  # return model, CNN_class_index
 
48
  def load_model():
49
  # Load the model architecture
50
- with open('model.json', 'r') as f:
51
  model = model_from_json(f.read())
52
 
53
  # Load the model weights
54
- model.load_weights('model.h5')
55
  #CNN_class_index = json.load(open(f"{os.getcwd()}F:\Machine Learning Resources\ZebraHorse\model.json"))
56
  return model
57
 
 
3
  import streamlit as st
4
  from PIL import Image
5
  import numpy as np
6
+ from keras.models import model_from_json
7
+ import subprocess
8
+
9
 
10
  st.markdown('<h1 style="color:white;">Image Classification App</h1>', unsafe_allow_html=True)
11
  st.markdown('<h2 style="color:white;">for classifying **zebras** and **horses**</h2>', unsafe_allow_html=True)
 
47
  # #model= tf.keras.load_model('model.h5')
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