Hasitha16 commited on
Commit
b4b574c
·
verified ·
1 Parent(s): 0fc2ae2

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +2 -2
main.py CHANGED
@@ -78,8 +78,8 @@ def auto_fill(value: Optional[str], fallback: str) -> str:
78
 
79
  @app.post("/analyze/")
80
  async def analyze(data: ReviewInput, x_api_key: str = Header(None)):
81
- if x_api_key != VALID_API_KEY:
82
- raise HTTPException(status_code=401, detail="❌ Unauthorized: Invalid API key")
83
  if len(data.text.split()) < 20:
84
  raise HTTPException(status_code=400, detail="⚠️ Review too short for analysis (min. 20 words).")
85
 
 
78
 
79
  @app.post("/analyze/")
80
  async def analyze(data: ReviewInput, x_api_key: str = Header(None)):
81
+ if x_api_key and x_api_key != VALID_API_KEY:
82
+ raise HTTPException(status_code=401, detail="❌ Invalid API key")
83
  if len(data.text.split()) < 20:
84
  raise HTTPException(status_code=400, detail="⚠️ Review too short for analysis (min. 20 words).")
85