VibecoderMcSwaggins commited on
Commit
34b1b27
·
1 Parent(s): 8290bc9

docs(deploy): add explicit frontend HF Space deployment steps

Browse files

- Add warning: do NOT push full repo to frontend Space
- Add step-by-step deployment commands with temp directory workflow
- Clarify sdk: static vs sdk: docker distinction
- Prevent future misconfiguration

Files changed (1) hide show
  1. docs/guides/deployment.md +39 -5
docs/guides/deployment.md CHANGED
@@ -58,22 +58,56 @@ Note: HuggingFace sets `SPACE_ID` automatically, but our detection uses `HF_SPAC
58
 
59
  ## Frontend: HuggingFace Spaces (Static SDK)
60
 
 
 
 
61
  ### Steps
62
 
63
  1. **Create a Static SDK Space**:
64
  - SDK: **Static**
65
  - No hardware needed (static files only)
66
 
67
- 2. **Build and deploy**:
68
  ```bash
69
  cd frontend
70
  npm install
71
- VITE_API_URL=https://your-backend.hf.space npm run build
72
- # Copy dist/* to your Static Space
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
73
  ```
74
 
75
- 3. **Configure API URL**:
76
- Set `VITE_API_URL` at build time to point to your backend Space.
 
 
 
77
 
78
  ## Local Development
79
 
 
58
 
59
  ## Frontend: HuggingFace Spaces (Static SDK)
60
 
61
+ > **⚠️ IMPORTANT:** Do NOT push the full repo to the frontend Space. Only push the
62
+ > built `dist/` files. The frontend Space uses `sdk: static`, not `sdk: docker`.
63
+
64
  ### Steps
65
 
66
  1. **Create a Static SDK Space**:
67
  - SDK: **Static**
68
  - No hardware needed (static files only)
69
 
70
+ 2. **Build the frontend**:
71
  ```bash
72
  cd frontend
73
  npm install
74
+ npm run build # Uses .env.production for VITE_API_URL
75
+ ```
76
+
77
+ 3. **Deploy to HF Space** (from a temp directory):
78
+ ```bash
79
+ # Create deployment directory
80
+ cd /tmp && rm -rf hf-frontend && mkdir hf-frontend && cd hf-frontend
81
+ git init
82
+
83
+ # Copy built files
84
+ cp -r /path/to/stroke-deepisles-demo/frontend/dist/* .
85
+
86
+ # Create README with Static SDK metadata
87
+ cat > README.md << 'EOF'
88
+ ---
89
+ title: Stroke Viewer Frontend
90
+ emoji: "🧠"
91
+ colorFrom: blue
92
+ colorTo: purple
93
+ sdk: static
94
+ pinned: false
95
+ ---
96
+ # Stroke Viewer Frontend
97
+ React SPA for DeepISLES stroke segmentation.
98
+ EOF
99
+
100
+ # Push to HF Space
101
+ git add -A && git commit -m "deploy: static frontend"
102
+ git remote add hf https://huggingface.co/spaces/YOUR_ORG/YOUR_FRONTEND_SPACE
103
+ git push hf main --force
104
  ```
105
 
106
+ 4. **Configure API URL**:
107
+ Edit `frontend/.env.production` before building to set the backend URL:
108
+ ```
109
+ VITE_API_URL=https://your-backend.hf.space
110
+ ```
111
 
112
  ## Local Development
113