Spaces:
Sleeping
Sleeping
Upload 8 files
Browse files- .gitattributes +4 -0
- WHO-COVID-19-global-data.csv +3 -0
- covid.jpg +3 -0
- covid_xray_model.keras +3 -0
- normal.jpeg +3 -0
- pneumonia.jpeg +0 -0
- requirements.txt +6 -0
- runtime.txt +1 -0
- streamlit_app1.py +83 -0
.gitattributes
CHANGED
|
@@ -33,3 +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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
covid_xray_model.keras filter=lfs diff=lfs merge=lfs -text
|
| 37 |
+
covid.jpg filter=lfs diff=lfs merge=lfs -text
|
| 38 |
+
normal.jpeg filter=lfs diff=lfs merge=lfs -text
|
| 39 |
+
WHO-COVID-19-global-data.csv filter=lfs diff=lfs merge=lfs -text
|
WHO-COVID-19-global-data.csv
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c671cd13d4186f4917bb5ce6cbf26342e07cb46f2e5c4c87e7d8e87d2d091f70
|
| 3 |
+
size 14718014
|
covid.jpg
ADDED
|
Git LFS Details
|
covid_xray_model.keras
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:537d9cc3bcf24288d784380ca34fd51e42db1d4a52ca2705b046f6503660cd5d
|
| 3 |
+
size 286932881
|
normal.jpeg
ADDED
|
Git LFS Details
|
pneumonia.jpeg
ADDED
|
requirements.txt
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
streamlit
|
| 2 |
+
tensorflow==2.10.0
|
| 3 |
+
keras
|
| 4 |
+
pandas
|
| 5 |
+
numpy
|
| 6 |
+
matplotlib
|
runtime.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
python-3.10
|
streamlit_app1.py
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
import pandas as pd
|
| 3 |
+
import numpy as np
|
| 4 |
+
from tensorflow.keras.models import load_model
|
| 5 |
+
from tensorflow.keras.preprocessing import image
|
| 6 |
+
import matplotlib.pyplot as plt
|
| 7 |
+
|
| 8 |
+
# ------------------------- PAGE CONFIG -------------------------
|
| 9 |
+
st.set_page_config(page_title="COVID-19 AI System", layout="centered")
|
| 10 |
+
|
| 11 |
+
# ------------------------- SIDEBAR -------------------------
|
| 12 |
+
st.sidebar.image("https://i.imgur.com/NbA3RfI.png", use_container_width=True) # Optional: Replace with your own logo
|
| 13 |
+
st.sidebar.title("π§ COVID-19 AI Dashboard")
|
| 14 |
+
app_mode = st.sidebar.radio("π Select Module", ["π Home", "π©» X-ray Classifier", "π Global Data Analysis"])
|
| 15 |
+
|
| 16 |
+
# ------------------------- CUSTOM CSS -------------------------
|
| 17 |
+
st.markdown("""
|
| 18 |
+
<style>
|
| 19 |
+
.main { background-color: #f7f7f7; padding: 20px; border-radius: 10px; }
|
| 20 |
+
.title { text-align: center; font-size: 36px; color: #4A90E2; font-weight: bold; }
|
| 21 |
+
.subtitle { text-align: center; font-size: 18px; color: #444; }
|
| 22 |
+
</style>
|
| 23 |
+
""", unsafe_allow_html=True)
|
| 24 |
+
|
| 25 |
+
# ------------------------- HOME PAGE -------------------------
|
| 26 |
+
if app_mode == "π Home":
|
| 27 |
+
st.markdown('<div class="main"><div class="title">COVID-19 Detection & Analysis</div><div class="subtitle">An integrated AI system using Deep Learning and WHO data</div></div>', unsafe_allow_html=True)
|
| 28 |
+
st.write("Welcome to the COVID-19 AI dashboard. Use the sidebar to navigate between modules:")
|
| 29 |
+
|
| 30 |
+
st.markdown("""
|
| 31 |
+
- π©» **X-ray Classifier**: Upload a chest X-ray to detect COVID-19 using a deep learning model.
|
| 32 |
+
- π **Global Data Analysis**: Explore real-world trends using WHO global COVID-19 dataset.
|
| 33 |
+
""")
|
| 34 |
+
|
| 35 |
+
# ------------------------- X-RAY PREDICTION -------------------------
|
| 36 |
+
elif app_mode == "π©» X-ray Classifier":
|
| 37 |
+
st.header("π©Ί Chest X-ray COVID Prediction")
|
| 38 |
+
|
| 39 |
+
uploaded_image = st.file_uploader("π€ Upload Chest X-ray", type=["jpg", "jpeg", "png"])
|
| 40 |
+
|
| 41 |
+
if uploaded_image:
|
| 42 |
+
with st.spinner("π Predicting..."):
|
| 43 |
+
model = load_model("covid_xray_model.keras")
|
| 44 |
+
img = image.load_img(uploaded_image, target_size=(224, 224))
|
| 45 |
+
img_array = image.img_to_array(img) / 255.0
|
| 46 |
+
img_array = np.expand_dims(img_array, axis=0)
|
| 47 |
+
|
| 48 |
+
pred = model.predict(img_array)[0]
|
| 49 |
+
labels = ['COVID', 'NORMAL', 'Viral Pneumonia']
|
| 50 |
+
result = labels[np.argmax(pred)]
|
| 51 |
+
|
| 52 |
+
col1, col2 = st.columns([1, 2])
|
| 53 |
+
with col1:
|
| 54 |
+
st.image(uploaded_image, caption="Uploaded X-ray", use_container_width=True)
|
| 55 |
+
with col2:
|
| 56 |
+
st.success(f"π§ **Predicted Condition:** `{result}`")
|
| 57 |
+
|
| 58 |
+
# ------------------------- DATA ANALYSIS -------------------------
|
| 59 |
+
elif app_mode == "π Global Data Analysis":
|
| 60 |
+
st.header("π WHO COVID-19 Data Analysis")
|
| 61 |
+
|
| 62 |
+
df = pd.read_csv("WHO-COVID-19-global-data.csv")
|
| 63 |
+
df["Date_reported"] = pd.to_datetime(df["Date_reported"])
|
| 64 |
+
|
| 65 |
+
top_countries = df.groupby("Country")["New_cases"].sum().sort_values(ascending=False).head(10)
|
| 66 |
+
|
| 67 |
+
st.subheader("π Top 10 Countries by Total Reported Cases")
|
| 68 |
+
st.bar_chart(top_countries)
|
| 69 |
+
|
| 70 |
+
st.subheader("π Trend for Selected Country")
|
| 71 |
+
selected_country = st.selectbox("Choose a country", df["Country"].unique())
|
| 72 |
+
country_data = df[df["Country"] == selected_country]
|
| 73 |
+
|
| 74 |
+
col1, col2 = st.columns(2)
|
| 75 |
+
with col1:
|
| 76 |
+
st.markdown("**Daily New Cases**")
|
| 77 |
+
st.line_chart(country_data.set_index("Date_reported")[["New_cases"]])
|
| 78 |
+
with col2:
|
| 79 |
+
st.markdown("**Cumulative Cases Over Time**")
|
| 80 |
+
st.line_chart(country_data.set_index("Date_reported")[["Cumulative_cases"]])
|
| 81 |
+
|
| 82 |
+
with st.expander("π Show Raw Data"):
|
| 83 |
+
st.dataframe(country_data.tail(10))
|