Skip to content

Commit e98c2cd

Browse files
committed
Updated README
1 parent df45c1c commit e98c2cd

File tree

1 file changed

+36
-25
lines changed

1 file changed

+36
-25
lines changed

README.md

Lines changed: 36 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,35 @@ This project demonstrates a foundational MLOps workflow for deploying a Breast C
55
## Project Structure
66

77
```
8-
.venv/ # Python virtual environment (ignored by Git)
9-
data/ # Stores the dataset (data.csv) - Tracked by Git for CI/CD simplicity
10-
models/ # Stores the trained model (model.joblib) - Ignored by Git
11-
notebooks/ # For exploratory data analysis and experimentation
12-
src/
13-
app.py # Flask API for model inference
14-
model.py # Script for training and saving the model
15-
tests/ # For unit and integration tests
16-
.github/ # GitHub Actions workflow files
17-
workflows/
18-
main.yml # CI/CD pipeline definition
19-
Dockerfile.api # Dockerfile for the Flask API container
20-
Dockerfile.streamlit # Dockerfile for the Streamlit UI container
21-
docker-compose.yml # Defines and links multi-container Docker application
22-
requirements.txt # Python dependencies
23-
README.md # Project documentation
24-
.gitignore # Specifies files and directories to ignore in Git
25-
streamlit_app.py # Streamlit user interface for predictions
8+
breast-cancer-ops/
9+
├── .github/ # GitHub Actions workflow files
10+
│ └── workflows/
11+
│ └── main.yml # CI/CD pipeline definition
12+
├── config/ # Configuration files
13+
│ ├── docker-compose.yml # Defines and links multi-container Docker application
14+
│ ├── Dockerfile.api # Dockerfile for the Flask API container
15+
│ └── Dockerfile.streamlit # Dockerfile for the Streamlit UI container
16+
├── data/ # Stores the dataset (data.csv) - Tracked by Git for CI/CD simplicity
17+
│ └── data.csv
18+
├── docs/ # Project documentation (optional)
19+
├── logs/ # Application logs
20+
│ └── api_logs.log
21+
├── models/ # Stores the trained model (model.joblib) - Ignored by Git
22+
│ └── model.joblib
23+
├── notebooks/ # For exploratory data analysis and experimentation
24+
├── scripts/ # Utility and test scripts
25+
│ ├── bash_test.sh
26+
│ └── powershell_test.ps1
27+
├── src/ # Source code
28+
│ ├── app.py # Flask API for model inference
29+
│ ├── model.py # Script for training and saving the model
30+
│ └── streamlit_app.py # Streamlit user interface for predictions
31+
├── tests/ # For unit and integration tests
32+
│ └── sample_payload.json
33+
├── .env.example # Environment variables template
34+
├── .gitignore # Specifies files and directories to ignore in Git
35+
├── README.md # Project documentation
36+
└── requirements.txt # Python dependencies
2637
```
2738

2839
## Setup and Run
@@ -122,30 +133,30 @@ With the Flask API running locally (as described in step 6 above), you can test
122133
123134
## Streamlit UI
124135
125-
The Streamlit application (`streamlit_app.py`) provides an interactive web interface for making predictions using the Flask API.
136+
The Streamlit application (`src/streamlit_app.py`) provides an interactive web interface for making predictions using the Flask API.
126137
127138
1. **Run the Streamlit application locally:**
128139
Ensure your virtual environment is activated and the Flask API is running (as described in step 6 under "Setup and Run"), then run:
129140
```bash
130-
streamlit run streamlit_app.py
141+
streamlit run src/streamlit_app.py
131142
```
132143
The UI will open in your browser, typically at `http://localhost:8501`.
133144
134145
## Dockerization
135146
136-
The project now uses Docker Compose to manage both the Flask API and the Streamlit UI.
147+
The project now uses Docker Compose to manage both the Flask API and the Streamlit UI. All Docker configuration files are located in the `config/` directory.
137148
138149
1. **Build and Run with Docker Compose:**
139150
Ensure the model is trained (`models/model.joblib` exists), then navigate to the project root and run:
140151
```bash
141-
docker-compose up --build -d
152+
docker-compose -f config/docker-compose.yml up --build -d
142153
```
143-
This will build images for `Dockerfile.api` and `Dockerfile.streamlit`, and start both services.
154+
This will build images for `config/Dockerfile.api` and `config/Dockerfile.streamlit`, and start both services.
144155
The Flask API will be accessible via `http://localhost:5000/` and the Streamlit UI via `http://localhost:8501/`.
145156
146157
2. **Stop Docker Compose services:**
147158
```bash
148-
docker-compose down
159+
docker-compose -f config/docker-compose.yml down
149160
```
150161
This will stop and remove all services and their networks.
151162
@@ -157,7 +168,7 @@ A GitHub Actions workflow (`.github/workflows/main.yml`) is configured to automa
157168
2. **Set up Python and install dependencies:** Prepares the environment for model training.
158169
3. **Create `models/` directory:** Ensures the directory exists for saving the trained model.
159170
4. **Train the model:** Runs `src/model.py` to train the model and generate `models/model.joblib`.
160-
5. **Build and Push Docker Compose Images:** Builds both API (`Dockerfile.api`) and Streamlit UI (`Dockerfile.streamlit`) images and pushes them to Docker Hub.
171+
5. **Build and Push Docker Compose Images:** Builds both API (`config/Dockerfile.api`) and Streamlit UI (`config/Dockerfile.streamlit`) images and pushes them to Docker Hub.
161172
6. **Run Docker Compose services (for testing):** Starts both the API and Streamlit UI services in isolated containers.
162173
7. **Wait for services to be ready:** A robust loop that polls both API (`/`) and Streamlit UI (`/`) endpoints until both are responsive.
163174
8. **Test health and prediction endpoints:** Executes `curl` commands to verify Flask API functionality.

0 commit comments

Comments
 (0)