An intelligent AI-powered voice agent for medical consultation that analyzes patient symptoms and provides preliminary diagnosis and treatment recommendations using machine learning.
- Overview
- Features
- System Requirements
- Installation
- Usage
- API Documentation
- Deployment
- Project Structure
- Troubleshooting
- Disclaimer
- Team
MediTalk is designed to democratize healthcare access by providing an AI-powered medical consultation assistant that:
- Analyzes Symptoms: Takes patient-reported symptoms as input
- Predicts Diseases: Uses machine learning to identify potential diseases
- Provides Recommendations: Delivers treatment suggestions and precautions
- Ensures Accessibility: Works offline with zero-cost implementation
- High consultation fees prevent people from seeking timely medical care
- Long waiting times discourage patients from getting necessary treatment
- Limited availability of doctors in remote and rural areas
- Early symptom evaluation can prevent disease progression and save lives
MediTalk leverages AI, NLP, and voice-based interaction to make healthcare support more accessible and affordable by simulating phone conversations, analyzing symptoms, and providing preliminary diagnosis and treatment suggestions.
- 🎯 Accurate Disease Prediction: Machine learning model trained on 4,900+ disease-symptom mappings
- 📖 Detailed Disease Information: Comprehensive descriptions and precautions for 40+ diseases
- 💊 Personalized Recommendations: Customized treatment suggestions based on diagnosis
- 🎤 Voice Interface: Speech-to-text and text-to-speech capabilities
- 🌐 Web Interface: User-friendly Streamlit web application
- 🔌 REST API: Complete API for integration with other systems
- 📊 Multi-symptom Analysis: Analyzes multiple symptoms for accurate diagnosis
- 🔄 Alternative Predictions: Provides alternative disease possibilities with confidence scores
- OS: Windows 10/11, macOS 10.14+, or Linux (Ubuntu 18.04+)
- Python: 3.8 or higher
- RAM: 4 GB minimum (8 GB recommended)
- Disk Space: 500 MB for installation and models
- Internet: Required for initial setup (optional for runtime)
All dependencies are listed in requirements.txt and will be installed automatically.
# If you have a zip file, extract it first
unzip MediTalk_AI_Agent.zip
cd MediTalk_AI_AgentOn Windows:
python -m venv venv
venv\Scripts\activateOn macOS/Linux:
python3 -m venv venv
source venv/bin/activatepip install -r requirements.txtThis will install:
- Streamlit (web interface)
- pandas & numpy (data processing)
- scikit-learn (machine learning)
- pyttsx3 & SpeechRecognition (voice processing)
- Flask & Flask-CORS (API server)
- And other required packages
Before running the application, you need to train the machine learning model:
cd src
python model_trainer.pyThis process will:
- Load and preprocess the medical datasets
- Create feature vectors from symptoms
- Train a Random Forest classifier
- Save the trained model to the
models/directory - Display model performance metrics
Expected Output:
Loading datasets...
Dataset shape: (4922, 18)
Unique diseases: 41
Preprocessing data...
Total unique symptoms: 131
Total unique diseases: 41
Preparing data for training...
Creating feature matrix...
Feature matrix shape: (4922, 131)
Training model...
[Parallel(n_jobs=-1)]: Using backend ThreadingBackend with 8 workers.
Model Performance:
Accuracy: 0.8523
Precision: 0.8456
Recall: 0.8523
F1 Score: 0.8489
Model saved to models
Training pipeline completed successfully!
Run the Streamlit web application:
streamlit run src/app.pyThe application will open in your default browser at http://localhost:8501
Features:
- Home: Overview and statistics
- Symptom Checker: Input symptoms and get predictions
- Disease Database: Browse all diseases and their information
- About: Project information and disclaimer
Run the Flask API server:
python src/api_server.pyThe API will be available at http://localhost:5000
Example API Call:
curl -X POST http://localhost:5000/api/predict \
-H "Content-Type: application/json" \
-d '{"symptoms": ["high_fever", "cough", "fatigue"]}'Run the voice interface directly:
python src/voice_interface.pyOr use the disease predictor programmatically:
from disease_predictor import DiseasePredictor
# Initialize predictor
predictor = DiseasePredictor('models', 'data')
# Make prediction
result = predictor.predict_disease(['high_fever', 'cough', 'fatigue'])
print(f"Disease: {result['primary_disease']}")
print(f"Confidence: {result['confidence']:.2%}")
print(f"Description: {result['description']}")
print(f"Precautions: {', '.join(result['precautions'])}")http://localhost:5000
GET /api/health
Response:
{
"status": "healthy",
"service": "MediTalk API",
"version": "1.0.0"
}POST /api/predict
Request Body:
{
"symptoms": ["high_fever", "cough", "fatigue"]
}Response:
{
"primary_disease": "Bronchial Asthma",
"confidence": 0.85,
"description": "Bronchial asthma is a medical condition...",
"precautions": ["switch to loose clothing", "take deep breaths", ...],
"alternative_diseases": ["Pneumonia", "Common Cold"],
"alternative_probabilities": [0.12, 0.03],
"input_symptoms": ["high_fever", "cough", "fatigue"],
"recognized_symptoms": ["high_fever", "cough", "fatigue"]
}POST /api/validate-symptoms
Request Body:
{
"symptoms": ["high_fever", "unknown_symptom"]
}Response:
{
"valid_symptoms": ["high_fever"],
"invalid_symptoms": ["unknown_symptom"],
"all_valid": false
}GET /api/symptoms
Response:
{
"symptoms": ["high_fever", "cough", "fatigue", ...]
}GET /api/diseases
Response:
{
"diseases": ["Bronchial Asthma", "Pneumonia", "Common Cold", ...]
}GET /api/disease/<disease_name>
Response:
{
"disease": "Bronchial Asthma",
"description": "Bronchial asthma is a medical condition...",
"precautions": ["switch to loose clothing", "take deep breaths", ...]
}GET /api/stats
Response:
{
"total_diseases": 41,
"total_symptoms": 131,
"model_type": "Random Forest Classifier",
"framework": "scikit-learn"
}The application is ready to run on your local machine:
- Install dependencies:
pip install -r requirements.txt - Train model:
python src/model_trainer.py - Run web app:
streamlit run src/app.py - Access: Open
http://localhost:8501in your browser
Create a Dockerfile:
FROM python:3.9-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install -r requirements.txt
COPY . .
EXPOSE 8501 5000
CMD ["streamlit", "run", "src/app.py", "--server.port=8501", "--server.address=0.0.0.0"]Build and run:
docker build -t meditalk .
docker run -p 8501:8501 -p 5000:5000 meditalk- Create
Procfile:
web: streamlit run src/app.py --server.port=$PORT --server.address=0.0.0.0
- Deploy:
heroku create meditalk
git push heroku main- Containerize: Use Docker as shown above
- Push to Registry: Push Docker image to ECR/GCR/ACR
- Deploy: Use ECS/Cloud Run/App Service
- Configure: Set environment variables and resource limits
MediTalk_AI_Agent/
├── data/ # Medical datasets
│ ├── dataset.csv # Disease-symptom mappings
│ ├── symptom_Description.csv # Disease descriptions
│ ├── symptom_precaution.csv # Precautions for diseases
│ └── Symptom-severity.csv # Symptom severity weights
│
├── models/ # Trained models (generated after training)
│ ├── disease_model.pkl # Trained Random Forest model
│ ├── label_encoder.pkl # Disease label encoder
│ ├── symptoms_list.pkl # List of all symptoms
│ └── diseases_list.pkl # List of all diseases
│
├── src/ # Source code
│ ├── app.py # Streamlit web application
│ ├── api_server.py # Flask REST API server
│ ├── data_processor.py # Data loading and preprocessing
│ ├── disease_predictor.py # Disease prediction logic
│ ├── model_trainer.py # Model training script
│ └── voice_interface.py # Voice interface (STT/TTS)
│
├── docs/ # Documentation
│ ├── API_GUIDE.md # Detailed API documentation
│ ├── DEPLOYMENT_GUIDE.md # Deployment instructions
│ └── TROUBLESHOOTING.md # Troubleshooting guide
│
├── tests/ # Unit tests
│ └── test_predictor.py # Tests for disease predictor
│
├── requirements.txt # Python dependencies
├── README.md # This file
└── .env.example # Environment variables template
Error: FileNotFoundError: disease_model.pkl not found
Solution:
- Ensure you've run
python src/model_trainer.py - Check that the
models/directory exists - Verify all model files are present:
disease_model.pkllabel_encoder.pklsymptoms_list.pkldiseases_list.pkl
Error: Address already in use
Solution:
# Use a different port
streamlit run src/app.py --server.port 8502Error: pyttsx3 initialization failed or microphone not detected
Solution:
-
For text-to-speech: Install system dependencies:
- Windows: Usually works out of the box
- macOS: May require
brew install espeak - Linux:
sudo apt-get install espeak
-
For speech-to-text: Ensure microphone is connected and working
-
Alternative: Use the web interface which doesn't require voice
Possible Causes:
- Symptoms not in the training dataset
- Unusual symptom combinations
- Multiple diseases with similar symptoms
Solutions:
- Verify symptoms are correctly spelled
- Use symptoms from the disease database
- Provide more specific symptoms
- Always consult a healthcare professional
Error: MemoryError or Out of memory
Solution:
- Close other applications
- Use a machine with more RAM
- Reduce batch size in
model_trainer.py
IMPORTANT: This application is for educational and informational purposes only. It should NOT be used as a substitute for professional medical advice, diagnosis, or treatment.
- This tool provides preliminary diagnosis based on symptom analysis
- Results are not guaranteed to be accurate
- Always consult with a qualified healthcare professional for proper diagnosis and treatment
- In case of medical emergencies, call emergency services immediately
- The developers are not responsible for any health decisions made based on this tool
- Amar Jaleel (023-23-0362)
- Azhar Ali (023-23-0314)
- Hariz Zafar (023-23-0439)
- Machine Learning: scikit-learn (Random Forest Classifier)
- Frontend: Streamlit
- Backend: Flask
- Data Processing: Pandas, NumPy
- Voice Processing: pyttsx3, SpeechRecognition
- Database: CSV-based (SQLite optional)
- Multilingual support (Spanish, Hindi, Arabic, etc.)
- Telemedicine integration with real doctors
- Enhanced medical dataset with rare diseases
- Mobile app development (iOS/Android)
- Real-time doctor consultation
- Symptom severity assessment
- Patient history tracking
- Integration with electronic health records (EHR)
For issues, questions, or suggestions:
- Check the troubleshooting section
- Review the API documentation
- Check the logs in the console output
- Refer to the project documentation in
docs/folder
This project is provided as-is for educational purposes.
Last Updated: November 2025 Version: 1.0.0