app updated
Browse files123453467891011121314151617181920212223242526272829303132333435363738394041import streamlit as stfrom PIL import Imageimport numpy as npimport joblib
x = st.slider('Select a value')st.write(x, 'squared is', x * x)# # Load your trained model (replace 'model.pkl' with your model filename)# model = joblib.load('model.pkl')
# Function to preprocess the image for predictiondef preprocess_image(image): # Convert the image to the format your model expects # This is an example, modify as necessary image = image.resize((224, 224)) # Resize the image image_array = np.array(image) / 255.0 # Normalize the image return image_array.reshape(1, 224, 224, 3) # Adjust shape for model
# Streamlit UIst.title("Seizure Prediction App")st.write("Upload an image to predict if it indicates a seizure or not.")
# Image uploaduploaded_file = st.file_uploader("Choose an image...", type=["jpg", "jpeg", "png"])
if uploaded_file is not None: # Display the uploaded image image = Image.open(uploaded_file) st.image(image, caption='Uploaded Image', use_column_width=True) # Preprocess the image processed_image = preprocess_image(image) # Button to predict if st.button("Predict"): # Make prediction prediction = model.predict(processed_image) # Display result if prediction[0] == 1: st.success("The model predicts: Seizure detected!") else: st.success("The model predicts: No seizure detected.")app.py+39-2