Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -16,7 +16,7 @@ async def chat(request: Request):
|
|
| 16 |
data = await request.json()
|
| 17 |
|
| 18 |
# API Key Check
|
| 19 |
-
api_key =
|
| 20 |
if api_key != VALID_API_KEY:
|
| 21 |
raise HTTPException(status_code=403, detail="Invalid API Key")
|
| 22 |
|
|
@@ -36,4 +36,4 @@ async def chat(request: Request):
|
|
| 36 |
|
| 37 |
|
| 38 |
if __name__ == "__main__":
|
| 39 |
-
uvicorn.run(app, host="0.0.0.0", port=7860) # HF default port
|
|
|
|
| 16 |
data = await request.json()
|
| 17 |
|
| 18 |
# API Key Check
|
| 19 |
+
api_key = request.headers.get("X-API-Key") # Get API key from headers
|
| 20 |
if api_key != VALID_API_KEY:
|
| 21 |
raise HTTPException(status_code=403, detail="Invalid API Key")
|
| 22 |
|
|
|
|
| 36 |
|
| 37 |
|
| 38 |
if __name__ == "__main__":
|
| 39 |
+
uvicorn.run(app, host="0.0.0.0", port=7860) # HF default port
|