Spaces:
Sleeping
Sleeping
File size: 1,449 Bytes
187fe66 1c19b2e 187fe66 1c19b2e 187fe66 1c19b2e 3fc327c 1c19b2e a2af649 1c19b2e a2af649 1c19b2e a2af649 1c19b2e | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | ---
title: SHIA - Brain MRI Segmentation
emoji: 🧠
colorFrom: blue
colorTo: purple
sdk: docker
app_port: 7860
pinned: false
license: mit
---
# SHIA - Structured Health Intelligence for Alzheimer's
Fast GPU-accelerated brain MRI segmentation API.
## Setup Instructions
### 1. Convert the model (run locally first)
```bash
# Install conversion dependencies
pip install tensorflowjs tensorflow
# Convert tfjs model to H5 format
cd huggingface
python convert_model.py ../public/models/model18cls ./model18cls
```
### 2. Upload to Hugging Face Space
The `model18cls/` folder should now contain `model.h5` and `saved_model/`.
## API Endpoints
### POST /segment/tensor (Recommended)
Upload pre-processed tensor data (256³ uint8, gzipped) for GPU inference.
This is the recommended endpoint as it ensures identical preprocessing to local inference.
```bash
# Frontend sends the conformed tensor from NiiVue directly
# See atrophy/main.js for implementation
```
### POST /segment
Upload a NIfTI file (.nii or .nii.gz) for segmentation.
Note: Server-side preprocessing may differ slightly from local NiiVue preprocessing.
```bash
curl -X POST -F "file=@brain.nii.gz" https://YOUR-SPACE.hf.space/segment
```
### POST /segment/compact
Same as /segment but returns base64-gzipped results.
### GET /health
Check API status and GPU availability.
## Credits
Based on [BrainChop](https://github.com/neuroneural/brainchop) by the Neuroneural Lab.
|