Stroke-ia commited on
Commit
35a568d
·
verified ·
1 Parent(s): 5d1c5a6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -23
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
- irm3d_files = st.file_uploader(
219
- "Uploader les 4 fichiers IRM (FLAIR, T1, T1CE, T2)",
220
- type=["nii", "nii.gz"],
221
- accept_multiple_files=True,
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
- tmp_path = os.path.join(SAVE_DIR, f.name)
232
- with open(tmp_path, "wb") as out:
233
  out.write(f.read())
234
- tmp_paths.append(tmp_path)
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="Masque segmenté (vue 2D)", use_container_width=True)
245
 
246
- # ---------------- Disclaimer ----------------
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
- ⚠️ **Disclaimer :** Stroke-IA est une démo technique, pas un avis médical.
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
  """)