Kalbe-x-Bangkit commited on
Commit
3343b08
·
verified ·
1 Parent(s): 0721e3e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -16
app.py CHANGED
@@ -36,7 +36,6 @@ enhancement_type = st.sidebar.selectbox(
36
  H = 224
37
  W = 224
38
 
39
- @st.cache_resource
40
  def load_model():
41
  model = tf.keras.models.load_model("model-detection.h5", compile=False)
42
  model.compile(
@@ -76,20 +75,8 @@ model = load_model()
76
  # st.image(image, caption='Uploaded Image.', use_column_width=True)
77
 
78
 
79
- @st.cache_resource
80
  def load_gradcam_model():
81
- model = keras.models.load_model('./model_renamed.h5', compile=False)
82
- model.compile(
83
- loss={
84
- "bbox": "mse",
85
- "class": "sparse_categorical_crossentropy"
86
- },
87
- optimizer=tf.keras.optimizers.Adam(),
88
- metrics={
89
- "bbox": ['mse'],
90
- "class": ['accuracy']
91
- }
92
- )
93
  return model
94
 
95
 
@@ -511,8 +498,7 @@ if uploaded_file is not None:
511
 
512
  with col3:
513
  if st.button('Generate Grad-CAM'):
514
- with st.spinner("Loading Model...."):
515
- model=load_gradcam_model()
516
  # Compute and show Grad-CAM
517
  st.write("Generating Grad-CAM visualizations")
518
  try:
 
36
  H = 224
37
  W = 224
38
 
 
39
  def load_model():
40
  model = tf.keras.models.load_model("model-detection.h5", compile=False)
41
  model.compile(
 
75
  # st.image(image, caption='Uploaded Image.', use_column_width=True)
76
 
77
 
 
78
  def load_gradcam_model():
79
+ model = keras.models.load_model('./model_renamed.h5')
 
 
 
 
 
 
 
 
 
 
 
80
  return model
81
 
82
 
 
498
 
499
  with col3:
500
  if st.button('Generate Grad-CAM'):
501
+ model=load_gradcam_model()
 
502
  # Compute and show Grad-CAM
503
  st.write("Generating Grad-CAM visualizations")
504
  try: