Spaces:
Sleeping
Sleeping
Upload folder using huggingface_hub
Browse files- README.md +17 -10
- streamlit_app.py +2 -3
README.md
CHANGED
|
@@ -1,10 +1,17 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Pneumonia Detection — Streamlit App
|
| 2 |
+
|
| 3 |
+
## Place model
|
| 4 |
+
Copy your model file into this folder as `Model2_exact_serialized.keras` (or edit `MODEL_FILENAME` inside streamlit_app.py).
|
| 5 |
+
|
| 6 |
+
## Run locally
|
| 7 |
+
1. pip install -r requirements.txt
|
| 8 |
+
2. streamlit run streamlit_app.py
|
| 9 |
+
3. Open http://localhost:8501
|
| 10 |
+
|
| 11 |
+
## Docker
|
| 12 |
+
docker build -t pneumonia-streamlit .
|
| 13 |
+
docker run -p 8501:8501 pneumonia-streamlit
|
| 14 |
+
|
| 15 |
+
## Notes
|
| 16 |
+
- DICOMs may contain PHI. Do not store/share patient-identifying DICOM metadata.
|
| 17 |
+
- If your DICOMs are compressed, the pylibjpeg plugins in requirements help decode them.
|
streamlit_app.py
CHANGED
|
@@ -1,4 +1,3 @@
|
|
| 1 |
-
%%writefile pneumonia_app/streamlit_app.py
|
| 2 |
# streamlit_app.py
|
| 3 |
import io
|
| 4 |
import os
|
|
@@ -128,7 +127,7 @@ if uploaded is not None:
|
|
| 128 |
st.error(f"Failed to process file: {e}")
|
| 129 |
st.stop()
|
| 130 |
|
| 131 |
-
st.image(rgb, caption="Input (resized)",
|
| 132 |
|
| 133 |
# load model (cached)
|
| 134 |
model = load_predict_model(MODEL_FILENAME)
|
|
@@ -144,7 +143,7 @@ if uploaded is not None:
|
|
| 144 |
if ENABLE_GRADCAM:
|
| 145 |
try:
|
| 146 |
cam = make_gradcam_image(rgb, model)
|
| 147 |
-
st.image(cam, caption="Grad-CAM overlay",
|
| 148 |
except Exception as e:
|
| 149 |
st.warning(f"Grad-CAM failed: {e}")
|
| 150 |
|
|
|
|
|
|
|
| 1 |
# streamlit_app.py
|
| 2 |
import io
|
| 3 |
import os
|
|
|
|
| 127 |
st.error(f"Failed to process file: {e}")
|
| 128 |
st.stop()
|
| 129 |
|
| 130 |
+
st.image(rgb, caption="Input (resized)", use_column_width=False)
|
| 131 |
|
| 132 |
# load model (cached)
|
| 133 |
model = load_predict_model(MODEL_FILENAME)
|
|
|
|
| 143 |
if ENABLE_GRADCAM:
|
| 144 |
try:
|
| 145 |
cam = make_gradcam_image(rgb, model)
|
| 146 |
+
st.image(cam, caption="Grad-CAM overlay", use_column_width=False)
|
| 147 |
except Exception as e:
|
| 148 |
st.warning(f"Grad-CAM failed: {e}")
|
| 149 |
|