Briefing

ClinicalBERT‑Powered Specialty Prediction: A Full‑Stack AI Demo

ai-dev
by Sheikh Sadi Asif · Netlify

Patch your deployment to enable CORS between Netlify and Hugging Face Spaces, monitor token limits, and add error handling for ambiguous symptom cases.

What to do now

Patch your deployment to enable CORS between Netlify and Hugging Face Spaces, monitor token limits, and add error handling for ambiguous symptom cases.

Summary

The author built a full‑stack AI system that predicts the most likely medical specialty from clinical notes, returning the top three predictions with confidence scores. The backend is a FastAPI service hosted on Hugging Face Spaces, while the frontend is a static site served from Netlify. The system uses ClinicalBERT, a model pretrained on biomedical text, to achieve higher accuracy than generic NLP models. The architecture is fully API‑based, making it a lightweight AI SaaS product. Key challenges included handling class imbalance, managing long clinical notes that exceed token limits, and resolving CORS issues between the Netlify frontend and Hugging Face backend. The author addressed these by adjusting token limits, adding CORS headers, and debugging deployment on Hugging Face Spaces. Future plans involve building a medical triage assistant, adding explainable AI, supporting multi‑label diagnosis, and integrating with hospital workflows. The project demonstrates that deployment engineering is often the hardest part of building AI products.

Key changes

  • Uses ClinicalBERT pretrained on biomedical text for better terminology understanding.
  • Frontend on Netlify, backend FastAPI on Hugging Face Spaces.
  • Predicts top 3 specialties with confidence scores.
  • Handles class imbalance and long notes exceeding token limits.
  • Resolves CORS issues between frontend and backend.
  • Deployment debugging on Hugging Face Spaces was a challenge.
  • Future plans: triage assistant, explainable AI, multi‑label diagnosis, hospital workflow integration.
  • Emphasizes that API design is critical for real‑world AI.

Affects

internal

Customer impact

Analyzing matches…

Ask about this story

Impact on an agency? Which customers? Compare historically Risks of waiting