| # Sea Ice Segmentation β Hugging Face Space | |
| Gradio app that runs MMSegmentation SegFormer-B5 on RGB images and returns an overlayed segmentation result. | |
| ## Repo layout | |
| - `app.py` β Gradio UI and inference code. | |
| - `requirements.txt` β Python dependencies for the Space. | |
| - `model/` | |
| - `segformer_mit-b5_8xb1-160k_pre-cityscapes_seaicergb0-1024x1024.py` β MMSeg config. | |
| - `iter_160000.pth` β trained checkpoint (tracked with Git LFS). | |
| ## Run locally (optional) | |
| ```bash | |
| pip install -r requirements.txt | |
| python app.py | |
| ``` | |
| ## Deploy to Hugging Face Spaces | |
| 1. Create a new Space (SDK: Gradio). CPU is fine; GPU optional for faster inference. | |
| 2. Push this repo to the Space remote. Ensure LFS is enabled for the `.pth`: | |
| ```bash | |
| git lfs install | |
| git lfs track "model/*.pth" | |
| git add .gitattributes model/iter_160000.pth | |
| git commit -m "Add checkpoint via LFS" | |
| git push | |
| ``` | |
| 3. The Space will build and start. First cold-start may take a few minutes while installing dependencies. | |
| ## Notes | |
| - If your config defines `classes` and `palette`, the app will use them automatically; otherwise it falls back to generated colors. | |
| - Large input images are supported; overlay alpha can be adjusted in the UI. | |
| - To switch checkpoints or configs, update the paths at the top of `app.py`. | |