Spaces:
Sleeping
Sleeping
Create Readme.md
Browse files
Readme.md
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: RespireX Backend
|
| 3 |
+
emoji: 🫁
|
| 4 |
+
colorFrom: blue
|
| 5 |
+
colorTo: teal
|
| 6 |
+
sdk: docker
|
| 7 |
+
app_port: 7860
|
| 8 |
+
pinned: false
|
| 9 |
+
tags:
|
| 10 |
+
- django
|
| 11 |
+
- tensorflow
|
| 12 |
+
- medical-ai
|
| 13 |
+
- backend
|
| 14 |
+
---
|
| 15 |
+
|
| 16 |
+
# 🫁 RespireX - AI-Powered Disease Detection API
|
| 17 |
+
|
| 18 |
+
This is the **Backend API** for **RespireX**, an AI-powered medical diagnostic application designed to detect respiratory diseases (like Tuberculosis and Pneumonia) and skin conditions using Deep Learning.
|
| 19 |
+
|
| 20 |
+
It serves as the inference engine for the RespireX Frontend (deployed on Vercel).
|
| 21 |
+
|
| 22 |
+
## 🚀 Tech Stack
|
| 23 |
+
|
| 24 |
+
* **Framework:** Django (Python) & Django REST Framework
|
| 25 |
+
* **ML Engine:** TensorFlow / Keras
|
| 26 |
+
* **Model Architecture:** EfficientNetB0
|
| 27 |
+
* **Database:** PostgreSQL (Supabase)
|
| 28 |
+
* **Deployment:** Docker on Hugging Face Spaces
|
| 29 |
+
|
| 30 |
+
## 🔗 API Endpoints
|
| 31 |
+
|
| 32 |
+
The backend exposes the following REST API endpoints:
|
| 33 |
+
|
| 34 |
+
| Method | Endpoint | Description |
|
| 35 |
+
| :--- | :--- | :--- |
|
| 36 |
+
| `GET` | `/` | Health check / Welcome message |
|
| 37 |
+
| `POST` | `/api/auth/` | User authentication (Supabase Integration) |
|
| 38 |
+
| `POST` | `/api/predict/` | Upload X-Ray/Image for disease prediction |
|
| 39 |
+
| `GET` | `/api/history/` | Fetch past test results |
|
| 40 |
+
|
| 41 |
+
## 🛠️ Environment Variables
|
| 42 |
+
|
| 43 |
+
To run this project, the following environment variables must be set in the **Settings > Variables and Secrets** tab of your Space:
|
| 44 |
+
|
| 45 |
+
* `SECRET_KEY`: Django secret key.
|
| 46 |
+
* `DEBUG`: `False` (for production).
|
| 47 |
+
* `DATABASE_URL`: Connection string for Supabase PostgreSQL (Transaction Pooler).
|
| 48 |
+
* `SUPABASE_URL`: Your Supabase Project URL.
|
| 49 |
+
* `SUPABASE_KEY`: Your Supabase Anon Key.
|
| 50 |
+
* `AWS_ACCESS_KEY_ID`: (Optional) For email services.
|
| 51 |
+
* `AWS_SECRET_ACCESS_KEY`: (Optional) For email services.
|
| 52 |
+
|
| 53 |
+
## 🐳 Local Development (Docker)
|
| 54 |
+
|
| 55 |
+
To run this backend locally using Docker:
|
| 56 |
+
|
| 57 |
+
1. **Build the image:**
|
| 58 |
+
```bash
|
| 59 |
+
docker build -t respirex-backend .
|
| 60 |
+
```
|
| 61 |
+
|
| 62 |
+
2. **Run the container:**
|
| 63 |
+
```bash
|
| 64 |
+
docker run -p 7860:7860 --env-file .env respirex-backend
|
| 65 |
+
```
|
| 66 |
+
|
| 67 |
+
## 📦 Model Information
|
| 68 |
+
|
| 69 |
+
* **Model File:** `efficientnet_b0.h5`
|
| 70 |
+
* **Input Shape:** `(224, 224, 3)`
|
| 71 |
+
* **Performance:** Optimized for high sensitivity in chest X-ray analysis.
|
| 72 |
+
|
| 73 |
+
---
|
| 74 |
+
*Built with ❤️ by the RespireX Team*
|