This project demonstrates how to deploy a pre-trained machine learning model as a web service using FastAPI. The machine
learning model used in this project is a RandomForestClassifier, trained on a Breast Cancer classification dataset.
The trained model is served via an API endpoint created with FastAPI, allowing users to make predictions by sending HTTP
requests.
-
Clone the repository:
git clone https://github.com/emiliodallatorre/unive-breastcancer-classification.git cd your-repo-name -
Create and activate a virtual environment:
python -m venv venv source venv/bin/activate # On Windows use `env\Scripts\activate`
-
Install the required dependencies:
pip install -r requirements.txt
-
Start the FastAPI server:
uvicorn server:app --host 0.0.0.0 # Or use ./start.sh -
Access the API: Open your browser and navigate to
http://127.0.0.1:8000/docsto view the automatically generated API documentation and interact with the API.
-
Description: This endpoint accepts a JSON payload containing the features required by the model and returns the prediction.
-
Request Body:
{ "radius": 0, "perimeter": 0, "area": 0 } -
Response:
{ "diagnosis": "B", "probabilities": { "B": 1, "M": 0 } }
Contributions are welcome! Please fork the repository and submit a pull request for any bug fixes, improvements, or new features.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature) - Commit your Changes (
git commit -m 'Add some AmazingFeature') - Push to the Branch (
git push origin feature/AmazingFeature) - Open a Pull Request
Distributed under the MIT License. See LICENSE for more information.
