PCOS Prediction API built with FastAPI and deployed on render.
Machine learning model built with Google Colab.
Docs available at /docs
.
- Clone repository
git clone https://github.com/ranmerc/pcos-prediction-backend.git
- Create Virtual Environment
# Creates Virtual Environment named venv
python -m venv venv
- Activate venv
source venv/Scripts/activate
- Install packages
pip install -r requirements.txt
- Running Uvicorn Server
uvicorn main:app --reload
- Deactivating Virtual Environment
deactivate
- Generating requirements.txt
pip freeze > requirements.txt
We pickle the trained model and StandardScaler object -
import pickle
pickle.dump(model, open("model.sav", 'wb'))
pickle.dump(standard_scalar, open("sc.sav", 'wb'))
Then we load the model on server and make prediction using it -
loaded_model = pickle.load(open("model.sav", 'rb'))
sc = pickle.load(open("sc.sav", 'rb'))
test_data = []
test_data = sc.transform([test_data])
res = loaded_model.predict(test_data)
-
Can not activate a virtualenv in GIT bash mingw32 for Windows on Stack Overflow
-
Is it bad to have my virtualenv directory inside my git repository? on Stack Overflow
-
Python Tutorial: VENV (Windows) - How to Use Virtual Environments with the Built-In venv Module by Cory Schafer on Youtube
-
Deploying FastAPI application to Render by Akash R Chandran
-
What and why behind fit_transform() and transform() in scikit-learn! by Towards Data Science