Manith Marapperuma
commited on
Delete streamlit.py
Browse files- streamlit.py +0 -31
streamlit.py
DELETED
@@ -1,31 +0,0 @@
|
|
1 |
-
import streamlit as st
|
2 |
-
from keras.models import load_model
|
3 |
-
from keras.preprocessing import image
|
4 |
-
from keras.applications.vgg16 import preprocess_input
|
5 |
-
import numpy as np
|
6 |
-
import tensorflow as tf
|
7 |
-
|
8 |
-
# Set the title of the web app
|
9 |
-
st.title('Pneumonia Detection Using VGG16')
|
10 |
-
|
11 |
-
st.text("Coded by Manith Jayaba")
|
12 |
-
|
13 |
-
# Load the Keras model
|
14 |
-
model = load_model('chest_xray.h5')
|
15 |
-
|
16 |
-
# Create a file uploader for the test image
|
17 |
-
uploaded_file = st.file_uploader("Choose an image...", type="jpg")
|
18 |
-
|
19 |
-
# Perform the prediction when an image is uploaded
|
20 |
-
if uploaded_file is not None:
|
21 |
-
img = tf.keras.utils.load_img(uploaded_file, target_size=(224, 224))
|
22 |
-
x = tf.keras.preprocessing.image.img_to_array(img)
|
23 |
-
x = np.expand_dims(x, axis=0)
|
24 |
-
img_data = preprocess_input(x)
|
25 |
-
classes = model.predict(img_data)
|
26 |
-
result = int(classes[0][0])
|
27 |
-
if result == 0:
|
28 |
-
st.write("Person is Affected By PNEUMONIA")
|
29 |
-
else:
|
30 |
-
st.write("Result is Normal")
|
31 |
-
st.image(uploaded_file, caption="Uploaded Image", use_column_width=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|