Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,14 @@ The `HF_FRAMEWORK` environment variable defines the base deep learning framework
HF_FRAMEWORK="pytorch"
```

### `HF_ENDPOINT`

The `HF_ENDPOINT` environment variable indicates whether the service is run inside the HF Inference endpoint service to adjust the `logging` config.

```bash
HF_ENDPOINT="True"
```


---

Expand Down
6 changes: 5 additions & 1 deletion src/huggingface_inference_toolkit/webservice_starlette.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import logging
import os
from pathlib import Path
from time import perf_counter

Expand All @@ -21,7 +22,10 @@


logger = logging.getLogger(__name__)
logging.basicConfig(format="%(asctime)s | %(levelname)s | %(message)s", level=logging.INFO)
if os.environ.get("HF_ENDPOINT", None):
logging.basicConfig(format="| %(levelname)s | %(message)s", level=logging.INFO)
else:
logging.basicConfig(format="%(asctime)s | %(levelname)s | %(message)s", level=logging.INFO)
uvicorn_error = logging.getLogger("uvicorn.error")
uvicorn_error.disabled = True
uvicorn_access = logging.getLogger("uvicorn.access")
Expand Down