Spaces:
Sleeping
Sleeping
Add falcondemo.mp4 and .keras model to Git LFS
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- .env.example +5 -0
- .gitattributes +2 -0
- .gitignore +14 -0
- .streamlit/secrets.toml +3 -0
- Disease_Detection/app.py +80 -0
- Disease_Detection/code +1 -0
- Disease_Detection/for_all_classe.ipynb +0 -0
- Disease_Detection/requirements.txt +7 -0
- Disease_Detection/test/Covid/0100.jpeg +3 -0
- Disease_Detection/test/Covid/0102.jpeg +3 -0
- Disease_Detection/test/Covid/0105.png +0 -0
- Disease_Detection/test/Covid/0106.jpeg +3 -0
- Disease_Detection/test/Covid/0108.jpeg +3 -0
- Disease_Detection/test/Covid/0111.jpg +3 -0
- Disease_Detection/test/Covid/0112.jpg +3 -0
- Disease_Detection/test/Covid/0113.jpg +3 -0
- Disease_Detection/test/Covid/0115.jpeg +3 -0
- Disease_Detection/test/Covid/0118.jpeg +3 -0
- Disease_Detection/test/Covid/0119.jpeg +3 -0
- Disease_Detection/test/Covid/0120.jpg +3 -0
- Disease_Detection/test/Covid/094 - Copy.png +0 -0
- Disease_Detection/test/Covid/094.png +0 -0
- Disease_Detection/test/Covid/096.png +0 -0
- Disease_Detection/test/Covid/098.jpeg +3 -0
- Disease_Detection/test/Covid/COVID-00003b.jpg +3 -0
- Disease_Detection/test/Covid/COVID-00012.jpg +3 -0
- Disease_Detection/test/Covid/COVID-00022.jpg +3 -0
- Disease_Detection/test/Covid/COVID-00033.jpg +3 -0
- Disease_Detection/test/Covid/COVID-00037.jpg +3 -0
- Disease_Detection/test/Covid/auntminnie-2020_01_31_20_24_2322_2020_01_31_x-ray_coronavirus_US.jpg +3 -0
- Disease_Detection/test/Covid/auntminnie-a-2020_01_28_23_51_6665_2020_01_28_Vietnam_coronavirus.jpeg +3 -0
- Disease_Detection/test/Covid/auntminnie-b-2020_01_28_23_51_6665_2020_01_28_Vietnam_coronavirus.jpeg +3 -0
- Disease_Detection/test/Covid/auntminnie-c-2020_01_28_23_51_6665_2020_01_28_Vietnam_coronavirus.jpeg +3 -0
- Disease_Detection/test/Covid/auntminnie-d-2020_01_28_23_51_6665_2020_01_28_Vietnam_coronavirus.jpeg +3 -0
- Disease_Detection/test/Covid/radiopaedia-2019-novel-coronavirus-infected-pneumonia.jpg +3 -0
- Disease_Detection/test/Normal_chestxray/0101.jpeg +3 -0
- Disease_Detection/test/Normal_chestxray/0102.jpeg +3 -0
- Disease_Detection/test/Normal_chestxray/0103.jpeg +3 -0
- Disease_Detection/test/Normal_chestxray/0105.jpeg +3 -0
- Disease_Detection/test/Normal_chestxray/0106.jpeg +3 -0
- Disease_Detection/test/Normal_chestxray/0107.jpeg +3 -0
- Disease_Detection/test/Normal_chestxray/0108.jpeg +3 -0
- Disease_Detection/test/Normal_chestxray/0109.jpeg +3 -0
- Disease_Detection/test/Normal_chestxray/0110.jpeg +3 -0
- Disease_Detection/test/Normal_chestxray/0111.jpeg +3 -0
- Disease_Detection/test/Normal_chestxray/0112.jpeg +3 -0
- Disease_Detection/test/Normal_chestxray/0114.jpeg +3 -0
- Disease_Detection/test/Normal_chestxray/0115.jpeg +3 -0
- Disease_Detection/test/Normal_chestxray/0116.jpeg +3 -0
- Disease_Detection/test/Normal_chestxray/0117.jpeg +3 -0
.env.example
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
AI71_API_KEY= # Get at https://marketplace.ai71.ai/api-keys
|
| 2 |
+
ROBOFLOW_API_KEY= # Get at https://app.roboflow.com/
|
| 3 |
+
|
| 4 |
+
INFERENCE_API_URL=
|
| 5 |
+
INFERENCE_API_KEY=
|
.gitattributes
CHANGED
|
@@ -33,5 +33,7 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip 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 |
*.jpeg filter=lfs diff=lfs merge=lfs -text
|
| 37 |
*.jpg filter=lfs diff=lfs merge=lfs -text
|
|
|
|
| 33 |
*.zip 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 |
+
frontend/react-code/src/assets/falcondemo.mp4 filter=lfs diff=lfs merge=lfs -text
|
| 37 |
+
frontend/FINAL_MODEL.keras filter=lfs diff=lfs merge=lfs -text
|
| 38 |
*.jpeg filter=lfs diff=lfs merge=lfs -text
|
| 39 |
*.jpg filter=lfs diff=lfs merge=lfs -text
|
.gitignore
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
*.pyc
|
| 2 |
+
__pycache__/
|
| 3 |
+
db.sqlite3
|
| 4 |
+
.env
|
| 5 |
+
.conda/
|
| 6 |
+
.venv/
|
| 7 |
+
.vscode/
|
| 8 |
+
|
| 9 |
+
backend/.hc_backend
|
| 10 |
+
backend/api/migrations/*
|
| 11 |
+
|
| 12 |
+
frontend/.hc_frontend
|
| 13 |
+
.aider*
|
| 14 |
+
frontend/.streamlit/secrets.toml
|
.streamlit/secrets.toml
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
INFERENCE_API_URL = "https://detect.roboflow.com"
|
| 2 |
+
INFERENCE_API_KEY = "LSbJ0tl3WTLn4Aqar0Sp"
|
| 3 |
+
AI71_API_KEY = "api71-api-1a7b704d-f950-4507-95cc-c26ce3457d75"
|
Disease_Detection/app.py
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
from PIL import Image
|
| 3 |
+
import tensorflow as tf
|
| 4 |
+
import cv2
|
| 5 |
+
import numpy as np
|
| 6 |
+
|
| 7 |
+
# Load the model
|
| 8 |
+
try:
|
| 9 |
+
model = tf.keras.models.load_model('FINAL_MODEL.keras')
|
| 10 |
+
except FileNotFoundError:
|
| 11 |
+
st.error("Disease classification model not found. Please ensure 'FINAL_MODEL.keras' is in the same directory as this app.")
|
| 12 |
+
model = None
|
| 13 |
+
|
| 14 |
+
# Title of the app
|
| 15 |
+
st.title("DISEASE DETECTION n CLASSIFICATION")
|
| 16 |
+
|
| 17 |
+
# Upload an image file
|
| 18 |
+
uploaded_image = st.file_uploader("Choose an image...", type=["jpg", "jpeg", "png"])
|
| 19 |
+
|
| 20 |
+
if uploaded_image is not None and model is not None:
|
| 21 |
+
|
| 22 |
+
img_opened = Image.open(uploaded_image).convert('RGB')
|
| 23 |
+
#image_opened = Image.open(uploaded_image)
|
| 24 |
+
image_pred = np.array(img_opened)
|
| 25 |
+
image_pred = cv2.resize(image_pred, (150, 150))
|
| 26 |
+
|
| 27 |
+
# Convert the image to a numpy array
|
| 28 |
+
image_pred = np.array(image_pred)
|
| 29 |
+
|
| 30 |
+
# Rescale the image (if the model was trained with rescaling)
|
| 31 |
+
image_pred = image_pred / 255.0
|
| 32 |
+
|
| 33 |
+
# Add an extra dimension to match the input shape (1, 150, 150, 3)
|
| 34 |
+
image_pred = np.expand_dims(image_pred, axis=0)
|
| 35 |
+
|
| 36 |
+
# Print the shape of the preprocessed image
|
| 37 |
+
print("Shape of the preprocessed image:", image_pred.shape)
|
| 38 |
+
|
| 39 |
+
# Predict using the model
|
| 40 |
+
prediction = model.predict(image_pred)
|
| 41 |
+
|
| 42 |
+
# Example prediction output
|
| 43 |
+
prediction = np.array(prediction)
|
| 44 |
+
|
| 45 |
+
#print(f"Prediction_Classes for different types\ncovid: 0\nnormal_chestray: 1\npneumonia: 2")
|
| 46 |
+
|
| 47 |
+
# Get the predicted class
|
| 48 |
+
predicted_ = np.argmax(prediction)
|
| 49 |
+
# Display the image
|
| 50 |
+
print(f"Predicted array for : {predicted_}")
|
| 51 |
+
|
| 52 |
+
# Decode the prediction
|
| 53 |
+
if predicted_ == 0:
|
| 54 |
+
predicted_class= "Covid"
|
| 55 |
+
elif predicted_ == 1:
|
| 56 |
+
predicted_class= "Normal_chestray"
|
| 57 |
+
else:
|
| 58 |
+
predicted_class= "Pneumonia"
|
| 59 |
+
|
| 60 |
+
# Print the predicted class
|
| 61 |
+
print(f'The predicted class is: {predicted_class}')
|
| 62 |
+
#print(prediction)
|
| 63 |
+
|
| 64 |
+
|
| 65 |
+
st.image(image_pred, caption='Input image by user', use_column_width=True)
|
| 66 |
+
st.write("CLasses description for understanding")
|
| 67 |
+
st.write("Prediction Classes for different types:")
|
| 68 |
+
st.write("COVID: 0")
|
| 69 |
+
st.write("Normal Chest X-ray: 1")
|
| 70 |
+
st.write("Pneumonia: 2")
|
| 71 |
+
st.write("\n")
|
| 72 |
+
# Display some text
|
| 73 |
+
st.write("DETECTED DISEASE DISPLAY")
|
| 74 |
+
st.write(f"Predicted Class : {predicted_}")
|
| 75 |
+
st.write(predicted_class)
|
| 76 |
+
else:
|
| 77 |
+
st.write("Please upload an image file or ensure the disease model is loaded.")
|
| 78 |
+
|
| 79 |
+
|
| 80 |
+
|
Disease_Detection/code
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
|
Disease_Detection/for_all_classe.ipynb
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
Disease_Detection/requirements.txt
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
opencv-python
|
| 2 |
+
opencv-python-headless
|
| 3 |
+
opencv-contrib-python
|
| 4 |
+
pillow
|
| 5 |
+
tensorflow
|
| 6 |
+
scikit-learn
|
| 7 |
+
streamlit
|
Disease_Detection/test/Covid/0100.jpeg
ADDED
|
Git LFS Details
|
Disease_Detection/test/Covid/0102.jpeg
ADDED
|
Git LFS Details
|
Disease_Detection/test/Covid/0105.png
ADDED
|
Disease_Detection/test/Covid/0106.jpeg
ADDED
|
Git LFS Details
|
Disease_Detection/test/Covid/0108.jpeg
ADDED
|
Git LFS Details
|
Disease_Detection/test/Covid/0111.jpg
ADDED
|
Git LFS Details
|
Disease_Detection/test/Covid/0112.jpg
ADDED
|
Git LFS Details
|
Disease_Detection/test/Covid/0113.jpg
ADDED
|
Git LFS Details
|
Disease_Detection/test/Covid/0115.jpeg
ADDED
|
Git LFS Details
|
Disease_Detection/test/Covid/0118.jpeg
ADDED
|
Git LFS Details
|
Disease_Detection/test/Covid/0119.jpeg
ADDED
|
Git LFS Details
|
Disease_Detection/test/Covid/0120.jpg
ADDED
|
Git LFS Details
|
Disease_Detection/test/Covid/094 - Copy.png
ADDED
|
Disease_Detection/test/Covid/094.png
ADDED
|
Disease_Detection/test/Covid/096.png
ADDED
|
Disease_Detection/test/Covid/098.jpeg
ADDED
|
Git LFS Details
|
Disease_Detection/test/Covid/COVID-00003b.jpg
ADDED
|
Git LFS Details
|
Disease_Detection/test/Covid/COVID-00012.jpg
ADDED
|
Git LFS Details
|
Disease_Detection/test/Covid/COVID-00022.jpg
ADDED
|
Git LFS Details
|
Disease_Detection/test/Covid/COVID-00033.jpg
ADDED
|
Git LFS Details
|
Disease_Detection/test/Covid/COVID-00037.jpg
ADDED
|
Git LFS Details
|
Disease_Detection/test/Covid/auntminnie-2020_01_31_20_24_2322_2020_01_31_x-ray_coronavirus_US.jpg
ADDED
|
Git LFS Details
|
Disease_Detection/test/Covid/auntminnie-a-2020_01_28_23_51_6665_2020_01_28_Vietnam_coronavirus.jpeg
ADDED
|
Git LFS Details
|
Disease_Detection/test/Covid/auntminnie-b-2020_01_28_23_51_6665_2020_01_28_Vietnam_coronavirus.jpeg
ADDED
|
Git LFS Details
|
Disease_Detection/test/Covid/auntminnie-c-2020_01_28_23_51_6665_2020_01_28_Vietnam_coronavirus.jpeg
ADDED
|
Git LFS Details
|
Disease_Detection/test/Covid/auntminnie-d-2020_01_28_23_51_6665_2020_01_28_Vietnam_coronavirus.jpeg
ADDED
|
Git LFS Details
|
Disease_Detection/test/Covid/radiopaedia-2019-novel-coronavirus-infected-pneumonia.jpg
ADDED
|
Git LFS Details
|
Disease_Detection/test/Normal_chestxray/0101.jpeg
ADDED
|
Git LFS Details
|
Disease_Detection/test/Normal_chestxray/0102.jpeg
ADDED
|
Git LFS Details
|
Disease_Detection/test/Normal_chestxray/0103.jpeg
ADDED
|
Git LFS Details
|
Disease_Detection/test/Normal_chestxray/0105.jpeg
ADDED
|
Git LFS Details
|
Disease_Detection/test/Normal_chestxray/0106.jpeg
ADDED
|
Git LFS Details
|
Disease_Detection/test/Normal_chestxray/0107.jpeg
ADDED
|
Git LFS Details
|
Disease_Detection/test/Normal_chestxray/0108.jpeg
ADDED
|
Git LFS Details
|
Disease_Detection/test/Normal_chestxray/0109.jpeg
ADDED
|
Git LFS Details
|
Disease_Detection/test/Normal_chestxray/0110.jpeg
ADDED
|
Git LFS Details
|
Disease_Detection/test/Normal_chestxray/0111.jpeg
ADDED
|
Git LFS Details
|
Disease_Detection/test/Normal_chestxray/0112.jpeg
ADDED
|
Git LFS Details
|
Disease_Detection/test/Normal_chestxray/0114.jpeg
ADDED
|
Git LFS Details
|
Disease_Detection/test/Normal_chestxray/0115.jpeg
ADDED
|
Git LFS Details
|
Disease_Detection/test/Normal_chestxray/0116.jpeg
ADDED
|
Git LFS Details
|
Disease_Detection/test/Normal_chestxray/0117.jpeg
ADDED
|
Git LFS Details
|