File size: 1,300 Bytes
61b0d5a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# 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`.