TaliZG03 commited on
Commit
752a8c6
Β·
verified Β·
1 Parent(s): b3c40c8

Upload 7 files

Browse files
Files changed (8) hide show
  1. .gitattributes +2 -0
  2. Normal- (9).jpg +3 -0
  3. Normal- good(6).jpg +3 -0
  4. README.md +10 -12
  5. Tumor- (872).jpg +0 -0
  6. Tumor- (882).jpg +0 -0
  7. app.py +47 -0
  8. requirements.txt +5 -0
.gitattributes CHANGED
@@ -33,3 +33,5 @@ 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
+ Normal-[[:space:]](9).jpg filter=lfs diff=lfs merge=lfs -text
37
+ Normal-[[:space:]]good(6).jpg filter=lfs diff=lfs merge=lfs -text
Normal- (9).jpg ADDED

Git LFS Details

  • SHA256: 30cb2975acc776ef05e252ae5c280a3926098405ed1bb612b1a2a07014a5226e
  • Pointer size: 131 Bytes
  • Size of remote file: 124 kB
Normal- good(6).jpg ADDED

Git LFS Details

  • SHA256: 58c1959f20d2999df47510972a56874ad9b6c4154d14ecdcdcf95139df4546c0
  • Pointer size: 131 Bytes
  • Size of remote file: 124 kB
README.md CHANGED
@@ -1,12 +1,10 @@
1
- ---
2
- title: Kidney CT Classifier Model
3
- emoji: 🌍
4
- colorFrom: green
5
- colorTo: green
6
- sdk: gradio
7
- sdk_version: 5.35.0
8
- app_file: app.py
9
- pinned: false
10
- ---
11
-
12
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
+ # 🧠 Kidney CT Classifier
2
+
3
+ A machine learning web app to classify kidney CT scans as NORMAL or ABNORMAL.
4
+
5
+ ## πŸš€ Live Demo
6
+
7
+ πŸ‘‰ [Launch Here](https://huggingface.co/spaces/your-username/kidney-ct-classifier)
8
+
9
+ ## Sample Images
10
+ Includes `images/sample1.png` and `images/sample2.png` to try the app.
 
 
Tumor- (872).jpg ADDED
Tumor- (882).jpg ADDED
app.py ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import numpy as np
3
+ from PIL import Image
4
+ from tensorflow.keras.models import load_model
5
+ from huggingface_hub import hf_hub_download
6
+
7
+ model_path = hf_hub_download(repo_id="TaliZG03/kidney_normal_CT_classifier_model", filename="model.keras")
8
+ model = load_model(model_path)
9
+
10
+ def preprocess(image):
11
+ image = image.resize((300, 300)).convert("RGB")
12
+ image = np.array(image) / 255.0
13
+ return np.expand_dims(image, axis=0)
14
+
15
+ def predict(image):
16
+ input_array = preprocess(image)
17
+ prediction = model.predict(input_array)[0][0]
18
+ label = "NORMAL" if prediction >= 0.5 else "ABNORMAL"
19
+ confidence = prediction if label == "NORMAL" else 1 - prediction
20
+
21
+ if label == "NORMAL" and confidence >= 0.7:
22
+ explanation = "βœ… The kidney CT scan appears normal with high confidence."
23
+ attention_flag = ""
24
+ elif label == "NORMAL" and confidence < 0.7:
25
+ explanation = "⚠️ The scan appears normal, but the model's confidence is low. Consider radiologist review."
26
+ attention_flag = "🚨 FLAGGED FOR RADIOLOGIST REVIEW"
27
+ else:
28
+ explanation = "⚠️ The kidney CT scan shows signs of abnormality. Immediate radiologist attention is recommended."
29
+ attention_flag = "🚨 FLAGGED FOR RADIOLOGIST REVIEW"
30
+
31
+ return f""" Prediction: {label}
32
+ πŸ”Ž Confidence: {confidence:.2%}
33
+
34
+ {explanation}
35
+ {attention_flag}"""
36
+
37
+ demo = gr.Interface(
38
+ fn=predict,
39
+ inputs=gr.Image(type="pil"),
40
+ outputs="text",
41
+ title="Kidney CT Classifier",
42
+ description="Upload a kidney CT image. The model will predict if it's NORMAL or ABNORMAL. Flagged results go to radiologist review.",
43
+ examples=["images/sample1.png", "images/sample2.png"]
44
+ )
45
+
46
+ if __name__ == "__main__":
47
+ demo.launch()
requirements.txt ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ gradio
2
+ numpy
3
+ Pillow
4
+ tensorflow
5
+ huggingface_hub