Spaces:
Sleeping
Sleeping
File size: 1,911 Bytes
8419ae2 0ea8c58 8419ae2 e44334d 8419ae2 0ea8c58 8419ae2 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
---
title: Pneumonia Space
emoji: π«
colorFrom: blue
colorTo: green
sdk: docker
app_port: 5000
pinned: false
license: mit
---
# π« Pneumonia Risk Assessment API
AI-powered API for assessing pneumonia risk from respiratory audio recordings.
## π Features
- **HeAR Model Integration**: Uses Google's Health Acoustic Representations model
- **Risk Scoring**: Provides probability-based risk assessment (not diagnostic)
- **Fallback System**: Uses librosa-based features if HeAR model unavailable
- **REST API**: Simple Flask endpoint for audio file uploads
## π Setup
### Hugging Face Authentication
The HeAR model requires Hugging Face authentication. Set your token as an environment variable:
```bash
export HF_TOKEN="your_huggingface_token_here"
```
Or login using the CLI:
```bash
huggingface-cli login
```
Get your token from: https://huggingface.co/settings/tokens
### Running Locally
```bash
# Install dependencies
pip install -r requirements.txt
# Run the application
python app.py
```
### Using Docker
```bash
# Build the image
docker build -t pneumonia-api .
# Run with HF token
docker run -p 5000:5000 -e HF_TOKEN="your_token" pneumonia-api
```
## π‘ API Usage
**Endpoint**: `POST /predict_pneumonia`
**Request**: Multipart form data with `audio_file`
**Response**:
```json
{
"filename": "recording.wav",
"pneumonia_risk_score": 0.7234,
"risk_level": "High",
"note": "This is an AI assessment, not a medical diagnosis. Consult a healthcare professional."
}
```
**Example with curl**:
```bash
curl -X POST -F "audio_file=@recording.wav" http://localhost:5000/predict_pneumonia
```
## β οΈ Disclaimer
This tool provides risk assessment scores, not medical diagnoses. Always consult healthcare professionals for medical decisions.
## π License
MIT License
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|