This doesn't work:
import replicate
from dotenv import load_dotenv
load_dotenv()
Because import replicate must be expecting the env var to already exist:
requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: https://api.replicate.com/v1/models/yuanxunlu/livespeechportraits/versions
This works:
from dotenv import load_dotenv
load_dotenv()
import replicate
In order to support .env-file based development workflows, we should update the client to read the token when the client is being exercised, instead of at load time, so the order of import statements won't matter.
This doesn't work:
Because
import replicatemust be expecting the env var to already exist:This works:
In order to support
.env-file based development workflows, we should update the client to read the token when the client is being exercised, instead of at load time, so the order of import statements won't matter.