Created
December 11, 2020 16:41
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cortex | |
class PythonPredictor: | |
def __init__(self, config): | |
self.model = # Download model from any source (can also be configured in API spec). | |
def predict(self, payload): | |
return self.model(payload["input"]) | |
requirements = ["torch"] # Add any requirements | |
api_spec = {"name": "example_api", "kind": "RealtimeAPI"} # Configure API specifics | |
cx = cortex.client("local") | |
cx.create_api(api_spec, predictor=PythonPredictor, requirements=requirements) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment