Spaces:
Sleeping
Sleeping
A newer version of the Gradio SDK is available: 6.12.0
SafeSpace AI API
AI-powered threat detection and safety analysis π‘οΈ
This FastAPI application provides intelligent threat detection and sentiment analysis capabilities using machine learning models.
π Features
- Threat Detection: AI-powered analysis of potential threats
- Sentiment Analysis: Emotional tone detection in text
- Location-based Analysis: Geographic threat assessment
- Real-time Processing: Fast API responses for real-time applications
π€ ML Models
Threat.pkl: Binary classification for threat detectionsentiment.pkl: Sentiment and emotion analysiscontextClassifier.onnx: Context understanding model
π‘ API Endpoints
GET /: API status and informationGET /health: Health check endpointPOST /api/threats/analyze: Analyze text for threatsGET /api/models/status: Check model loading statusGET /docs: Interactive API documentation
π§ Usage
Analyze Threat
import requests
response = requests.post(
"https://your-space-name-username.hf.space/api/threats/analyze",
json={
"title": "Suspicious Activity",
"description": "There's something concerning happening",
"location": "New York, NY"
}
)
result = response.json()
print(f"Threat Level: {result['threat_level']}")
print(f"Confidence: {result['final_confidence']}")
π οΈ Development
Built with:
- FastAPI - Modern, fast web framework
- scikit-learn - Machine learning models
- ONNX Runtime - Optimized inference
- Uvicorn - ASGI server
π License
This project is part of the SafeSpace application for enhanced public safety through AI.
Deployed on Hugging Face Spaces π€