Repair Leaf Disease Detection API

Замовник: AI | Опубліковано: 25.04.2026

Hi, Fix my existing Leaf Disease Detection FastAPI project. Problem: Project is breaking due to environment/dependency issues: ModuleNotFoundError: tensorflow.keras TensorFlow fails to load (_pywrap_tensorflow_internal.dll) NumPy 2.x incompatibility with TensorFlow _ARRAY_API not found error Uvicorn crashes while importing utils.py Project Details: Backend: FastAPI Model: TensorFlow (Keras) Files: app.py (API) utils.py (model loading + prediction) dataset/model/ (config.json, model.weights.h5, metadata.json) dataset/PlantVillage/ (class folders) Requirements: Create a clean working Python environment Fix all dependency issues: TensorFlow compatibility NumPy version compatibility (<2) Keras / model loading issues Ensure model loads correctly using: config.json model.weights.h5 Fix API endpoint: /disease-detection-file should accept image upload and return prediction Ensure project runs with: uvicorn app:app --reload CPU-only setup is fine (no GPU required) Expected Output: { "disease_detected": true, "disease_name": "Tomato___Early_blight", "confidence": 92.5 } Note: Do not change model architecture unless absolutely necessary. Focus on fixing environment + compatibility so project runs successfully.