explorer13/risk-level-classification
0
Risk Level Classification API
A real-time audio risk assessment API built for women's safety applications. When an SOS is triggered, the app captures audio and sends it here to determine the threat level.
How It Works
šļø Audio (WAV, ā¤35s)
ā
ā¼
š§ Whisper (language detection from audio signal)
ā
ā¼
š£ļø Google STT (transcription in native script ā Bengali, Devanagari, etc.)
ā
ā¼
š¤ Romanization (native script ā Latin characters)
ā
ā¼
š Translation (ā English)
ā
ā¼
š¤ Risk Classification (Low / Medium / High + confidence score)Key design decision: Whisper detects the language from audio acoustics (never confuses Hindi/Bengali), then Google STT transcribes using that language code (produces clean native script). Best of both worlds.
Quick Start
curl -X POST "https://your-space.hf.space/analyze_audio" \
-F "file=@recording.wav"Example Response
{
"original_text": "ą¦ą¦®ą¦¾ą¦ą§ ą¦ą¦®ą¦¾ą¦° মত ą¦„ą¦¾ą¦ą¦¤ą§ দাą¦",
"romanized_text": "amake amar moto thakte dao",
"translated_text": "Let me be who I am",
"risk_level": "Low",
"score": 0.77
}Running Locally
pip install -r requirements.txt
uvicorn app:app --host 0.0.0.0 --port 7860First run downloads Whisper medium (~1.42GB) and the risk classifier (~500MB).
Important: Do NOT use --reload ā it restarts the process and re-downloads models.
API Endpoints
Tech Stack
Supported Languages
Audio Requirements
Performance
Documentation
See API_REQUIREMENTS.md for detailed technical documentation including:
- Full architecture diagrams
- Build pipeline details
- Deployment challenges & solutions
- Integration guide with code examples
License
MIT
