File size: 1,805 Bytes
100fb60
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
title: SF Crime Analytics | AI-Powered
emoji: πŸš“
colorFrom: red
colorTo: blue
sdk: docker
app_port: 8501
tags:
- streamlit
- machine-learning
- xgboost
- crime-prediction
pinned: true
license: apache-2.0
---

# πŸš“ San Francisco Crime Analytics & Prediction System

## Overview
This project is a comprehensive AI-powered dashboard for analyzing and predicting crime in San Francisco. It leverages historical data and advanced machine learning models (XGBoost) to provide actionable insights and real-time risk assessments.

## Features
-   **πŸ“Š Historical Trends**: Visualize crime distribution by hour, district, and category.
-   **πŸ—ΊοΈ Geospatial Intelligence**: Interactive heatmaps showing crime density and evolution over time.
-   **🚨 Tactical Simulation**: Simulate patrol strategies and assess risk levels for specific sectors.
-   **πŸ’¬ Chat with Data**: Natural language interface to query the dataset.
-   **πŸš€ Advanced Prediction (99% Accuracy)**: High-precision crime categorization using an optimized XGBoost model.
-   **πŸ€– AI Crime Safety Assistant**: Interactive chatbot for safety tips and model explanations.

## Installation

1.  **Clone the repository**:
    ```bash
    git clone <repository-url>
    cd Hackathon
    ```

2.  **Install dependencies**:
    ```bash
    pip install -r requirements.txt
    ```

3.  **Run the application**:
    ```bash
    streamlit run src/app.py
    ```

## Docker Support
Build and run the container:
```bash
docker build -t sf-crime-app .
docker run -p 8501:8501 sf-crime-app
```

## Technologies
-   **Frontend**: Streamlit
-   **Backend**: Python, Pandas, NumPy
-   **ML Models**: XGBoost, Scikit-Learn (KMeans)
-   **Visualization**: Plotly, Folium
-   **AI Integration**: Groq (Llama 3)

---
*Developed for HEC Hackathon*