Skip to content

Instantly share code, notes, and snippets.

@caleb-kaiser
Created December 15, 2020 21:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save caleb-kaiser/d01262cbe3014cbd1c407527edbf6fa6 to your computer and use it in GitHub Desktop.
Save caleb-kaiser/d01262cbe3014cbd1c407527edbf6fa6 to your computer and use it in GitHub Desktop.
# Import whatever dependencies your API needs
import os
from metaflow import DataArtifact
os.environ['METAFLOW_USER'] = 'cortex'
class PythonPredictor:
def __init__(self, config):
# Initialize your model here
print("Got config to be %s" % str(config))
self.model = DataArtifact(config['model_artifact']).data
def predict(self, payload):
# Payload is the request your endpoint receives
prediction = self.model
return prediction
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment