Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -212,44 +212,32 @@ if stroke_file and st.button("Analyser l'IRM Stroke", key="stroke_button"):
|
|
| 212 |
else:
|
| 213 |
st.image(result_path_stroke, caption="Stroke annotée", use_container_width=True)
|
| 214 |
|
| 215 |
-
# ---------------- Upload IRM 3D (NIfTI) ----------------
|
| 216 |
-
st.header("🧠 Analyse IRM 3D (NIfTI)")
|
| 217 |
|
| 218 |
-
|
| 219 |
-
|
| 220 |
-
|
| 221 |
-
|
| 222 |
-
key="irm3d_uploader"
|
| 223 |
-
)
|
| 224 |
-
|
| 225 |
-
if irm3d_files and st.button("Analyser l'IRM 3D", key="irm3d_button"):
|
| 226 |
if len(irm3d_files) != 4:
|
| 227 |
st.error("⚠️ Merci d’uploader exactement 4 fichiers IRM (FLAIR, T1, T1CE, T2)")
|
| 228 |
else:
|
| 229 |
tmp_paths = []
|
| 230 |
for f in irm3d_files:
|
| 231 |
-
|
| 232 |
-
with open(
|
| 233 |
out.write(f.read())
|
| 234 |
-
tmp_paths.append(
|
| 235 |
-
|
| 236 |
seg, report_text, (nii_path, report_path, mask_path) = irm_cancer_module.run(tmp_paths)
|
| 237 |
-
|
| 238 |
-
# Affichage rapport
|
| 239 |
-
st.subheader("📄 Rapport automatique")
|
| 240 |
st.text(report_text)
|
| 241 |
-
|
| 242 |
-
# Affichage masque segmenté
|
| 243 |
if mask_path and os.path.exists(mask_path):
|
| 244 |
-
st.image(mask_path, caption="
|
| 245 |
|
| 246 |
-
#
|
| 247 |
st.markdown(f"""
|
| 248 |
---
|
| 249 |
👨💻 **Badsi Djilali** — Ingénieur Deep Learning
|
| 250 |
🚀 Créateur de **Stroke_IA_Detection**
|
| 251 |
-
🧠 (Détection d'asymétrie faciale & AVC par IA)
|
| 252 |
|
| 253 |
-
⚠️
|
| 254 |
© {datetime.now().year} — Badsi Djilali.
|
| 255 |
""")
|
|
|
|
| 212 |
else:
|
| 213 |
st.image(result_path_stroke, caption="Stroke annotée", use_container_width=True)
|
| 214 |
|
|
|
|
|
|
|
| 215 |
|
| 216 |
+
# Upload IRM 3D (cancer)
|
| 217 |
+
st.header("🧠 Détection Tumeur (IRM 3D)")
|
| 218 |
+
irm3d_files = st.file_uploader("Uploader 4 séquences (FLAIR, T1, T1CE, T2)", type=["nii", "nii.gz"], accept_multiple_files=True)
|
| 219 |
+
if irm3d_files and st.button("Analyser IRM 3D"):
|
|
|
|
|
|
|
|
|
|
|
|
|
| 220 |
if len(irm3d_files) != 4:
|
| 221 |
st.error("⚠️ Merci d’uploader exactement 4 fichiers IRM (FLAIR, T1, T1CE, T2)")
|
| 222 |
else:
|
| 223 |
tmp_paths = []
|
| 224 |
for f in irm3d_files:
|
| 225 |
+
path = os.path.join(SAVE_DIR, f.name)
|
| 226 |
+
with open(path, "wb") as out:
|
| 227 |
out.write(f.read())
|
| 228 |
+
tmp_paths.append(path)
|
|
|
|
| 229 |
seg, report_text, (nii_path, report_path, mask_path) = irm_cancer_module.run(tmp_paths)
|
| 230 |
+
st.subheader("📝 Rapport automatique")
|
|
|
|
|
|
|
| 231 |
st.text(report_text)
|
|
|
|
|
|
|
| 232 |
if mask_path and os.path.exists(mask_path):
|
| 233 |
+
st.image(mask_path, caption="Segmentation annotée", use_container_width=True)
|
| 234 |
|
| 235 |
+
# Disclaimer
|
| 236 |
st.markdown(f"""
|
| 237 |
---
|
| 238 |
👨💻 **Badsi Djilali** — Ingénieur Deep Learning
|
| 239 |
🚀 Créateur de **Stroke_IA_Detection**
|
|
|
|
| 240 |
|
| 241 |
+
⚠️ Démo technique, pas un avis médical.
|
| 242 |
© {datetime.now().year} — Badsi Djilali.
|
| 243 |
""")
|