This system supports disease-group classification from Vietnamese symptom descriptions, including:
DiseaseClassificationAPI: FastAPI backend + ML model (TF-IDF + SVD + BERT embeddings) + short Gemini-based analysis.DiseaseClassificationWeb: ASP.NET Core MVC interface for entering symptoms and viewing results.
Processing flow:
- Users enter symptoms on the web app (
DiseaseClassificationWeb). - The web app calls FastAPI endpoint
POST /predict-with-analysis. - FastAPI:
- Vietnamese preprocessing (
pyvi). - Hybrid feature extraction (BERT + TF-IDF/SVD).
- Disease-group prediction using a trained SVM model.
- Gemini call to generate a short reference explanation.
- The web app displays
disease_classandanalysisto users.
- Backend API: FastAPI, Pydantic, Uvicorn
- Machine Learning: scikit-learn, torch, transformers, pyvi
- Model storage: Hugging Face Hub (
Marcoh05P/disease-classification-model) - Analysis LLM: Google Gemini (
google-genai) - Frontend Web: ASP.NET Core MVC (
net10.0)
DiseaseClassificationWebsite/
|-- DiseaseClassificationAPI/
| |-- main.py
| |-- settings.py
| `-- requirements.txt
|-- DiseaseClassificationWeb/
| |-- Program.cs
| |-- appsettings.json
| |-- Controllers/
| |-- Services/
| |-- Models/
| `-- Views/
`-- README.md
- Python 3.10+ (3.11 recommended)
- .NET SDK 10.0 (based on
TargetFramework: net10.0) - Internet connection for first-time model download from Hugging Face
- Gemini API key (required for analysis endpoint)
From the project root:
cd DiseaseClassificationAPI
python -m venv .venvActivate virtual environment:
- Windows CMD:
.venv\Scripts\activate- PowerShell:
.\.venv\Scripts\Activate.ps1Install dependencies:
pip install -r requirements.txtCreate DiseaseClassificationAPI/.env (optional but recommended):
GEMINI_API_KEY=your_api_key_hereRun API:
uvicorn main:app --host 0.0.0.0 --port 8000 --reloadDefault API URL: http://localhost:8000
Swagger UI: http://localhost:8000/docs
Open a new terminal, from the project root:
cd DiseaseClassificationWeb
dotnet restore
dotnet runDefault web URLs:
http://localhost:5079- or
https://localhost:7067
The web app calls FastAPI based on:
- File:
DiseaseClassificationWeb/appsettings.json - Key:
FastApiSettings:BaseUrl - Default value:
http://localhost:8000
Accepts symptom text and returns predicted disease group.
Request:
{
"text": "I have a fever, cough, and sore throat"
}Response:
{
"disease_class": "..."
}Returns predicted disease group and a reference analysis from Gemini.
Request:
{
"text": "I have a fever, cough, and sore throat"
}Response:
{
"disease_class": "...",
"analysis": "..."
}curl -X POST http://localhost:8000/predict \
-H "Content-Type: application/json" \
-d "{\"text\":\"I have a headache and mild fever\"}"curl -X POST http://localhost:8000/predict-with-analysis \
-H "Content-Type: application/json" \
-d "{\"text\":\"I have a headache and mild fever\"}"503 Service Unavailable:- Model is still loading or failed to download from Hugging Face.
GEMINI_API_KEYis missing when calling/predict-with-analysis.
- Web shows API connection error:
- Verify FastAPI is running on the expected port.
- Verify
FastApiSettings:BaseUrlinappsettings.json.
- Slow startup on first API run:
- Initial model/tokenizer download.
System outputs are for reference only and do not replace diagnosis or advice from qualified medical professionals.
The Disease Classification Website project was developed for research and experimentation in applying machine learning and natural language processing to classify disease groups from Vietnamese symptom descriptions. The system combines multiple technology components, including an ML model, backend API, and web interface, to provide an end-to-end pipeline from user input to prediction and reference analysis.
Key contributions include:
- Building a disease classification model using hybrid feature extraction from TF-IDF, SVD, and BERT embeddings, combined with Support Vector Machine (SVM) to improve semantic representation for Vietnamese text.
- Developing a FastAPI prediction service to deploy the machine learning model as a web API.
- Building an ASP.NET Core MVC user interface for symptom input and prediction output.
- Integrating Gemini to generate short explanatory text that helps users interpret prediction results.
This project is published publicly for learning, research, and reference in Machine Learning, Natural Language Processing, and AI-integrated web system development. Improvements, bug reports, and enhancement proposals are welcome via pull requests or issues on the project GitHub repository.
License: CC BY-NC 4.0 – Non-commercial use only.
© 2026 Marcoh05P – Disease Classification Website – Ho Chi Minh City Open University
