AI-powered OSCC (Oral Cancer) detection from biopsy slides — Next.js dashboard + FastAPI ML backend.
Browser → Next.js (frontend) → Your FastAPI server → Swin Transformer model
→ MongoDB Atlas (auth + records)
The inference backend is open — duplicate it from HuggingFace Spaces:
https://huggingface.co/spaces/immohitsen/oncofastapi
- Click "Duplicate this Space" (top-right button)
- Give it a name and click Duplicate Space — HuggingFace builds it automatically
- Once running, your API URL will be:
https://YOUR-USERNAME-YOUR-SPACE-NAME.hf.space - Verify it works:
curl https://YOUR-USERNAME-YOUR-SPACE-NAME.hf.space/ # {"status":"online","model_loaded":true,...}
You can also run it locally — clone the Space repo and run:
pip install -r requirements.txt uvicorn main:app --port 8000
- Create a free cluster at cloud.mongodb.com
- Create a database user and copy the connection string
- Whitelist your IP (or
0.0.0.0/0for dev)
git clone https://github.com/your-username/oncoscan.git
cd oncoscan
npm installCreate .env in the oncoscan/ folder:
FASTAPI_URL="https://YOUR-USERNAME-YOUR-SPACE-NAME.hf.space"
MONGODB_URI="mongodb+srv://<user>:<pass>@<cluster>.mongodb.net/oncoscan"Start:
npm run dev
# http://localhost:3000| Frontend | Next.js 16, React 19, Tailwind CSS |
| Auth | JWT + bcryptjs, MongoDB Atlas |
| ML API | FastAPI, Swin Transformer (HuggingFace) |
| Problem | Fix |
|---|---|
Model not loaded |
Your Space is still building — wait ~2 min and refresh |
bad auth on MongoDB |
Check username/password and IP whitelist in Atlas |
| Port 3000 in use | Next.js auto-switches to 3001 |