brain-tumor / app.py
subek's picture
Update app.py
d4f1ac4 verified
raw
history blame
1.16 kB
import streamlit as st
import tensorflow as tf
from tensorflow.keras.preprocessing import image
import numpy as np
from PIL import Image
import base64
# Load the pre-trained brain tumor segmentation model
model = tf.keras.models.load_model("model.h5")
img_size = (256, 256) # Adjust based on your model's input size
st.set_page_config(
page_title="Brain Tumor Segmentation App",
page_icon=":brain:",
layout="wide"
)
custom_style = """
<style>
div[data-testid="stToolbar"],
div[data-testid="stDecoration"],
div[data-testid="stStatusWidget"],
#MainMenu,
header,
footer {
visibility: hidden;
height: 0%;
}
</style>
"""
st.markdown(custom_style, unsafe_allow_html=True)
def main():
st.title("Brain Tumor Segmentation App")
uploaded_file = st.file_uploader("Upload an MRI image for tumor segmentation...", type=["jpg", "png", "jpeg"])
if uploaded_file is not None:
original_image = Image.open(uploaded_file)
st.image(original_image, caption="Uploaded Image", use_column_width=True)
st.markdown("## Tumor Segmentation Result")
if __name__ == "__main__":
main()