Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
|
@@ -4,7 +4,7 @@ from pydantic import BaseModel # Import BaseModel from pydantic for data valida
|
|
| 4 |
from huggingface_hub import InferenceClient # Import InferenceClient from huggingface_hub
|
| 5 |
import uvicorn # Import uvicorn for running the FastAPI application
|
| 6 |
|
| 7 |
-
app = FastAPI(
|
| 8 |
|
| 9 |
# Define the primary and fallback models
|
| 10 |
primary = "mistralai/Mixtral-8x7B-Instruct-v0.1"
|
|
@@ -126,7 +126,7 @@ async def generate_text(item: Item = None):
|
|
| 126 |
raise HTTPException(status_code=500, detail=error)
|
| 127 |
|
| 128 |
if "KEY" in os.environ:
|
| 129 |
-
if item.key != os.environ["
|
| 130 |
raise HTTPException(status_code=401, detail="Valid key is required.")
|
| 131 |
|
| 132 |
if __name__ == "__main__":
|
|
|
|
| 4 |
from huggingface_hub import InferenceClient # Import InferenceClient from huggingface_hub
|
| 5 |
import uvicorn # Import uvicorn for running the FastAPI application
|
| 6 |
|
| 7 |
+
app = FastAPI() # Create a FastAPI instance
|
| 8 |
|
| 9 |
# Define the primary and fallback models
|
| 10 |
primary = "mistralai/Mixtral-8x7B-Instruct-v0.1"
|
|
|
|
| 126 |
raise HTTPException(status_code=500, detail=error)
|
| 127 |
|
| 128 |
if "KEY" in os.environ:
|
| 129 |
+
if item.key != os.environ["HF_API_TOKEN"]:
|
| 130 |
raise HTTPException(status_code=401, detail="Valid key is required.")
|
| 131 |
|
| 132 |
if __name__ == "__main__":
|