Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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('
|
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('
|
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 = "
|
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("")
|