Spaces:
Sleeping
Sleeping
Upload 7 files
Browse files
.gitattributes
CHANGED
|
@@ -34,3 +34,5 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
Chest[[:space:]]Xray/pneumonia.keras filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
Chest[[:space:]]Xray/pneumonia.keras filter=lfs diff=lfs merge=lfs -text
|
| 37 |
+
Blood[[:space:]]Cancer/blood_cancer.keras filter=lfs diff=lfs merge=lfs -text
|
| 38 |
+
Blood[[:space:]]Cancer/test_imgs/benign.jpg filter=lfs diff=lfs merge=lfs -text
|
Blood Cancer/blood-cancer.ipynb
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
Blood Cancer/blood-cancer.py
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import numpy as np
|
| 2 |
+
import cv2
|
| 3 |
+
import streamlit as st
|
| 4 |
+
from tensorflow.keras.models import load_model
|
| 5 |
+
import warnings
|
| 6 |
+
|
| 7 |
+
warnings.filterwarnings('ignore')
|
| 8 |
+
st.title("Blood Cancer")
|
| 9 |
+
def load_img(path):
|
| 10 |
+
img = cv2.imread(path)
|
| 11 |
+
img = cv2.cvtColor(img,cv2.COLOR_BGR2RGB)
|
| 12 |
+
img = cv2.resize(img,(224,224))
|
| 13 |
+
img = img.astype('float32')
|
| 14 |
+
img /= 255.0
|
| 15 |
+
return img
|
| 16 |
+
|
| 17 |
+
def pred(img,model):
|
| 18 |
+
img = np.expand_dims(img,axis=0)
|
| 19 |
+
pred = model.predict(img)
|
| 20 |
+
return np.argmax(pred)
|
| 21 |
+
|
| 22 |
+
@st.cache_resource
|
| 23 |
+
def load_model_():
|
| 24 |
+
model = load_model("blood_cancer.keras")
|
| 25 |
+
return model
|
| 26 |
+
|
| 27 |
+
model = load_model_()
|
| 28 |
+
test_imgs = ["test_imgs/benign.jpg",'test_imgs/early pre-b.jpg','test_imgs/pre-b.jpg','test_imgs/pro-b.jpg']
|
| 29 |
+
for i in test_imgs:
|
| 30 |
+
img = load_img(i)
|
| 31 |
+
st.image(np.squeeze(img),caption="Blood Cell Image")
|
| 32 |
+
prediction = pred(img,model)
|
| 33 |
+
if prediction == 0:
|
| 34 |
+
st.markdown("#### This is a benign condition. No immediate medical action is needed.")
|
| 35 |
+
|
| 36 |
+
elif prediction == 1:
|
| 37 |
+
st.markdown("#### This is a pre-B malignant type. Medical consultation is highly recommended.")
|
| 38 |
+
|
| 39 |
+
elif prediction == 2:
|
| 40 |
+
st.markdown("#### This is a malignant cancer type. Please consult a doctor for further diagnosis.")
|
| 41 |
+
|
| 42 |
+
elif prediction == 3:
|
| 43 |
+
st.markdown("#### This is an early pre-B type. Regular monitoring and medical advice are advised.")
|
Blood Cancer/blood_cancer.keras
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:44e5fb43c9f2cfe99558e0a4846a75c4abd1db1b460a1f1baa969c13fb27248b
|
| 3 |
+
size 62550779
|
Blood Cancer/test_imgs/benign.jpg
ADDED
|
Git LFS Details
|
Blood Cancer/test_imgs/early pre-b.jpg
ADDED
|
Blood Cancer/test_imgs/pre-b.jpg
ADDED
|
Blood Cancer/test_imgs/pro-b.jpg
ADDED
|