Spaces:
Runtime error
Runtime error
First Push
Browse files- .gitattributes +1 -0
- app.py +41 -0
- model_tuned.hdf5 +3 -0
.gitattributes
CHANGED
@@ -32,3 +32,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
32 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
33 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
34 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
32 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
33 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
34 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
35 |
+
model_tuned.hdf5 filter=lfs diff=lfs merge=lfs -text
|
app.py
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Import library
|
2 |
+
import streamlit as st
|
3 |
+
import numpy as np
|
4 |
+
from tensorflow import keras
|
5 |
+
from PIL import Image
|
6 |
+
|
7 |
+
|
8 |
+
# Load model
|
9 |
+
model = keras.models.load_model('model_tuned.hdf5')
|
10 |
+
|
11 |
+
st.header('Lung X-Ray Prediction')
|
12 |
+
st.write('Please Upload Your X-Ray Image')
|
13 |
+
|
14 |
+
# Upload Image
|
15 |
+
uploaded_file = st.file_uploader("", type=["jpg", "jpeg", "png"])
|
16 |
+
|
17 |
+
# Show Uploaded Image
|
18 |
+
if uploaded_file is not None:
|
19 |
+
image = Image.open(uploaded_file).convert('RGB')
|
20 |
+
st.subheader('This Is Your X-Ray Image')
|
21 |
+
st.image(image, width=200)
|
22 |
+
|
23 |
+
st.write('Push This Button To Predict')
|
24 |
+
if st.button('Predict'):
|
25 |
+
|
26 |
+
# resize uploaded image
|
27 |
+
inf = image.resize((224,224))
|
28 |
+
# make into array
|
29 |
+
inf = np.asarray(inf)
|
30 |
+
# expands dims to tensor
|
31 |
+
inf = np.expand_dims(inf, axis = 0)
|
32 |
+
|
33 |
+
# define label
|
34 |
+
label = ['Covid', 'Normal', 'Pneumonia']
|
35 |
+
|
36 |
+
# Make the prediction
|
37 |
+
prediction = model.predict(inf)
|
38 |
+
prediction = label[np.argmax(prediction)]
|
39 |
+
|
40 |
+
st.subheader(f"This X-Ray Images Has {prediction} Condition")
|
41 |
+
|
model_tuned.hdf5
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:434b16ae2f2b2119bc538790eb94153b8d4ce26c9d75a1075e205ce979f455c1
|
3 |
+
size 2569264
|