--- title: Mold Detection API emoji: 🦠 colorFrom: blue colorTo: green sdk: docker app_file: app.py pinned: false license: mit --- # Mold Detection API FastAPI backend for mold detection using multi-task ResNet50 deep learning model, deployed with Docker. # Mold Detection API FastAPI backend for mold detection using multi-task ResNet50 deep learning model. ## Features - **Multi-task Learning**: Classifies mold types and detects biological material - **3-Level Decision System**: - High confidence (≥80%): "Mold" - Medium confidence (50-80%) + biological detection: "Possible Mold" - Low confidence: "Not Mold" - **RESTful API**: Easy integration with any frontend ## API Endpoints ### `GET /` Health check and API information ### `GET /health` Simple health check ### `POST /predict` Predict mold detection from an image **Request:** - Content-Type: `multipart/form-data` - File: Image file (jpg, png, jpeg) **Response:** ```json { "decision": "Mold" | "Possible Mold" | "Not Mold", "mold_probability": 0.0-1.0, "biological_probability": 0.0-1.0 } ``` ## Usage ### Using curl: ```bash curl -X POST "https://YOUR_USERNAME-SPACE_NAME.hf.space/predict" \ -F "file=@/path/to/your/image.jpg" ``` ### Using Python: ```python import requests url = "https://YOUR_USERNAME-SPACE_NAME.hf.space/predict" with open("test_image.jpg", "rb") as f: response = requests.post(url, files={"file": f}) print(response.json()) ``` ## Documentation Interactive API documentation available at `/docs` endpoint. ## Model - **Architecture**: ResNet50 with multi-task heads - **Input**: RGB images (224x224) - **Output**: - Classification head: 9 classes (mold class at index 4) - Biological detection head: 2 classes (binary)