This guide covers the current production deployment and how to redeploy or run locally.
| Service | Platform | URL |
|---|---|---|
| Frontend | Vercel | neuroscan.vercel.app |
| Backend API | Hugging Face Spaces | yashnaiduu-neurosacn.hf.space |
- Python 3.9+
- Docker (for containerized deployment)
- Git
- Hugging Face account (for backend)
- Vercel account (for frontend)
| Variable | Required | Description |
|---|---|---|
PORT |
Optional | Backend port (default: 5050, HF Spaces: 7860) |
FLASK_ENV |
Optional | Set to production in deployment |
MODEL_URL |
Optional | Remote URL to download the .h5 model file |
No external API keys are required. MRI validation uses CLIP (runs locally).
The backend runs as a Docker container on Hugging Face Spaces.
# Clone the HF Space
git clone https://yashnaiduu:YOUR_HF_TOKEN@huggingface.co/spaces/yashnaiduu/neurosacn hf_space
cd hf_space
# Copy updated files
cp ../server1.py ../requirements.txt ../Dockerfile ../entrypoint.sh .
# Commit and push (triggers rebuild)
git add . && git commit -m "Update deployment" && git push| File | Purpose |
|---|---|
Dockerfile |
Container definition |
entrypoint.sh |
Startup script (downloads model, starts gunicorn) |
server1.py |
Flask application |
requirements.txt |
Python dependencies |
curl https://yashnaiduu-neurosacn.hf.space/healthExpected response:
{
"status": "healthy",
"model_loaded": true,
"clip_available": true,
"uptime": 3600.5
}The frontend is a static HTML/CSS/JS site deployed on Vercel.
Push to the main branch on GitHub — Vercel auto-deploys on every push.
git add client/
git commit -m "Update frontend"
git pushvercel.json handles routing — all requests are served from client/index.html.
# Clone the repository
git clone https://github.com/yashnaiduu/NeuroScan-Brain-Tumor-Classification.git
cd NeuroScan-Brain-Tumor-Classification
# Create and activate virtual environment
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
# Run backend
python server1.py # http://localhost:5050
# Run frontend (separate terminal)
cd client && python3 -m http.server 8000 # http://localhost:8000# Build
docker build -t neuroscan:latest .
# Run
docker run -d \
--name neuroscan \
-p 5050:5050 \
-e FLASK_ENV=production \
neuroscan:latest
# Check health
curl http://localhost:5050/healthSymptom: /health returns model_loaded: false
- Check
MODEL_URLis accessible and points to a valid.h5file - Check container logs for download errors
- Ensure sufficient disk space (model is ~15MB)
Symptom: Container crashes or restarts
- Increase container memory to 2GB minimum
- Reduce
WEB_CONCURRENCYinentrypoint.sh - Monitor with
/statsendpoint
Symptom: Requests take longer than expected
- CLIP model loads in the background on startup — first request may be slower
- Increase
GUNICORN_TIMEOUTif needed - CPU inference is expected; GPU instances will be significantly faster
Yash Naidu — yashnnaidu@gmail.com