A lightweight FastAPI server, configured via YAML, for serving machine learning models built with PyTorch.
Given the dependencies in requirements.txt (FastAPI, Uvicorn, PyYAML, PyTorch, NumPy), this project exposes a FastAPI-based HTTP API that serves predictions from one or more PyTorch models stored under ml_models/.
- Python 3.9+ (recommended)
- Dependencies listed in
requirements.txt
-
Clone the repository:
git clone https://github.com/umeshnandargi/FastApiProject.git cd FastApiProject -
Create and activate a virtual environment (recommended):
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies:
pip install -r requirements.txt
Server settings are defined in config/server_config.yaml. This file is loaded automatically at startup and passed to ApiServer. Update it with your desired host, port, and any model-related settings before running the server.
python main.pyThis loads the configuration and starts the API server. Once running, if it's a standard FastAPI setup, interactive API docs should be available at:
- Swagger UI:
http://localhost:<port>/docs - ReDoc:
http://localhost:<port>/redoc
(Replace <port> with the value configured in server_config.yaml.)
Contributions are welcome. Please open an issue or submit a pull request with a clear description of your changes.