diff --git a/backend/app/routers/identify.py b/backend/app/routers/identify.py index f668c93..89f0329 100644 --- a/backend/app/routers/identify.py +++ b/backend/app/routers/identify.py @@ -23,7 +23,8 @@ async def identify_plant(file: UploadFile = File(...)): else: source = "plantnet" - # 4. Mettre en cache - redis_cache.set(image_bytes, results) + # 4. Mettre en cache uniquement si des résultats ont été trouvés + if results: + redis_cache.set(image_bytes, results) return {"source": source, "results": results} diff --git a/backend/app/services/plantnet.py b/backend/app/services/plantnet.py index 1a3edf1..f9c6e31 100644 --- a/backend/app/services/plantnet.py +++ b/backend/app/services/plantnet.py @@ -3,7 +3,7 @@ from typing import List import httpx -PLANTNET_KEY = os.environ.get("PLANTNET_API_KEY", "2b1088cHCJ4c7Cn2Vqq67xfve") +PLANTNET_KEY = os.environ.get("PLANTNET_API_KEY", "") PLANTNET_URL = "https://my-api.plantnet.org/v2/identify/all"