MHuzaifaa's picture
Upload project
61b0513

SF Crime Prediction App

This is a Streamlit application for predicting crime categories in San Francisco using an XGBoost model.

Setup

  1. Install Dependencies:

    pip install -r requirements.txt
    
  2. Run the App:

    streamlit run streamlit_app.py
    

    Or simply double-click run_app.bat.

Model Info

The app uses crime_xgb_artifacts.pkl which contains:

  • XGBoost Model
  • LabelEncoder for Target (Crime Category)
  • FeatureHashers for Address and Description

Note: The model expects specific features including hashed Address and Description. Ensure you provide these inputs in the UI for accurate predictions. Note: The District encoder was missing from the provided files, so a default alphabetical mapping is used.

Deployment

To deploy on the web (e.g., Streamlit Cloud):

  1. Push this code to a GitHub repository.
  2. Sign up for Streamlit Cloud.
  3. Connect your GitHub and deploy the app.