Hansimov commited on
Commit
bc384a3
1 Parent(s): 2da6968

:zap: [Enhance] Support provide api_key with os env HF_TOKEN

Browse files
Files changed (1) hide show
  1. apis/chat_api.py +3 -2
apis/chat_api.py CHANGED
@@ -1,6 +1,7 @@
1
  import argparse
2
- import uvicorn
3
  import sys
 
4
 
5
  from fastapi import FastAPI, Depends
6
  from fastapi.security import HTTPBearer, HTTPAuthorizationCredentials
@@ -47,7 +48,7 @@ class ChatAPIApp:
47
  if credentials:
48
  return credentials.credentials
49
  else:
50
- return None
51
 
52
  class ChatCompletionsPostItem(BaseModel):
53
  model: str = Field(
 
1
  import argparse
2
+ import os
3
  import sys
4
+ import uvicorn
5
 
6
  from fastapi import FastAPI, Depends
7
  from fastapi.security import HTTPBearer, HTTPAuthorizationCredentials
 
48
  if credentials:
49
  return credentials.credentials
50
  else:
51
+ return os.getenv("HF_TOKEN") or None
52
 
53
  class ChatCompletionsPostItem(BaseModel):
54
  model: str = Field(