It is a lightweight Python package that enables developers to transform any AI model into a fully functional Command-Line Interface (CLI) plugin
Project description
Modelzilla
This library turns any model class into a CLI executable. If you're tired of writing a lot of boilerplate code to run your model, this library is for you. It is a lightweight Python package that enables developers to transform any AI model into a fully functional Command-Line Interface (CLI) plugin.
Key features:
- Automatic CLI Generation: Automatically generate CLI commands for models
- Customizable Commands: Each model will have its own CLI parameters
- Seamless Integration: Just inherit from the
CLIPluginclass and you're ready to go
Installation
Pip install the modelzilla package in a Python>=3.10 environment.
pip install modelzilla
Quickstart
1. Turn any model into a CLI executable
Let's say you have a model class that you want to turn into a CLI executable. You can do this by inheriting from the CLIPlugin class and implementing the inference method.
import supervision as sv
from modelzilla.plugins import CLIPlugin # Import the CLIPlugin class
class MyModel(CLIPlugin):
def __init__(self, model_path: str): # Add any parameters you want to the CLI
self.model = load(model_path) # Load your model
def inference(self, image) -> sv.Detections:
results = self.model(image)
return results.to_detections() # Convert your model's output to sv.Detections
2. Execute the model from the CLI
You can execute your model from the CLI. The parameters included into the __init__ method will be automatically added to the CLI.
If the model class in inside the plugins folder:
modelzilla -i image.png -os plot MyModel --model_path model.pth
Otherwise, you need to specify the --plugins_folder argument:
modelzilla -i image.png -os plot --plugins_folder <path/to/your/plugin/folder> MyModel --model_path model.pth
Examples
Currently, we provide the following plugins:
- HFObjectDetection: A plugin that uses the HuggingFace Object Detection model.
How to execute it from the CLI
Install extra dependencies for the plugin:
pip install modelzilla[hf]
modelzilla -i http://images.cocodataset.org/val2017/000000039769.jpg -os plot HFObjectDetection --model_repo facebook/detr-resnet-50
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file modelzilla-0.1.0.tar.gz.
File metadata
- Download URL: modelzilla-0.1.0.tar.gz
- Upload date:
- Size: 14.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.10.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
65cd07dae60e9101a05fe301bb35cbe9f36a7d732c52e1e6b83ded4cfc623841
|
|
| MD5 |
312803cbceaa89279ba385eb916eb6f9
|
|
| BLAKE2b-256 |
577cb92be061023772e0e2402533ee556b2e1160ed19cf7dece874d31a44fd5a
|
File details
Details for the file modelzilla-0.1.0-py3-none-any.whl.
File metadata
- Download URL: modelzilla-0.1.0-py3-none-any.whl
- Upload date:
- Size: 16.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.10.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
91c85297d9f8cc8356d8c594918356f1ef817df7fdff2f9efdb47088a66a50e4
|
|
| MD5 |
d61dee409206123d791feeaefcf7e1a2
|
|
| BLAKE2b-256 |
b44cee076215a6e60a517cae5c27f9daf30233e666d8188ac455228c8be0f73d
|