Upload 5 files
Browse files- app.py +225 -0
- data.json +39 -0
- model.h5 +3 -0
- requirements.txt +6 -0
- temp.py +100 -0
app.py
ADDED
|
@@ -0,0 +1,225 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import json
|
| 2 |
+
import streamlit as st
|
| 3 |
+
from streamlit import session_state
|
| 4 |
+
import os
|
| 5 |
+
import numpy as np
|
| 6 |
+
|
| 7 |
+
import tensorflow as tf
|
| 8 |
+
from tensorflow import keras
|
| 9 |
+
from tensorflow.keras.callbacks import EarlyStopping, ReduceLROnPlateau
|
| 10 |
+
from tensorflow.keras.layers import Activation, Input, Conv2D, MaxPooling2D, BatchNormalization, Conv2DTranspose, concatenate
|
| 11 |
+
from tensorflow.keras.models import Model, load_model
|
| 12 |
+
from sklearn.model_selection import train_test_split
|
| 13 |
+
from tensorflow.keras.models import Model, load_model
|
| 14 |
+
import matplotlib.pyplot as plt
|
| 15 |
+
import mpld3
|
| 16 |
+
import streamlit.components.v1 as components
|
| 17 |
+
import matplotlib.pyplot as plt
|
| 18 |
+
import warnings
|
| 19 |
+
from temp import model
|
| 20 |
+
warnings.filterwarnings('ignore')
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
session_state = st.session_state
|
| 24 |
+
if "user_index" not in st.session_state:
|
| 25 |
+
st.session_state["user_index"] = 0
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
def signup(json_file_path="data.json"):
|
| 29 |
+
st.title("Signup Page")
|
| 30 |
+
with st.form("signup_form"):
|
| 31 |
+
st.write("Fill in the details below to create an account:")
|
| 32 |
+
name = st.text_input("Name:")
|
| 33 |
+
email = st.text_input("Email:")
|
| 34 |
+
age = st.number_input("Age:", min_value=0, max_value=120)
|
| 35 |
+
sex = st.radio("Sex:", ("Male", "Female", "Other"))
|
| 36 |
+
password = st.text_input("Password:", type="password")
|
| 37 |
+
confirm_password = st.text_input("Confirm Password:", type="password")
|
| 38 |
+
|
| 39 |
+
if st.form_submit_button("Signup"):
|
| 40 |
+
if password == confirm_password:
|
| 41 |
+
user = create_account(name, email, age, sex, password, json_file_path)
|
| 42 |
+
session_state["logged_in"] = True
|
| 43 |
+
session_state["user_info"] = user
|
| 44 |
+
else:
|
| 45 |
+
st.error("Passwords do not match. Please try again.")
|
| 46 |
+
def display_image(image, title='Image'):
|
| 47 |
+
plt.figure(figsize=(6, 6))
|
| 48 |
+
plt.title(title)
|
| 49 |
+
|
| 50 |
+
# Check if the image is a TensorFlow tensor
|
| 51 |
+
if isinstance(image, tf.Tensor):
|
| 52 |
+
# Convert to NumPy array
|
| 53 |
+
image = image.numpy()
|
| 54 |
+
|
| 55 |
+
# Squeeze the image to remove single-dimensional entries from the shape
|
| 56 |
+
image = np.squeeze(image)
|
| 57 |
+
|
| 58 |
+
# Display the image
|
| 59 |
+
plt.imshow(image, cmap='gray' if image.ndim == 2 else None)
|
| 60 |
+
plt.axis('off')
|
| 61 |
+
plt.show()
|
| 62 |
+
def check_login(username, password, json_file_path="data.json"):
|
| 63 |
+
try:
|
| 64 |
+
with open(json_file_path, "r") as json_file:
|
| 65 |
+
data = json.load(json_file)
|
| 66 |
+
|
| 67 |
+
for user in data["users"]:
|
| 68 |
+
if user["email"] == username and user["password"] == password:
|
| 69 |
+
session_state["logged_in"] = True
|
| 70 |
+
session_state["user_info"] = user
|
| 71 |
+
st.success("Login successful!")
|
| 72 |
+
return user
|
| 73 |
+
|
| 74 |
+
st.error("Invalid credentials. Please try again.")
|
| 75 |
+
return None
|
| 76 |
+
except Exception as e:
|
| 77 |
+
st.error(f"Error checking login: {e}")
|
| 78 |
+
return None
|
| 79 |
+
|
| 80 |
+
|
| 81 |
+
def predict(uploaded_file):
|
| 82 |
+
model = load_model('model.h5')
|
| 83 |
+
bytes_data = uploaded_file.read()
|
| 84 |
+
image = tf.io.decode_image(bytes_data, channels=3)
|
| 85 |
+
image = tf.image.resize(image, (256, 256))
|
| 86 |
+
image = tf.cast(image, tf.float32) / 255.0
|
| 87 |
+
|
| 88 |
+
# Expand dimensions to simulate batch size of 1
|
| 89 |
+
image = tf.expand_dims(image, axis=0)
|
| 90 |
+
|
| 91 |
+
# Perform prediction
|
| 92 |
+
pred_mask = model.predict(image)
|
| 93 |
+
pred_mask = tf.argmax(pred_mask, axis=-1)
|
| 94 |
+
pred_mask = tf.expand_dims(pred_mask, axis=-1)
|
| 95 |
+
return pred_mask
|
| 96 |
+
|
| 97 |
+
|
| 98 |
+
def initialize_database(json_file_path="data.json"):
|
| 99 |
+
try:
|
| 100 |
+
# Check if JSON file exists
|
| 101 |
+
if not os.path.exists(json_file_path):
|
| 102 |
+
# Create an empty JSON structure
|
| 103 |
+
data = {"users": []}
|
| 104 |
+
with open(json_file_path, "w") as json_file:
|
| 105 |
+
json.dump(data, json_file)
|
| 106 |
+
except Exception as e:
|
| 107 |
+
print(f"Error initializing database: {e}")
|
| 108 |
+
|
| 109 |
+
|
| 110 |
+
def login(json_file_path="data.json"):
|
| 111 |
+
st.title("Login Page")
|
| 112 |
+
username = st.text_input("Username:")
|
| 113 |
+
password = st.text_input("Password:", type="password")
|
| 114 |
+
|
| 115 |
+
login_button = st.button("Login")
|
| 116 |
+
|
| 117 |
+
if login_button:
|
| 118 |
+
user = check_login(username, password, json_file_path)
|
| 119 |
+
if user is not None:
|
| 120 |
+
session_state["logged_in"] = True
|
| 121 |
+
session_state["user_info"] = user
|
| 122 |
+
else:
|
| 123 |
+
st.error("Invalid credentials. Please try again.")
|
| 124 |
+
|
| 125 |
+
def get_user_info(email, json_file_path="data.json"):
|
| 126 |
+
try:
|
| 127 |
+
with open(json_file_path, "r") as json_file:
|
| 128 |
+
data = json.load(json_file)
|
| 129 |
+
for user in data["users"]:
|
| 130 |
+
if user["email"] == email:
|
| 131 |
+
return user
|
| 132 |
+
return None
|
| 133 |
+
except Exception as e:
|
| 134 |
+
st.error(f"Error getting user information: {e}")
|
| 135 |
+
return None
|
| 136 |
+
|
| 137 |
+
|
| 138 |
+
def render_dashboard(user_info, json_file_path="data.json"):
|
| 139 |
+
try:
|
| 140 |
+
st.title(f"Welcome to the Dashboard, {user_info['name']}!")
|
| 141 |
+
st.subheader("User Information:")
|
| 142 |
+
st.write(f"Name: {user_info['name']}")
|
| 143 |
+
st.write(f"Sex: {user_info['sex']}")
|
| 144 |
+
st.write(f"Age: {user_info['age']}")
|
| 145 |
+
except Exception as e:
|
| 146 |
+
st.error(f"Error rendering dashboard: {e}")
|
| 147 |
+
def create_account(name, email, age, sex, password, json_file_path="data.json"):
|
| 148 |
+
try:
|
| 149 |
+
# Check if the JSON file exists or is empty
|
| 150 |
+
if not os.path.exists(json_file_path) or os.stat(json_file_path).st_size == 0:
|
| 151 |
+
data = {"users": []}
|
| 152 |
+
else:
|
| 153 |
+
with open(json_file_path, "r") as json_file:
|
| 154 |
+
data = json.load(json_file)
|
| 155 |
+
|
| 156 |
+
# Append new user data to the JSON structure
|
| 157 |
+
user_info = {
|
| 158 |
+
"name": name,
|
| 159 |
+
"email": email,
|
| 160 |
+
"age": age,
|
| 161 |
+
"sex": sex,
|
| 162 |
+
"password": password,
|
| 163 |
+
|
| 164 |
+
}
|
| 165 |
+
data["users"].append(user_info)
|
| 166 |
+
|
| 167 |
+
# Save the updated data to JSON
|
| 168 |
+
with open(json_file_path, "w") as json_file:
|
| 169 |
+
json.dump(data, json_file, indent=4)
|
| 170 |
+
|
| 171 |
+
st.success("Account created successfully! You can now login.")
|
| 172 |
+
return user_info
|
| 173 |
+
except json.JSONDecodeError as e:
|
| 174 |
+
st.error(f"Error decoding JSON: {e}")
|
| 175 |
+
return None
|
| 176 |
+
except Exception as e:
|
| 177 |
+
st.error(f"Error creating account: {e}")
|
| 178 |
+
return None
|
| 179 |
+
|
| 180 |
+
|
| 181 |
+
def main(json_file_path="data.json"):
|
| 182 |
+
st.sidebar.title("Real-time image segmentation for self-driving cars")
|
| 183 |
+
page = st.sidebar.radio(
|
| 184 |
+
"Go to",
|
| 185 |
+
("Signup/Login", "Dashboard", "Upload Image"),
|
| 186 |
+
key="Real-time image segmentation for self-driving cars",
|
| 187 |
+
)
|
| 188 |
+
|
| 189 |
+
if page == "Signup/Login":
|
| 190 |
+
st.title("Signup/Login Page")
|
| 191 |
+
login_or_signup = st.radio(
|
| 192 |
+
"Select an option", ("Login", "Signup"), key="login_signup"
|
| 193 |
+
)
|
| 194 |
+
if login_or_signup == "Login":
|
| 195 |
+
login(json_file_path)
|
| 196 |
+
else:
|
| 197 |
+
signup(json_file_path)
|
| 198 |
+
|
| 199 |
+
elif page == "Dashboard":
|
| 200 |
+
if session_state.get("logged_in"):
|
| 201 |
+
render_dashboard(session_state["user_info"])
|
| 202 |
+
else:
|
| 203 |
+
st.warning("Please login/signup to view the dashboard.")
|
| 204 |
+
|
| 205 |
+
elif page == "Upload Image":
|
| 206 |
+
if session_state.get("logged_in"):
|
| 207 |
+
st.title("Upload Image")
|
| 208 |
+
uploaded_image = st.file_uploader(
|
| 209 |
+
"Choose a image (PNG)", type=["png"]
|
| 210 |
+
)
|
| 211 |
+
if st.button("Upload") and uploaded_image is not None:
|
| 212 |
+
st.image(uploaded_image, use_container_width =True)
|
| 213 |
+
st.success("Image uploaded successfully!")
|
| 214 |
+
image = predict(uploaded_image)[0]
|
| 215 |
+
img = tf.keras.preprocessing.image.array_to_img(image.numpy())
|
| 216 |
+
fig, ax = plt.subplots()
|
| 217 |
+
ax.imshow(img)
|
| 218 |
+
ax.axis('off')
|
| 219 |
+
ax.set_title('Predicted Image')
|
| 220 |
+
print(type(img))
|
| 221 |
+
st.pyplot(fig)
|
| 222 |
+
|
| 223 |
+
if __name__ == "__main__":
|
| 224 |
+
initialize_database()
|
| 225 |
+
main()
|
data.json
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"users": [
|
| 3 |
+
{
|
| 4 |
+
"name": "Shreyansh",
|
| 5 |
+
"email": "Shreyansh@mail.com",
|
| 6 |
+
"age": 22,
|
| 7 |
+
"sex": "Male",
|
| 8 |
+
"password": "123"
|
| 9 |
+
},
|
| 10 |
+
{
|
| 11 |
+
"name": "Shreyansh",
|
| 12 |
+
"email": "Shreyansh@gmail.com",
|
| 13 |
+
"age": 22,
|
| 14 |
+
"sex": "Male",
|
| 15 |
+
"password": "123"
|
| 16 |
+
},
|
| 17 |
+
{
|
| 18 |
+
"name": "Shreyansh",
|
| 19 |
+
"email": "Shreyanshjain@gmail.com",
|
| 20 |
+
"age": 20,
|
| 21 |
+
"sex": "Male",
|
| 22 |
+
"password": "123"
|
| 23 |
+
},
|
| 24 |
+
{
|
| 25 |
+
"name": "Shreyansh",
|
| 26 |
+
"email": "Shreyansh@jain",
|
| 27 |
+
"age": 22,
|
| 28 |
+
"sex": "Male",
|
| 29 |
+
"password": "123"
|
| 30 |
+
},
|
| 31 |
+
{
|
| 32 |
+
"name": "Gani",
|
| 33 |
+
"email": "gvenkat@gmail.com",
|
| 34 |
+
"age": 22,
|
| 35 |
+
"sex": "Male",
|
| 36 |
+
"password": "kumar9849"
|
| 37 |
+
}
|
| 38 |
+
]
|
| 39 |
+
}
|
model.h5
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:61067fc71efcb09f1db8543d53abca00a2cbac7fc95d055a275e9dc0b33b4d9d
|
| 3 |
+
size 104099616
|
requirements.txt
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
numpy
|
| 2 |
+
tensorflow
|
| 3 |
+
scikit-learn
|
| 4 |
+
matplotlib
|
| 5 |
+
streamlit
|
| 6 |
+
mpld3
|
temp.py
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import json
|
| 2 |
+
import streamlit as st
|
| 3 |
+
from streamlit import session_state
|
| 4 |
+
import numpy as np
|
| 5 |
+
import pandas as pd
|
| 6 |
+
import imageio
|
| 7 |
+
import random
|
| 8 |
+
import os
|
| 9 |
+
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
|
| 10 |
+
|
| 11 |
+
import tensorflow as tf
|
| 12 |
+
from tensorflow import keras
|
| 13 |
+
from tensorflow.keras.callbacks import EarlyStopping, ReduceLROnPlateau
|
| 14 |
+
from tensorflow.keras.layers import Activation, Input, Conv2D, MaxPooling2D, BatchNormalization, Conv2DTranspose, concatenate
|
| 15 |
+
from tensorflow.keras.models import Model, load_model
|
| 16 |
+
from sklearn.model_selection import train_test_split
|
| 17 |
+
from tensorflow.keras.models import Model, load_model
|
| 18 |
+
|
| 19 |
+
import matplotlib.pyplot as plt
|
| 20 |
+
import warnings
|
| 21 |
+
warnings.filterwarnings('ignore')
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
import tensorflow as tf
|
| 25 |
+
from tensorflow import keras
|
| 26 |
+
from tensorflow.keras.callbacks import EarlyStopping, ReduceLROnPlateau
|
| 27 |
+
from tensorflow.keras.layers import Activation, Input, Conv2D, MaxPooling2D, BatchNormalization, Conv2DTranspose, concatenate
|
| 28 |
+
from tensorflow.keras.models import Model, load_model
|
| 29 |
+
from sklearn.model_selection import train_test_split
|
| 30 |
+
from tensorflow.keras.models import Model, load_model
|
| 31 |
+
|
| 32 |
+
import matplotlib.pyplot as plt
|
| 33 |
+
import warnings
|
| 34 |
+
warnings.filterwarnings('ignore')
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
session_state = st.session_state
|
| 38 |
+
if "user_index" not in st.session_state:
|
| 39 |
+
st.session_state["user_index"] = 0
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
def signup(json_file_path="data.json"):
|
| 43 |
+
st.title("Signup Page")
|
| 44 |
+
with st.form("signup_form"):
|
| 45 |
+
st.write("Fill in the details below to create an account:")
|
| 46 |
+
name = st.text_input("Name:")
|
| 47 |
+
email = st.text_input("Email:")
|
| 48 |
+
age = st.number_input("Age:", min_value=0, max_value=120)
|
| 49 |
+
sex = st.radio("Sex:", ("Male", "Female", "Other"))
|
| 50 |
+
password = st.text_input("Password:", type="password")
|
| 51 |
+
confirm_password = st.text_input("Confirm Password:", type="password")
|
| 52 |
+
|
| 53 |
+
if st.form_submit_button("Signup"):
|
| 54 |
+
if password == confirm_password:
|
| 55 |
+
user = create_account(name, email, age, sex, password, json_file_path)
|
| 56 |
+
session_state["logged_in"] = True
|
| 57 |
+
session_state["user_info"] = user
|
| 58 |
+
else:
|
| 59 |
+
st.error("Passwords do not match. Please try again.")
|
| 60 |
+
|
| 61 |
+
|
| 62 |
+
def check_login(username, password, json_file_path="data.json"):
|
| 63 |
+
try:
|
| 64 |
+
with open(json_file_path, "r") as json_file:
|
| 65 |
+
data = json.load(json_file)
|
| 66 |
+
|
| 67 |
+
for user in data["users"]:
|
| 68 |
+
if user["email"] == username and user["password"] == password:
|
| 69 |
+
session_state["logged_in"] = True
|
| 70 |
+
session_state["user_info"] = user
|
| 71 |
+
st.success("Login successful!")
|
| 72 |
+
return user
|
| 73 |
+
|
| 74 |
+
st.error("Invalid credentials. Please try again.")
|
| 75 |
+
return None
|
| 76 |
+
except Exception as e:
|
| 77 |
+
st.error(f"Error checking login: {e}")
|
| 78 |
+
return None
|
| 79 |
+
|
| 80 |
+
|
| 81 |
+
def predict(model):
|
| 82 |
+
image_path = "image.png"
|
| 83 |
+
image_path = tf.Variable(image_path)
|
| 84 |
+
# Load and preprocess the image
|
| 85 |
+
image = tf.io.read_file(image_path)
|
| 86 |
+
image = tf.image.decode_image(image, channels=3)
|
| 87 |
+
image = tf.image.resize(image, (256, 256))
|
| 88 |
+
image = tf.cast(image, tf.float32) / 255.0
|
| 89 |
+
|
| 90 |
+
# Expand dimensions to simulate batch size of 1
|
| 91 |
+
image = tf.expand_dims(image, axis=0)
|
| 92 |
+
|
| 93 |
+
# Perform prediction
|
| 94 |
+
pred_mask = model.predict(image)
|
| 95 |
+
pred_mask = tf.argmax(pred_mask, axis=-1)
|
| 96 |
+
pred_mask = tf.expand_dims(pred_mask, axis=-1)
|
| 97 |
+
return pred_mask
|
| 98 |
+
|
| 99 |
+
model = load_model('model.h5')
|
| 100 |
+
predict(model)
|