Skip to main content
An environment variable is a value that affects the way the code runs and is dependent on the environment on which it is running. For example, you have written a ML model API service that,
  1. Downloads the model from somewhere.
  2. Loads the model from disk.
  3. Serves a /infer route, which calls the model’s inference function.
Now, your service code may not change if you re-train and update the model. In this case, we can pass the model path via an environment variable. main.py
You can then run this service and inject the environment variable value like below,
You can also use a .env file on your local dev environment and use python-dotenv. .env

How to inject environment variables in TrueFoundry

In this guide we will learn how can we inject environment variables in our deployments in TrueFoundry.
The variables MODEL_FQN and S3_BUCKET_NAME should be available in your environment on deployment.