build, deploy, and scale machine learning with ease.
- upload models: deploy your models effortlessly.
- real-time inference: generate predictions instantly.
- version management: keep your models organized and up to date.
-
clone the repository:
git clone https://github.com/harpertoken/ml-api.git
-
navigate to the project:
cd ml-api -
install dependencies:
pip install -r requirements.txt
Note: numpy is not included in requirements.txt due to Python version constraints. For local development with numpy 2.3.3, ensure Python >=3.11 and install separately:
pip install numpy==2.3.3. Docker builds use Python 3.12 and install numpy 2.3.3 automatically.
kubectl apply -f k8s.yamllaunch the server with:
python main.py curl -X POST http://localhost:8000/chat -H "Content-Type: application/json" -d '{"prompt": "Hello, world!"}'GET /models: list available modelsGET /status: get api and model status
- python 3.8+ (3.11+ recommended for numpy 2.3.3)
- fastapi, huggingface transformers, pytorch, numpy (see installation notes)
shape the future of ml-api. submit issues or pull requests to make it even better.
this project follows conventional commit standards to ensure clear and consistent commit messages.
to enable commit message validation:
-
copy the hook script to your local git hooks:
for unix/linux/macos:
cp scripts/commit-msg .git/hooks/commit-msg chmod +x .git/hooks/commit-msg
for windows (powershell):
cp scripts/commit-msg.ps1 .git/hooks/commit-msg
commit messages must follow this format:
- start with a type:
feat:,fix:,docs:,style:,refactor:,test:,chore:,perf:,ci:,build:,revert: - followed by a space and a lowercase description
- first line ≤60 characters
example: feat: add user authentication
if you need to clean up existing commit messages (make lowercase and truncate), use the rewrite script:
for unix/linux/macos:
bash scripts/rewrite_msg.shfor windows (powershell):
get-content | scripts/rewrite_msg.ps1for rewriting the entire history:
git filter-branch --msg-filter 'bash scripts/rewrite_msg.sh' -- --all(on windows, use powershell equivalent)
note: this rewrites history, so use with caution and force-push if necessary.
to create an alpha release:
bash scripts/release_alpha.shthis will bump the version, create a tag, push, and publish a prerelease on github.
licensed under the mit license. see the LICENSE file for details.
