safe-space2 / README_HF.md
parthraninga's picture
Upload 66 files
a831961 verified

A newer version of the Gradio SDK is available: 6.12.0

Upgrade

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 detection
  • sentiment.pkl: Sentiment and emotion analysis
  • contextClassifier.onnx: Context understanding model

πŸ“‘ API Endpoints

  • GET /: API status and information
  • GET /health: Health check endpoint
  • POST /api/threats/analyze: Analyze text for threats
  • GET /api/models/status: Check model loading status
  • GET /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 πŸ€—