Spaces:
Sleeping
Sleeping
Delete README_HF.md
Browse files- README_HF.md +0 -63
README_HF.md
DELETED
|
@@ -1,63 +0,0 @@
|
|
| 1 |
-
# SafeSpace AI API
|
| 2 |
-
|
| 3 |
-
**AI-powered threat detection and safety analysis** π‘οΈ
|
| 4 |
-
|
| 5 |
-
This FastAPI application provides intelligent threat detection and sentiment analysis capabilities using machine learning models.
|
| 6 |
-
|
| 7 |
-
## π Features
|
| 8 |
-
|
| 9 |
-
- **Threat Detection**: AI-powered analysis of potential threats
|
| 10 |
-
- **Sentiment Analysis**: Emotional tone detection in text
|
| 11 |
-
- **Location-based Analysis**: Geographic threat assessment
|
| 12 |
-
- **Real-time Processing**: Fast API responses for real-time applications
|
| 13 |
-
|
| 14 |
-
## π€ ML Models
|
| 15 |
-
|
| 16 |
-
- `Threat.pkl`: Binary classification for threat detection
|
| 17 |
-
- `sentiment.pkl`: Sentiment and emotion analysis
|
| 18 |
-
- `contextClassifier.onnx`: Context understanding model
|
| 19 |
-
|
| 20 |
-
## π‘ API Endpoints
|
| 21 |
-
|
| 22 |
-
- `GET /`: API status and information
|
| 23 |
-
- `GET /health`: Health check endpoint
|
| 24 |
-
- `POST /api/threats/analyze`: Analyze text for threats
|
| 25 |
-
- `GET /api/models/status`: Check model loading status
|
| 26 |
-
- `GET /docs`: Interactive API documentation
|
| 27 |
-
|
| 28 |
-
## π§ Usage
|
| 29 |
-
|
| 30 |
-
### Analyze Threat
|
| 31 |
-
|
| 32 |
-
```python
|
| 33 |
-
import requests
|
| 34 |
-
|
| 35 |
-
response = requests.post(
|
| 36 |
-
"https://your-space-name-username.hf.space/api/threats/analyze",
|
| 37 |
-
json={
|
| 38 |
-
"title": "Suspicious Activity",
|
| 39 |
-
"description": "There's something concerning happening",
|
| 40 |
-
"location": "New York, NY"
|
| 41 |
-
}
|
| 42 |
-
)
|
| 43 |
-
|
| 44 |
-
result = response.json()
|
| 45 |
-
print(f"Threat Level: {result['threat_level']}")
|
| 46 |
-
print(f"Confidence: {result['final_confidence']}")
|
| 47 |
-
```
|
| 48 |
-
|
| 49 |
-
## π οΈ Development
|
| 50 |
-
|
| 51 |
-
Built with:
|
| 52 |
-
- **FastAPI** - Modern, fast web framework
|
| 53 |
-
- **scikit-learn** - Machine learning models
|
| 54 |
-
- **ONNX Runtime** - Optimized inference
|
| 55 |
-
- **Uvicorn** - ASGI server
|
| 56 |
-
|
| 57 |
-
## π License
|
| 58 |
-
|
| 59 |
-
This project is part of the SafeSpace application for enhanced public safety through AI.
|
| 60 |
-
|
| 61 |
-
---
|
| 62 |
-
|
| 63 |
-
*Deployed on Hugging Face Spaces* π€
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|