Claude
commited on
feat(frontend): add COOP/COEP headers and documentation (BUG-003, BUG-007, BUG-008)
Browse files- Add custom_headers to HF Space config for SharedArrayBuffer support:
- cross-origin-embedder-policy: require-corp
- cross-origin-opener-policy: same-origin
- cross-origin-resource-policy: cross-origin
- Add Browser Requirements section documenting WebGL2 needs
- Add Fork Deployment section with instructions for customizing
API URL and CORS settings
- frontend/README.md +28 -0
frontend/README.md
CHANGED
|
@@ -9,6 +9,10 @@ app_build_command: npm run build
|
|
| 9 |
# CRITICAL: Vite 7 requires Node.js >= 20. HF Spaces defaults to Node 18.
|
| 10 |
nodejs_version: "20"
|
| 11 |
pinned: false
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
---
|
| 13 |
|
| 14 |
# Stroke Lesion Segmentation Viewer
|
|
@@ -23,6 +27,13 @@ Built with React, TypeScript, Tailwind CSS, and Vite.
|
|
| 23 |
- **Real-time Segmentation**: Run DeepISLES inference on ISLES24 dataset cases
|
| 24 |
- **Metrics Display**: Dice score, volume (mL), processing time
|
| 25 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
## Architecture
|
| 27 |
|
| 28 |
This is the **frontend Static Space** of a two-Space deployment:
|
|
@@ -77,3 +88,20 @@ npm run build
|
|
| 77 |
|
| 78 |
# The dist/ folder is deployed to HF Static Space
|
| 79 |
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
# CRITICAL: Vite 7 requires Node.js >= 20. HF Spaces defaults to Node 18.
|
| 10 |
nodejs_version: "20"
|
| 11 |
pinned: false
|
| 12 |
+
custom_headers:
|
| 13 |
+
cross-origin-embedder-policy: require-corp
|
| 14 |
+
cross-origin-opener-policy: same-origin
|
| 15 |
+
cross-origin-resource-policy: cross-origin
|
| 16 |
---
|
| 17 |
|
| 18 |
# Stroke Lesion Segmentation Viewer
|
|
|
|
| 27 |
- **Real-time Segmentation**: Run DeepISLES inference on ISLES24 dataset cases
|
| 28 |
- **Metrics Display**: Dice score, volume (mL), processing time
|
| 29 |
|
| 30 |
+
## Browser Requirements
|
| 31 |
+
|
| 32 |
+
- **WebGL2 Required**: This viewer uses NiiVue which requires WebGL2 support.
|
| 33 |
+
- Supported browsers: Chrome 56+, Firefox 51+, Safari 15+, Edge 79+
|
| 34 |
+
- Test your browser: https://get.webgl.org/webgl2/
|
| 35 |
+
- Mobile devices may have limited support
|
| 36 |
+
|
| 37 |
## Architecture
|
| 38 |
|
| 39 |
This is the **frontend Static Space** of a two-Space deployment:
|
|
|
|
| 88 |
|
| 89 |
# The dist/ folder is deployed to HF Static Space
|
| 90 |
```
|
| 91 |
+
|
| 92 |
+
## Fork Deployment
|
| 93 |
+
|
| 94 |
+
If you fork this repository, update these files before deploying:
|
| 95 |
+
|
| 96 |
+
1. **Frontend API URL** (`frontend/.env.production`):
|
| 97 |
+
```
|
| 98 |
+
VITE_API_URL=https://{YOUR_HF_USERNAME}-stroke-deepisles-demo.hf.space
|
| 99 |
+
```
|
| 100 |
+
|
| 101 |
+
2. **Backend CORS** (`src/stroke_deepisles_demo/api/main.py`):
|
| 102 |
+
Update the `allow_origin_regex` to match your frontend Space URL.
|
| 103 |
+
|
| 104 |
+
3. **Rebuild frontend**:
|
| 105 |
+
```bash
|
| 106 |
+
cd frontend && npm run build
|
| 107 |
+
```
|