app updated
Browse files1234import streamlit as stx = st.slider('Select a value')st.write(x, 'squared is', x * x)1234567891011121314151617181920212223242526272829303132333435363738394041import streamlit as stfrom PIL import Imageimport numpy as npimport joblib# # 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 necessaryimage = image.resize((224, 224)) # Resize the imageimage_array = np.array(image) / 255.0 # Normalize the imagereturn 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 imageimage = Image.open(uploaded_file)st.image(image, caption='Uploaded Image', use_column_width=True)# Preprocess the imageprocessed_image = preprocess_image(image)# Button to predictif st.button("Predict"):# Make predictionprediction = model.predict(processed_image)# Display resultif prediction[0] == 1:st.success("The model predicts: Seizure detected!")else:st.success("The model predicts: No seizure detected.")
app.py+39-2