Spaces:
Runtime error
Runtime error
File size: 983 Bytes
cf04930 f7bb82b 7728c0a f7bb82b 7728c0a dc1ed39 7728c0a 2e30bf5 7728c0a f7bb82b cf04930 7728c0a cf04930 f7bb82b 7728c0a cf04930 7728c0a 2e30bf5 cf04930 858eea8 7728c0a | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | import streamlit as st
import numpy as np
from tensorflow.keras.models import load_model
from tensorflow.keras.preprocessing import image
from PIL import Image
# Load the updated Keras model
model = load_model("clean_model.keras")
st.title("Disease Prediction App")
st.write("Upload an image and get prediction")
# Upload image
uploaded_file = st.file_uploader("Choose an image...", type=["jpg", "jpeg", "png"])
if uploaded_file is not None:
# Display the uploaded image
img = Image.open(uploaded_file)
st.image(img, caption="Uploaded Image", use_column_width=True)
# Preprocess image
img = img.resize((64, 64)) # Replace with your model's expected input size
img_array = image.img_to_array(img)
img_array = np.expand_dims(img_array, axis=0) / 255.0
# Predict
prediction = model.predict(img_array)
# Result
if prediction[0][0] > 0.5:
st.write("🔴 Disease Detected")
else:
st.write("🟢 No Disease Detected")
|