Spaces:
Running
Running
Download utils.py from Salesforce/BLIP2: direct link, hf CLI and curl.
- Browser
- Download file 497 Bytes
-
https://huggingface.co/spaces/Salesforce/BLIP2/resolve/refs%2Fpr%2F21/utils.py
- Command line
-
hf download hf://spaces/Salesforce/BLIP2@refs/pr/21/utils.py
-
curl -L -o utils.py https://huggingface.co/spaces/Salesforce/BLIP2/resolve/refs%2Fpr%2F21/utils.py
497 Bytes
| import os | |
| class Endpoint: | |
| def __init__(self): | |
| self._url = None | |
| def url(self): | |
| if self._url is None: | |
| self._url = self.get_url() | |
| return self._url | |
| def get_url(self): | |
| endpoint = os.environ.get("endpoint") | |
| return endpoint | |
| def get_token(): | |
| token = os.environ.get("auth_token") | |
| if token is None: | |
| raise ValueError("auth-token not found in environment variables") | |
| return token | |