Spaces:
Runtime error
Runtime error
:zap: [Enhance] Support provide api_key with os env HF_TOKEN
Browse files- apis/chat_api.py +3 -2
apis/chat_api.py
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
import argparse
|
2 |
-
import
|
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(
|