|
--- |
|
title: Microbial Susceptibility Analyzer |
|
emoji: π |
|
colorFrom: blue |
|
colorTo: indigo |
|
sdk: streamlit |
|
sdk_version: 1.43.2 |
|
app_file: app.py |
|
pinned: false |
|
license: mit |
|
thumbnail: >- |
|
https://cdn-uploads.huggingface.co/production/uploads/64774490312e3909019550f0/JWfMLBEIsP543Hu2G5yAR.jpeg |
|
--- |
|
|
|
# Microbial Susceptibility Analyzer |
|
|
|
## Overview |
|
The Microbial Susceptibility Analyzer is a Streamlit-based web application that combines machine learning and rule-based decision making to predict antibiotic resistance patterns. The application provides: |
|
- Susceptibility predictions for organism-antibiotic combinations |
|
- Rule-based guidance for treatment decisions |
|
- AI-powered explanations and recommendations |
|
- Batch prediction capabilities for CSV datasets |
|
|
|
## Installation |
|
|
|
1. Clone the repository: |
|
```bash |
|
git clone https://github.com/yourusername/microbial-susceptibility-analyzer.git |
|
cd microbial-susceptibility-analyzer |
|
``` |
|
|
|
2. Create a virtual environment: |
|
```bash |
|
python -m venv venv |
|
source venv/bin/activate # On Windows use: venv\Scripts\activate |
|
``` |
|
|
|
3. Install dependencies: |
|
```bash |
|
pip install -r requirements.txt |
|
``` |
|
|
|
4. Set up environment variables: |
|
Create a `.streamlit/secrets.toml` file with your API keys: |
|
```toml |
|
OPENAI_API_KEY = "your_openai_api_key" |
|
OPENAI_BASE_URL = "https://api.openai.com/v1" |
|
``` |
|
|
|
## Usage |
|
|
|
Run the application: |
|
```bash |
|
streamlit run app.py |
|
``` |
|
|
|
The application provides several pages: |
|
- **Home**: Project overview and introduction |
|
- **Susceptibility Analysis**: Single prediction interface |
|
- **AI Assistant**: Expert system for detailed explanations |
|
- **Data Upload**: Batch prediction for CSV files |
|
- **About**: Project information and contact details |
|
|
|
## File Structure |
|
|
|
``` |
|
microbial-susceptibility-analyzer/ |
|
βββ app.py # Main application file |
|
βββ prediction.py # Prediction logic |
|
βββ ai_assistant.py # AI integration |
|
βββ utils.py # Utility functions |
|
βββ config.py # Configuration settings |
|
βββ requirements.txt # Python dependencies |
|
βββ README.md # This documentation |
|
βββ label_encoders/ # Label encoding files |
|
β βββ organism_label_encoder.json |
|
β βββ antibiotic_label_encoder.json |
|
β βββ ... |
|
βββ models/ # Trained models |
|
β βββ best_model.pkl |
|
β βββ best_model_1.pkl |
|
βββ data/ # Data files |
|
βββ implied_susceptibility_rules.csv |
|
βββ microbiology_cultures_implied_susceptibility.csv |
|
``` |
|
|
|
## Configuration |
|
|
|
The application requires the following configuration: |
|
|
|
1. **Model Path**: Set in `config.py` |
|
2. **Encoder Directory**: Set in `config.py` |
|
3. **OpenAI API**: Configure in `.streamlit/secrets.toml` |
|
|
|
## License |
|
|
|
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. |
|
|
|
## Contact |
|
|
|
For questions or support, contact: |
|
Chukwuebuka Anulunko |
|
[email protected] |