danielle2003 commited on
Commit
8696997
·
verified ·
1 Parent(s): 3b07360

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -30,7 +30,7 @@ main_bg = 'download (3).jfif'
30
  class_labels=[ 'Cyst', 'Normal','Stone', 'Tumor']
31
  def load_tensorflow_model():
32
  # Example: Load a pre-trained model (e.g., MobileNetV2)
33
- tf_model = tf.keras.models.load_model('model/best_model.keras')
34
  return tf_model
35
  def predict_image(image):
36
  time.sleep(2)
@@ -123,7 +123,7 @@ def predict_with_pytorch(image):
123
 
124
  def load_pytorch_model():
125
  # Example: Load a pre-trained model (e.g., ResNet18)
126
- model = torch.load('model/torch_model.pth', map_location=torch.device('cpu')) # Forces the model to load on CPU
127
 
128
  model.eval()
129
  return model
@@ -543,7 +543,7 @@ with st.container(key="content-container-3"):
543
  st.session_state.choice = "pytorch"
544
  with st.container(key="content-container-1"):
545
 
546
- image_path = "images/t.jpg"
547
  col1, col2 = st.columns([1, 9])
548
  with col1:
549
  st.write("")
 
30
  class_labels=[ 'Cyst', 'Normal','Stone', 'Tumor']
31
  def load_tensorflow_model():
32
  # Example: Load a pre-trained model (e.g., MobileNetV2)
33
+ tf_model = tf.keras.models.load_model('best_model.keras')
34
  return tf_model
35
  def predict_image(image):
36
  time.sleep(2)
 
123
 
124
  def load_pytorch_model():
125
  # Example: Load a pre-trained model (e.g., ResNet18)
126
+ model = torch.load('torch_model.pth', map_location=torch.device('cpu')) # Forces the model to load on CPU
127
 
128
  model.eval()
129
  return model
 
543
  st.session_state.choice = "pytorch"
544
  with st.container(key="content-container-1"):
545
 
546
+ image_path = "t.jpg"
547
  col1, col2 = st.columns([1, 9])
548
  with col1:
549
  st.write("")