-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapp.py
30 lines (22 loc) · 857 Bytes
/
app.py
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
import streamlit as st
from PIL import Image
import tensorflow as tf
import numpy as np
model = tf.keras.models.load_model(r"artifacts/training/model.h5")
st.title("Chicken Disease Classification")
uploaded_image = st.file_uploader("Upload a chicken image", type=["jpg", "png"])
if uploaded_image is not None:
image = Image.open(uploaded_image)
st.image(image, caption="Uploaded Image", use_column_width=True)
st.write("Classifying...")
image = image.resize((224, 224))
image_array = np.array(image) / 255.0
image_array = np.expand_dims(image_array, axis=0)
prediction = model.predict(image_array)
predicted_class = np.argmax(prediction, axis=1)[0]
result = None
if predicted_class == '0':
result = "Positive"
else:
result = "Negative"
st.write(f"Disease detected: {result}")