BSJ2004 commited on
Commit
82f07ee
1 Parent(s): 88ddb04

Upload 31 files

Browse files
.gitattributes CHANGED
@@ -33,3 +33,7 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ static/videos/crime_login.mp4 filter=lfs diff=lfs merge=lfs -text
37
+ static/videos/crime.mp4 filter=lfs diff=lfs merge=lfs -text
38
+ templates/crime_distribution_district.html filter=lfs diff=lfs merge=lfs -text
39
+ templates/Distribution_of_Accused_Ages.html filter=lfs diff=lfs merge=lfs -text
LICENSE ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Britto Sam Jose J
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
README.md CHANGED
@@ -1,11 +1,89 @@
1
- ---
2
- title: Karnataka State Police Hackathon-police-rescue
3
- emoji:
4
- colorFrom: purple
5
- colorTo: indigo
6
- sdk: docker
7
- pinned: false
8
- license: mit
9
- ---
10
-
11
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Crime Prediction and Forecasting Web Application
2
+
3
+ ## Overview
4
+ This web application is developed for the KSP Hackathon, aimed at predicting and forecasting crime trends in various districts. The application utilizes machine learning models to predict the likelihood of crimes based on various inputs and provides visualizations for crime data.
5
+
6
+ ## Installation and Setup
7
+ To run the application, follow these steps:
8
+
9
+ 1. **Clone the repository**:
10
+ ```bash
11
+ git clone <repository-url>
12
+ cd <repository-directory>
13
+ ```
14
+
15
+ 2. **Install required libraries**:
16
+ Make sure you have `pip` installed, then run:
17
+ ```bash
18
+ pip install -r requirements.txt
19
+ ```
20
+
21
+ 3. **Run the application**:
22
+ ```bash
23
+ python app.py
24
+ ```
25
+
26
+ 4. **Access the application**:
27
+ Open your browser and go to `http://0.0.0.0:5000/`.
28
+
29
+ 5. **Login credentials**:
30
+ - **Username**: `admin`
31
+ - **Password**: `admin123`
32
+
33
+ ## File Structure
34
+ - `app.py`: Main application script containing all routes and logic.
35
+ - `templates/`: Directory containing HTML templates for rendering web pages.
36
+ - `static/`: Directory for static files such as CSS and JavaScript.
37
+ - `models/`: Directory containing pre-trained models and data files.
38
+ - `requirements.txt`: File containing a list of Python dependencies.
39
+
40
+ ## Functionality
41
+ ### Web Pages
42
+ - **Login Page (`/`)**: User login with predefined credentials.
43
+ - **Index Page (`/index`)**: Dashboard overview after logging in.
44
+ - **District Pages**: Separate pages for each district, e.g., `/Bagalkot`, `/Bengaluru_City`.
45
+ - **Crime Distribution (`/crime_distribution_district`)**: Visualize crime distribution across districts.
46
+ - **Accused Age Distribution (`/Distribution_of_Accused_Ages`)**: Visualize age distribution of accused individuals.
47
+ - **Forecast Crime (`/forecast_crime`)**: Predict and forecast future crime trends.
48
+ - **Recent Crimes (`/Recent_Crimes`)**: Display recent crime data.
49
+ - **Heat Map (`/heat-map`)**: Heat map visualization of crime incidents.
50
+ - **Crime Marker (`/crime-marker`)**: Marker map visualization for crime locations.
51
+ - **Cluster Analysis (`/cluster`)**: Display clustering analysis of crime data.
52
+ - **Crime Prediction (`/predict`)**: Predict the likelihood of crime based on user inputs.
53
+ - **Future Crime Forecast (`/future-crime-forecast`)**: Forecast future crime trends using ARIMA model.
54
+
55
+ ### Models and Data
56
+ - **Logistic Regression Model** (`logistic_regression_model.pkl`): Used for predicting crime likelihood.
57
+ - **Deployment Plan** (`deployment_plan.pkl`): Contains cluster information and deployment strategies.
58
+ - **Crime Data** (`predicted_crime.pkl`): Contains predicted crime data for future years.
59
+ - **ARIMA Model** (`arima_model.pkl`): Time series model for forecasting future crime trends.
60
+
61
+ ## Usage
62
+ ### Predict Crime
63
+ 1. Navigate to `/predict`.
64
+ 2. Enter the required details: age, sex, present city, and present state.
65
+ 3. Submit the form to get the prediction result.
66
+
67
+ ### Get Closest Cluster
68
+ 1. Navigate to `/get-closest-cluster`.
69
+ 2. Provide latitude and longitude to get the closest crime cluster details.
70
+
71
+ ### Crime Prediction for Future Years
72
+ 1. Navigate to `/crime-prediction`.
73
+ 2. Select the year (2025 or 2026) to view predicted crime trends for each month.
74
+
75
+ ### Future Crime Forecast
76
+ 1. Navigate to `/future-crime-forecast`.
77
+ 2. Enter the start date and the number of future steps to forecast.
78
+ 3. View the forecasted crime trend plot and data.
79
+
80
+ ## Prototype Link
81
+ For a live demo of the application, visit the prototype link:
82
+ [Crime Prediction App](https://super-umbrella-pj7j4xpp49v9c6g4g-5000.app.github.dev/)
83
+
84
+ ## Notes
85
+ - Ensure that all the necessary models and data files are present in the `models/` directory before running the application.
86
+ - The application runs on Flask and requires the necessary dependencies listed in `requirements.txt`.
87
+
88
+ ## Contact
89
+ For any issues or inquiries, please contact [brittosamjosej@gmail.com].
app.py ADDED
@@ -0,0 +1,236 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from flask import Flask, render_template, request, jsonify, send_from_directory
2
+ import pickle
3
+ import pandas as pd
4
+ import plotly.express as px
5
+ import os
6
+ import joblib
7
+ from geopy.distance import geodesic
8
+ import matplotlib.pyplot as plt
9
+ import io
10
+ import base64
11
+
12
+ app = Flask(__name__)
13
+
14
+ # Load models
15
+ with open(r'C:\Users\hp\Downloads\flask\models\logistic_regression_model.pkl', 'rb') as f:
16
+ logistic_model = pickle.load(f)
17
+
18
+ with open(r'C:\Users\hp\Downloads\flask\models\deployment_plan.pkl', 'rb') as file:
19
+ deployment_plan = pickle.load(file)
20
+ centroids = {key: value['cluster_centroid'] for key, value in deployment_plan.items()}
21
+
22
+ def load_crime_data():
23
+ pickle_path = r'C:\Users\hp\Downloads\flask\models\predicted_crime.pkl'
24
+ if os.path.exists(pickle_path):
25
+ try:
26
+ data = joblib.load(pickle_path)
27
+ except (ModuleNotFoundError, ImportError):
28
+ with open(pickle_path, 'rb') as f:
29
+ data = pickle.load(f)
30
+ if 'predicted_df_2025' in data and 'predicted_df_2026' in data:
31
+ return data
32
+ else:
33
+ raise KeyError("Expected keys ('predicted_df_2025', 'predicted_df_2026') not found in data.")
34
+ else:
35
+ raise FileNotFoundError("Pickle file 'predicted_crime.pkl' not found.")
36
+ try:
37
+ crime_data = load_crime_data()
38
+ except (FileNotFoundError, KeyError, ImportError) as e:
39
+ crime_data = None
40
+ print(f"Error loading data: {e}")
41
+
42
+ def load_arima_model():
43
+ pickle_path = r"C:\Users\hp\Downloads\flask\models\arima_model.pkl"
44
+ if not os.path.exists(pickle_path):
45
+ raise FileNotFoundError(f"File not found: {pickle_path}")
46
+ with open(pickle_path, 'rb') as f:
47
+ return pickle.load(f)
48
+
49
+ @app.route('/')
50
+ def login():
51
+ return render_template('login.html')
52
+
53
+ @app.route('/index')
54
+ def index():
55
+ return render_template('index.html')
56
+
57
+ @app.route('/Bagalkot')
58
+ def bagalkot():
59
+ return render_template('Bagalkot.html')
60
+
61
+ @app.route('/Bengaluru_City')
62
+ def bengaluru_city():
63
+ return render_template('Bengaluru_City.html')
64
+
65
+ @app.route('/Bengaluru_district')
66
+ def bengaluru_district():
67
+ return render_template('Bengaluru_district.html')
68
+
69
+ @app.route('/crime_distribution_district')
70
+ def crime_distribution_district():
71
+ return render_template('crime_distribution_district.html')
72
+
73
+ @app.route('/Distribution_of_Accused_Ages')
74
+ def distribution_of_accused_ages():
75
+ return render_template('Distribution_of_Accused_Ages.html')
76
+
77
+ @app.route('/forecast_crime')
78
+ def forecast_crime():
79
+ return render_template('forecast_crime.html')
80
+
81
+ @app.route('/Mandya')
82
+ def mandya():
83
+ return render_template('Mandya.html')
84
+
85
+ @app.route('/Recent_Crimes')
86
+ def recent_crimes():
87
+ return render_template('Recent_Crimes.html')
88
+
89
+ @app.route('/Shivamogga')
90
+ def shivamogga():
91
+ return render_template('Shivamogga.html')
92
+
93
+ @app.route('/Tumakuru')
94
+ def tumakuru():
95
+ return render_template('Tumakuru.html')
96
+
97
+ @app.route('/heat-map')
98
+ def heat_map():
99
+ return render_template('heat-map.html')
100
+
101
+ @app.route('/crime-marker')
102
+ def crime_map():
103
+ return render_template('crime_map.html')
104
+
105
+ @app.route('/predict', methods=['GET', 'POST'])
106
+ def predict():
107
+ predicted_status = ""
108
+ if request.method == 'POST':
109
+ age = int(request.form['age'])
110
+ sex = request.form['sex']
111
+ present_city = request.form['present_city']
112
+ present_state = request.form['present_state']
113
+ sex_female = 1 if sex == 'FEMALE' else 0
114
+ sex_male = 1 if sex == 'MALE' else 0
115
+ city_bengaluru = 1 if present_city == 'Bengaluru City' else 0
116
+ state_karnataka = 1 if present_state == 'Karnataka' else 0
117
+ input_data = pd.DataFrame({
118
+ 'age': [age],
119
+ 'Sex_FEMALE': [sex_female],
120
+ 'Sex_MALE': [sex_male],
121
+ 'PresentCity_Bengaluru City': [city_bengaluru],
122
+ 'PresentState_Karnataka': [state_karnataka]
123
+ })
124
+ prediction = logistic_model.predict(input_data)
125
+ predicted_status = prediction[0]
126
+ elif request.method == 'GET':
127
+ age = int(request.args.get('age', 0))
128
+ sex = request.args.get('sex', '')
129
+ present_city = request.args.get('present_city', '')
130
+ present_state = request.args.get('present_state', '')
131
+ sex_female = 1 if sex == 'FEMALE' else 0
132
+ sex_male = 1 if sex == 'MALE' else 0
133
+ city_bengaluru = 1 if present_city == 'Bengaluru City' else 0
134
+ state_karnataka = 1 if present_state == 'Karnataka' else 0
135
+ input_data = pd.DataFrame({
136
+ 'age': [age],
137
+ 'Sex_FEMALE': [sex_female],
138
+ 'Sex_MALE': [sex_male],
139
+ 'PresentCity_Bengaluru City': [city_bengaluru],
140
+ 'PresentState_Karnataka': [state_karnataka]
141
+ })
142
+ prediction = logistic_model.predict(input_data)
143
+ predicted_status = prediction[0]
144
+ return render_template('behavior.html', predicted_status=predicted_status)
145
+
146
+ @app.route('/cluster', methods=['GET'])
147
+ def cluster():
148
+ return render_template('cluster.html')
149
+
150
+ @app.route('/get-closest-cluster', methods=['GET'])
151
+ def get_closest_cluster():
152
+ latitude = float(request.args.get('latitude'))
153
+ longitude = float(request.args.get('longitude'))
154
+
155
+ closest_cluster = min(
156
+ centroids.keys(),
157
+ key=lambda c: geodesic(
158
+ (latitude, longitude),
159
+ (centroids[c]['Latitude'], centroids[c]['Longitude'])
160
+ ).km
161
+ )
162
+
163
+ cluster_data = deployment_plan[closest_cluster]
164
+
165
+ return jsonify({
166
+ 'closest_cluster': closest_cluster,
167
+ 'cluster_centroid': cluster_data['cluster_centroid'],
168
+ 'number_of_incidents': cluster_data['number_of_incidents'],
169
+ 'suggestions': cluster_data['suggestions'],
170
+ }), 200
171
+
172
+ @app.route('/crime-prediction', methods=['GET', 'POST'])
173
+ def crime_prediction():
174
+ year_selected = request.form.get('year')
175
+ graph_html = None
176
+ error = None
177
+ if year_selected:
178
+ if crime_data is None:
179
+ error = "Data could not be loaded."
180
+ else:
181
+ year_selected = int(year_selected)
182
+ if year_selected == 2025:
183
+ predicted_df = crime_data['predicted_df_2025']
184
+ start_date = '2025-01-01'
185
+ steps = 12
186
+ elif year_selected == 2026:
187
+ predicted_df = crime_data['predicted_df_2026']
188
+ start_date = '2026-01-01'
189
+ steps = 24
190
+ else:
191
+ return render_template('crime_prediction.html', graph=None, error="Invalid year selected")
192
+ predicted_df_long = predicted_df.melt(
193
+ id_vars='CrimeGroup_Name', var_name='Month', value_name='Predicted_Count'
194
+ )
195
+ fig = px.line(
196
+ predicted_df_long,
197
+ x='Month', y='Predicted_Count', color='CrimeGroup_Name',
198
+ title=f'Top 5 Predicted Crimes for Each Month in {year_selected}'
199
+ )
200
+ graph_html = fig.to_html(full_html=False)
201
+ return render_template('crime_prediction.html', graph=graph_html, error=error)
202
+
203
+ @app.route('/future-crime-forecast', methods=['GET', 'POST'])
204
+ def future_crime_forecast():
205
+ future_steps = 12
206
+ forecast_plot = None
207
+ forecast_results = None
208
+ if request.method == 'POST':
209
+ try:
210
+ model_fit = load_arima_model()
211
+ if request.form.get('future_steps'):
212
+ future_steps = int(request.form.get('future_steps'))
213
+ start_date_input = request.form.get('start_date', "2024-03-02")
214
+ start_date = pd.to_datetime(start_date_input)
215
+ future_forecast = model_fit.forecast(steps=future_steps)
216
+ future_dates = pd.date_range(start=start_date, periods=future_steps, freq='M')
217
+ plt.figure(figsize=(10, 6))
218
+ plt.plot(future_dates, future_forecast, label="Forecast")
219
+ plt.legend()
220
+ plt.title("Future Crime Forecast")
221
+ plt.xlabel("Date")
222
+ plt.ylabel("Predicted Crime Count")
223
+ buf = io.BytesIO()
224
+ plt.savefig(buf, format='png')
225
+ buf.seek(0)
226
+ forecast_plot = base64.b64encode(buf.getvalue()).decode('utf-8')
227
+ forecast_results = future_forecast.tolist()
228
+ plt.close()
229
+ except Exception as e:
230
+ print(f"Error: {e}")
231
+ forecast_plot = None
232
+ forecast_results = None
233
+ return render_template('future_crime.html', forecast_plot=forecast_plot, forecast_results=forecast_results, future_steps=future_steps)
234
+
235
+ if __name__ == '__main__':
236
+ app.run(debug=True, host='0.0.0.0', port=5000)
models/arima_model.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4a0dc6d9b51cb4a8dccddc7b865981b7d140392f975d8818efaecbac3426cf18
3
+ size 724531
models/deployment_plan.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0436409862e46977fd11a5c3e9e6e415928c5cf9dbc17af0d7768f1631ae0c36
3
+ size 553
models/logistic_regression_model.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ee7c783d2e76ee847a7b759f79f0505537185daf4d5105085c4a8610def7d81d
3
+ size 886
models/predicted_crime.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4627f9cefc7bae53da0d8d8286165c8f4355fae70714e60041db8df27d5113d4
3
+ size 1246475
requirements.txt ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ Flask==2.1.1
2
+ pandas==1.4.2
3
+ plotly==5.7.0
4
+ geopy==2.2.0
5
+ matplotlib==3.5.1
6
+ joblib==1.1.0
7
+ scikit-learn==1.0.2
8
+ statsmodels==0.13.2
9
+ werkzeug==2.0.3
static/images/Seal_of_Karnataka.png ADDED
static/images/logo.png ADDED
static/videos/crime.avif ADDED
static/videos/crime.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f01447fbc45ca89fb478e7a4f253e6f3179ef032519e2d5bee9e5ad680f2908c
3
+ size 4132169
static/videos/crime_login.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3ed28ad301506b0e51027e98590b28fcd980a871201f5d07872f83d9c2380c1e
3
+ size 3074394
templates/Bagalkot.html ADDED
The diff for this file is too large to render. See raw diff
 
templates/Bengaluru City.html ADDED
The diff for this file is too large to render. See raw diff
 
templates/Bengaluru_district.html ADDED
The diff for this file is too large to render. See raw diff
 
templates/Distribution_of_Accused_Ages.html ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fe4113065e81ccec326a5a158c97bb45e397ed8ffe082b6805901e6767714084
3
+ size 18804115
templates/Mandya.html ADDED
The diff for this file is too large to render. See raw diff
 
templates/Recent_Crimes.html ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ <html>
2
+ <head><meta charset="utf-8" /></head>
3
+ <body>
4
+ <div> <script type="text/javascript">window.PlotlyConfig = {MathJaxConfig: 'local'};</script>
5
+ <script src="https://cdn.plot.ly/plotly-2.12.1.min.js"></script> <div id="6f546c49-7539-4c7b-8b21-2ef038166a02" class="plotly-graph-div" style="height:100%; width:100%;"></div> <script type="text/javascript"> window.PLOTLYENV=window.PLOTLYENV || {}; if (document.getElementById("6f546c49-7539-4c7b-8b21-2ef038166a02")) { Plotly.newPlot( "6f546c49-7539-4c7b-8b21-2ef038166a02", [{"name":"MOTOR VEHICLE ACCIDENTS NON-FATAL","x":[1,2,3],"y":[2735,2807,968],"type":"bar"},{"name":"THEFT","x":[1,2,3],"y":[1916,1992,628],"type":"bar"},{"name":" CYBER CRIME","x":[1,2,3],"y":[1896,1999,619],"type":"bar"},{"name":"MISSING PERSON","x":[1,2,3],"y":[1739,1894,574],"type":"bar"},{"name":"CASES OF HURT","x":[1,2,3],"y":[1367,1456,466],"type":"bar"}], {"barmode":"stack","title":{"text":"Top 5 Recent Crime Occurences by Month - 2024"},"xaxis":{"title":{"text":"Month"}},"yaxis":{"title":{"text":"Number of Occurrences"}},"template":{"data":{"histogram2dcontour":[{"type":"histogram2dcontour","colorbar":{"outlinewidth":0,"ticks":""},"colorscale":[[0.0,"#0d0887"],[0.1111111111111111,"#46039f"],[0.2222222222222222,"#7201a8"],[0.3333333333333333,"#9c179e"],[0.4444444444444444,"#bd3786"],[0.5555555555555556,"#d8576b"],[0.6666666666666666,"#ed7953"],[0.7777777777777778,"#fb9f3a"],[0.8888888888888888,"#fdca26"],[1.0,"#f0f921"]]}],"choropleth":[{"type":"choropleth","colorbar":{"outlinewidth":0,"ticks":""}}],"histogram2d":[{"type":"histogram2d","colorbar":{"outlinewidth":0,"ticks":""},"colorscale":[[0.0,"#0d0887"],[0.1111111111111111,"#46039f"],[0.2222222222222222,"#7201a8"],[0.3333333333333333,"#9c179e"],[0.4444444444444444,"#bd3786"],[0.5555555555555556,"#d8576b"],[0.6666666666666666,"#ed7953"],[0.7777777777777778,"#fb9f3a"],[0.8888888888888888,"#fdca26"],[1.0,"#f0f921"]]}],"heatmap":[{"type":"heatmap","colorbar":{"outlinewidth":0,"ticks":""},"colorscale":[[0.0,"#0d0887"],[0.1111111111111111,"#46039f"],[0.2222222222222222,"#7201a8"],[0.3333333333333333,"#9c179e"],[0.4444444444444444,"#bd3786"],[0.5555555555555556,"#d8576b"],[0.6666666666666666,"#ed7953"],[0.7777777777777778,"#fb9f3a"],[0.8888888888888888,"#fdca26"],[1.0,"#f0f921"]]}],"heatmapgl":[{"type":"heatmapgl","colorbar":{"outlinewidth":0,"ticks":""},"colorscale":[[0.0,"#0d0887"],[0.1111111111111111,"#46039f"],[0.2222222222222222,"#7201a8"],[0.3333333333333333,"#9c179e"],[0.4444444444444444,"#bd3786"],[0.5555555555555556,"#d8576b"],[0.6666666666666666,"#ed7953"],[0.7777777777777778,"#fb9f3a"],[0.8888888888888888,"#fdca26"],[1.0,"#f0f921"]]}],"contourcarpet":[{"type":"contourcarpet","colorbar":{"outlinewidth":0,"ticks":""}}],"contour":[{"type":"contour","colorbar":{"outlinewidth":0,"ticks":""},"colorscale":[[0.0,"#0d0887"],[0.1111111111111111,"#46039f"],[0.2222222222222222,"#7201a8"],[0.3333333333333333,"#9c179e"],[0.4444444444444444,"#bd3786"],[0.5555555555555556,"#d8576b"],[0.6666666666666666,"#ed7953"],[0.7777777777777778,"#fb9f3a"],[0.8888888888888888,"#fdca26"],[1.0,"#f0f921"]]}],"surface":[{"type":"surface","colorbar":{"outlinewidth":0,"ticks":""},"colorscale":[[0.0,"#0d0887"],[0.1111111111111111,"#46039f"],[0.2222222222222222,"#7201a8"],[0.3333333333333333,"#9c179e"],[0.4444444444444444,"#bd3786"],[0.5555555555555556,"#d8576b"],[0.6666666666666666,"#ed7953"],[0.7777777777777778,"#fb9f3a"],[0.8888888888888888,"#fdca26"],[1.0,"#f0f921"]]}],"mesh3d":[{"type":"mesh3d","colorbar":{"outlinewidth":0,"ticks":""}}],"scatter":[{"fillpattern":{"fillmode":"overlay","size":10,"solidity":0.2},"type":"scatter"}],"parcoords":[{"type":"parcoords","line":{"colorbar":{"outlinewidth":0,"ticks":""}}}],"scatterpolargl":[{"type":"scatterpolargl","marker":{"colorbar":{"outlinewidth":0,"ticks":""}}}],"bar":[{"error_x":{"color":"#2a3f5f"},"error_y":{"color":"#2a3f5f"},"marker":{"line":{"color":"#E5ECF6","width":0.5},"pattern":{"fillmode":"overlay","size":10,"solidity":0.2}},"type":"bar"}],"scattergeo":[{"type":"scattergeo","marker":{"colorbar":{"outlinewidth":0,"ticks":""}}}],"scatterpolar":[{"type":"scatterpolar","marker":{"colorbar":{"outlinewidth":0,"ticks":""}}}],"histogram":[{"marker":{"pattern":{"fillmode":"overlay","size":10,"solidity":0.2}},"type":"histogram"}],"scattergl":[{"type":"scattergl","marker":{"colorbar":{"outlinewidth":0,"ticks":""}}}],"scatter3d":[{"type":"scatter3d","line":{"colorbar":{"outlinewidth":0,"ticks":""}},"marker":{"colorbar":{"outlinewidth":0,"ticks":""}}}],"scattermapbox":[{"type":"scattermapbox","marker":{"colorbar":{"outlinewidth":0,"ticks":""}}}],"scatterternary":[{"type":"scatterternary","marker":{"colorbar":{"outlinewidth":0,"ticks":""}}}],"scattercarpet":[{"type":"scattercarpet","marker":{"colorbar":{"outlinewidth":0,"ticks":""}}}],"carpet":[{"aaxis":{"endlinecolor":"#2a3f5f","gridcolor":"white","linecolor":"white","minorgridcolor":"white","startlinecolor":"#2a3f5f"},"baxis":{"endlinecolor":"#2a3f5f","gridcolor":"white","linecolor":"white","minorgridcolor":"white","startlinecolor":"#2a3f5f"},"type":"carpet"}],"table":[{"cells":{"fill":{"color":"#EBF0F8"},"line":{"color":"white"}},"header":{"fill":{"color":"#C8D4E3"},"line":{"color":"white"}},"type":"table"}],"barpolar":[{"marker":{"line":{"color":"#E5ECF6","width":0.5},"pattern":{"fillmode":"overlay","size":10,"solidity":0.2}},"type":"barpolar"}],"pie":[{"automargin":true,"type":"pie"}]},"layout":{"autotypenumbers":"strict","colorway":["#636efa","#EF553B","#00cc96","#ab63fa","#FFA15A","#19d3f3","#FF6692","#B6E880","#FF97FF","#FECB52"],"font":{"color":"#2a3f5f"},"hovermode":"closest","hoverlabel":{"align":"left"},"paper_bgcolor":"white","plot_bgcolor":"#E5ECF6","polar":{"bgcolor":"#E5ECF6","angularaxis":{"gridcolor":"white","linecolor":"white","ticks":""},"radialaxis":{"gridcolor":"white","linecolor":"white","ticks":""}},"ternary":{"bgcolor":"#E5ECF6","aaxis":{"gridcolor":"white","linecolor":"white","ticks":""},"baxis":{"gridcolor":"white","linecolor":"white","ticks":""},"caxis":{"gridcolor":"white","linecolor":"white","ticks":""}},"coloraxis":{"colorbar":{"outlinewidth":0,"ticks":""}},"colorscale":{"sequential":[[0.0,"#0d0887"],[0.1111111111111111,"#46039f"],[0.2222222222222222,"#7201a8"],[0.3333333333333333,"#9c179e"],[0.4444444444444444,"#bd3786"],[0.5555555555555556,"#d8576b"],[0.6666666666666666,"#ed7953"],[0.7777777777777778,"#fb9f3a"],[0.8888888888888888,"#fdca26"],[1.0,"#f0f921"]],"sequentialminus":[[0.0,"#0d0887"],[0.1111111111111111,"#46039f"],[0.2222222222222222,"#7201a8"],[0.3333333333333333,"#9c179e"],[0.4444444444444444,"#bd3786"],[0.5555555555555556,"#d8576b"],[0.6666666666666666,"#ed7953"],[0.7777777777777778,"#fb9f3a"],[0.8888888888888888,"#fdca26"],[1.0,"#f0f921"]],"diverging":[[0,"#8e0152"],[0.1,"#c51b7d"],[0.2,"#de77ae"],[0.3,"#f1b6da"],[0.4,"#fde0ef"],[0.5,"#f7f7f7"],[0.6,"#e6f5d0"],[0.7,"#b8e186"],[0.8,"#7fbc41"],[0.9,"#4d9221"],[1,"#276419"]]},"xaxis":{"gridcolor":"white","linecolor":"white","ticks":"","title":{"standoff":15},"zerolinecolor":"white","automargin":true,"zerolinewidth":2},"yaxis":{"gridcolor":"white","linecolor":"white","ticks":"","title":{"standoff":15},"zerolinecolor":"white","automargin":true,"zerolinewidth":2},"scene":{"xaxis":{"backgroundcolor":"#E5ECF6","gridcolor":"white","linecolor":"white","showbackground":true,"ticks":"","zerolinecolor":"white","gridwidth":2},"yaxis":{"backgroundcolor":"#E5ECF6","gridcolor":"white","linecolor":"white","showbackground":true,"ticks":"","zerolinecolor":"white","gridwidth":2},"zaxis":{"backgroundcolor":"#E5ECF6","gridcolor":"white","linecolor":"white","showbackground":true,"ticks":"","zerolinecolor":"white","gridwidth":2}},"shapedefaults":{"line":{"color":"#2a3f5f"}},"annotationdefaults":{"arrowcolor":"#2a3f5f","arrowhead":0,"arrowwidth":1},"geo":{"bgcolor":"white","landcolor":"#E5ECF6","subunitcolor":"white","showland":true,"showlakes":true,"lakecolor":"white"},"title":{"x":0.05},"mapbox":{"style":"light"}}}}, {"responsive": true} ) }; </script> </div>
6
+ </body>
7
+ </html>
templates/Shivamogga.html ADDED
The diff for this file is too large to render. See raw diff
 
templates/Tumakuru.html ADDED
The diff for this file is too large to render. See raw diff
 
templates/behavior.html ADDED
@@ -0,0 +1,340 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Crime Dashboard</title>
7
+ <style>
8
+ body {
9
+ font-family: Arial, sans-serif;
10
+ background-color: #121212;
11
+ color: white;
12
+ margin: 0;
13
+ padding: 0;
14
+ }
15
+
16
+ .container {
17
+ display: flex;
18
+ min-height: 100vh;
19
+ }
20
+
21
+ .sidebar {
22
+ width: 300px;
23
+ background-color: #2A2A2A;
24
+ padding: 20px;
25
+ box-sizing: border-box;
26
+ }
27
+
28
+ .sidebar h2, .sidebar h1, .sidebar label {
29
+ color: #EFF204;
30
+ }
31
+
32
+ .sidebar form {
33
+ margin-top: 20px;
34
+ }
35
+
36
+ .sidebar .form-group {
37
+ margin-bottom: 20px;
38
+ }
39
+
40
+ .sidebar .form-control {
41
+ background-color: #121212;
42
+ color: white;
43
+ border: 1px solid #444;
44
+ width: 100%;
45
+ }
46
+
47
+ .sidebar .btn-primary {
48
+ background-color: #FF4747;
49
+ border: none;
50
+ width: 100%;
51
+ }
52
+
53
+ .sidebar .btn-back {
54
+ background-color: #FF4747;
55
+ border: none;
56
+ width: 100%;
57
+ margin-bottom: 20px;
58
+ }
59
+
60
+ .sidebar .chart-container {
61
+ margin-top: 20px;
62
+ background-color: #1E1E1E;
63
+ padding: 20px;
64
+ border-radius: 8px;
65
+ }
66
+
67
+ .sidebar canvas {
68
+ width: 100% !important;
69
+ height: 300px; /* Set a fixed height for the chart */
70
+ }
71
+
72
+ .main-content {
73
+ flex: 1;
74
+ padding: 20px;
75
+ box-sizing: border-box;
76
+ }
77
+
78
+ .header h1 {
79
+ color: #EFF204;
80
+ }
81
+
82
+ .content {
83
+ display: flex;
84
+ flex-wrap: wrap;
85
+ gap: 20px;
86
+ }
87
+
88
+ .chart {
89
+ background-color: #1E1E1E;
90
+ padding: 20px;
91
+ border-radius: 8px;
92
+ box-sizing: border-box;
93
+ width: calc(50% - 10px); /* Adjusted to fit two charts in a row */
94
+ height: 300px; /* Reduced height */
95
+ }
96
+
97
+ .live-data {
98
+ background-color: #1E1E1E;
99
+ padding: 20px;
100
+ border-radius: 8px;
101
+ box-sizing: border-box;
102
+ width: 100%;
103
+ height: 300px; /* Reduced height */
104
+ margin-bottom: 20px;
105
+ }
106
+
107
+ .statistics {
108
+ background-color: #1E1E1E;
109
+ padding: 20px;
110
+ border-radius: 8px;
111
+ box-sizing: border-box;
112
+ width: 100%;
113
+ margin-bottom: 20px;
114
+ }
115
+
116
+ .statistics h3 {
117
+ color: #EFF204;
118
+ margin: 10px 0;
119
+ }
120
+
121
+ .statistics p {
122
+ color: #FF4747;
123
+ }
124
+
125
+ .forecast {
126
+ background-color: #1E1E1E;
127
+ padding: 20px;
128
+ border-radius: 8px;
129
+ box-sizing: border-box;
130
+ width: 100%;
131
+ text-align: center;
132
+ margin-bottom: 20px;
133
+ }
134
+
135
+ .forecast h2 {
136
+ color: #EFF204;
137
+ }
138
+
139
+ .forecast img {
140
+ max-width: 100%;
141
+ height: auto;
142
+ }
143
+
144
+ .forecast ul {
145
+ list-style: none;
146
+ padding: 0;
147
+ }
148
+
149
+ .forecast ul li {
150
+ margin: 5px 0;
151
+ }
152
+
153
+ canvas {
154
+ height: 100% !important; /* Ensures the canvas elements take the full height of their container */
155
+ }
156
+ </style>
157
+ </head>
158
+ <body>
159
+ <div class="container">
160
+ <div class="sidebar">
161
+ <button class="btn-back" onclick="goBack()">Back</button>
162
+ <h2>Dashboard</h2>
163
+ <h1>Predict Behavioral Status</h1>
164
+ <form action="/predict" method="POST" class="form-group">
165
+ <div class="form-group">
166
+ <label for="age">Enter age:</label>
167
+ <input type="number" id="age" name="age" min="0" required class="form-control"><br>
168
+ </div>
169
+
170
+ <div class="form-group">
171
+ <label>Select sex:</label>
172
+ <div>
173
+ <div class="form-check form-check-inline">
174
+ <input type="radio" id="female" name="sex" value="FEMALE" checked class="form-check-input">
175
+ <label for="female" class="form-check-label">Female</label>
176
+ </div>
177
+ <div class="form-check form-check-inline">
178
+ <input type="radio" id="male" name="sex" value="MALE" class="form-check-input">
179
+ <label for="male" class="form-check-label">Male</label>
180
+ </div>
181
+ </div>
182
+ </div>
183
+
184
+ <div class="form-group">
185
+ <label>Select present city:</label>
186
+ <div>
187
+ <div class="form-check form-check-inline">
188
+ <input type="radio" id="bengaluru" name="present_city" value="Bengaluru City" checked class="form-check-input">
189
+ <label for="bengaluru" class="form-check-label">Bengaluru City</label>
190
+ </div>
191
+ <div class="form-check form-check-inline">
192
+ <input type="radio" id="other_city" name="present_city" value="Other" class="form-check-input">
193
+ <label for="other_city" class="form-check-label">Other</label>
194
+ </div>
195
+ </div>
196
+ </div>
197
+
198
+ <div class="form-group">
199
+ <label>Select present state:</label>
200
+ <div>
201
+ <div class="form-check form-check-inline">
202
+ <input type="radio" id="karnataka" name="present_state" value="Karnataka" checked class="form-check-input">
203
+ <label for="karnataka" class="form-check-label">Karnataka</label>
204
+ </div>
205
+ <div class="form-check form-check-inline">
206
+ <input type="radio" id="other_state" name="present_state" value="Other" class="form-check-input">
207
+ <label for="other_state" class="form-check-label">Other</label>
208
+ </div>
209
+ </div>
210
+ </div>
211
+
212
+ <button type="submit" class="btn btn-primary">Predict Behavioral Status</button>
213
+ </form>
214
+
215
+ <!-- New chart added below the form -->
216
+ <div class="chart-container">
217
+ <canvas id="newChart"></canvas>
218
+ </div>
219
+ </div>
220
+ <div class="main-content">
221
+ <div class="header">
222
+ <h1>Analysis</h1>
223
+ </div>
224
+ <div class="content">
225
+ <div class="chart">
226
+ <!-- Inserted iframe in place of the original chart -->
227
+ <iframe src="http://127.0.0.1:5000/Bengaluru_district" style="width:100%; height:100%; border:none;"></iframe>
228
+ </div>
229
+ <div class="chart">
230
+ <!-- Inserted iframe in place of the original chart -->
231
+ <iframe src="http://127.0.0.1:5000/Distribution_of_Accused_Ages" style="width:100%; height:100%; border:none;"></iframe>
232
+ </div>
233
+
234
+ <div class="forecast">
235
+ <!-- Prediction Result -->
236
+ {% if predicted_status %}
237
+ <div class="alert alert-success mt-4">
238
+ <h2>Prediction Result</h2>
239
+ <p>The predicted Behavioral Status is: <strong>{{ predicted_status }}</strong></p>
240
+ </div>
241
+ {% endif %}
242
+ </div>
243
+
244
+ <div class="chart">
245
+ <canvas id="waterfallChart"></canvas>
246
+ </div>
247
+ <div class="chart">
248
+ <canvas id="radarChart"></canvas>
249
+ </div>
250
+ </div>
251
+ </div>
252
+ </div>
253
+
254
+ <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
255
+ <script src="https://cdn.jsdelivr.net/npm/chartjs-plugin-datalabels"></script>
256
+ <script>
257
+ function goBack() {
258
+ window.location.href = 'http://127.0.0.1:5000/index';
259
+ }
260
+
261
+ document.addEventListener("DOMContentLoaded", function() {
262
+ // Waterfall Chart
263
+ const waterfallCtx = document.getElementById('waterfallChart').getContext('2d');
264
+ new Chart(waterfallCtx, {
265
+ type: 'bar',
266
+ data: {
267
+ labels: ['Start', '1', '0', '0', '1', 'End'],
268
+ datasets: [{
269
+ label: 'Age Chart',
270
+ data: [40, 20, 10, 10, 30, 22],
271
+ backgroundColor: 'rgba(75, 192, 192, 0.8)',
272
+ borderColor: 'rgba(75, 192, 192, 1)',
273
+ borderWidth: 1
274
+ }]
275
+ },
276
+ options: {
277
+ plugins: {
278
+ datalabels: {
279
+ display: true,
280
+ color: 'black',
281
+ align: 'top'
282
+ }
283
+ },
284
+ scales: {
285
+ y: {
286
+ beginAtZero: true
287
+ }
288
+ }
289
+ }
290
+ });
291
+
292
+ // Radar Chart
293
+ const radarCtx = document.getElementById('radarChart').getContext('2d');
294
+ new Chart(radarCtx, {
295
+ type: 'radar',
296
+ data: {
297
+ labels: ['Male', 'Female', 'Both', '', '', '', ''],
298
+ datasets: [{
299
+ label: 'Age Rate Radar',
300
+ data: [25, 10, 30, 40, 45, 16, 20],
301
+ backgroundColor: 'rgba(255, 206, 86, 0.2)',
302
+ borderColor: 'rgba(255, 206, 86, 1)',
303
+ borderWidth: 1
304
+ }]
305
+ },
306
+ options: {
307
+ responsive: true,
308
+ scales: {
309
+ r: {
310
+ beginAtZero: true
311
+ }
312
+ }
313
+ }
314
+ });
315
+
316
+ // New Chart
317
+ const newChartCtx = document.getElementById('newChart').getContext('2d');
318
+ new Chart(newChartCtx, {
319
+ type: 'doughnut',
320
+ data: {
321
+ labels: ['Male', 'Female', 'Adult', 'Children'],
322
+ datasets: [{
323
+ label: 'AGE',
324
+ data: [12, 30, 40, 55],
325
+ backgroundColor: [
326
+ 'rgba(54, 162, 235, 0.8)',
327
+ 'rgba(255, 206, 86, 0.8)',
328
+ 'rgba(75, 192, 192, 0.8)',
329
+ 'rgba(153, 102, 255, 0.8)'
330
+ ]
331
+ }]
332
+ },
333
+ options: {
334
+ responsive: true
335
+ }
336
+ });
337
+ });
338
+ </script>
339
+ </body>
340
+ </html>
templates/cluster.html ADDED
@@ -0,0 +1,305 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Crime Dashboard</title>
7
+ <style>
8
+ body {
9
+ font-family: Arial, sans-serif;
10
+ background-color: #121212;
11
+ color: white;
12
+ margin: 0;
13
+ padding: 0;
14
+ }
15
+
16
+ .container {
17
+ display: flex;
18
+ min-height: 100vh;
19
+ }
20
+
21
+ .sidebar {
22
+ width: 300px;
23
+ background-color: #2A2A2A;
24
+ padding: 20px;
25
+ box-sizing: border-box;
26
+ }
27
+
28
+ .sidebar h2, .sidebar h1, .sidebar label {
29
+ color: #C70B94;
30
+ }
31
+
32
+ .sidebar form {
33
+ margin-top: 20px;
34
+ }
35
+
36
+ .sidebar .form-group {
37
+ margin-bottom: 20px;
38
+ }
39
+
40
+ .sidebar .form-control {
41
+ background-color: #121212;
42
+ color: white;
43
+ border: 1px solid #444;
44
+ width: 100%;
45
+ }
46
+
47
+ .sidebar .btn-primary {
48
+ background-color: #C70B94;
49
+ border: none;
50
+ width: 100%;
51
+ }
52
+
53
+ .sidebar .btn-back {
54
+ background-color: #C70B94;
55
+ border: none;
56
+ width: 100%;
57
+ margin-bottom: 20px;
58
+ }
59
+
60
+ .sidebar .chart-container {
61
+ margin-top: 20px;
62
+ background-color: #1E1E1E;
63
+ padding: 20px;
64
+ border-radius: 8px;
65
+ }
66
+
67
+ .sidebar canvas {
68
+ width: 100% !important;
69
+ height: 300px; /* Set a fixed height for the chart */
70
+ }
71
+
72
+ .main-content {
73
+ flex: 1;
74
+ padding: 20px;
75
+ box-sizing: border-box;
76
+ }
77
+
78
+ .header h1 {
79
+ color: #C70B94;
80
+ }
81
+
82
+ .content {
83
+ display: flex;
84
+ flex-wrap: wrap;
85
+ gap: 20px;
86
+ }
87
+
88
+ .chart {
89
+ background-color: #1E1E1E;
90
+ padding: 20px;
91
+ border-radius: 8px;
92
+ box-sizing: border-box;
93
+ width: calc(50% - 10px); /* Adjusted to fit two charts in a row */
94
+ height: 300px; /* Reduced height */
95
+ }
96
+
97
+ .live-data {
98
+ background-color: #1E1E1E;
99
+ padding: 20px;
100
+ border-radius: 8px;
101
+ box-sizing: border-box;
102
+ width: 100%;
103
+ height: 300px; /* Reduced height */
104
+ margin-bottom: 20px;
105
+ }
106
+
107
+ .statistics {
108
+ background-color: #1E1E1E;
109
+ padding: 20px;
110
+ border-radius: 8px;
111
+ box-sizing: border-box;
112
+ width: 100%;
113
+ margin-bottom: 20px;
114
+ }
115
+
116
+ .statistics h3 {
117
+ color: #FF4747;
118
+ margin: 10px 0;
119
+ }
120
+
121
+ .statistics p {
122
+ color: #FF4747;
123
+ }
124
+
125
+ .forecast {
126
+ background-color: #1E1E1E;
127
+ padding: 20px;
128
+ border-radius: 8px;
129
+ box-sizing: border-box;
130
+ width: 100%;
131
+ text-align: center;
132
+ margin-bottom: 20px;
133
+ }
134
+
135
+ .forecast h2 {
136
+ color: #FF4747;
137
+ }
138
+
139
+ .forecast img {
140
+ max-width: 100%;
141
+ height: auto;
142
+ }
143
+
144
+ .forecast ul {
145
+ list-style: none;
146
+ padding: 0;
147
+ }
148
+
149
+ .forecast ul li {
150
+ margin: 5px 0;
151
+ }
152
+
153
+ canvas {
154
+ height: 100% !important; /* Ensures the canvas elements take the full height of their container */
155
+ }
156
+ </style>
157
+ </head>
158
+ <body>
159
+ <div class="container">
160
+ <div class="sidebar">
161
+ <button class="btn-back" onclick="goBack()">Back</button>
162
+ <h2>Dashboard</h2>
163
+ <h1 class="my-4">Find Closest Cluster by Coordinates</h1>
164
+
165
+ <!-- Form to find the closest cluster -->
166
+ <form id="queryForm" class="form-inline">
167
+ <div class="form-group mx-2">
168
+ <label for="latitude" class="sr-only">Latitude</label>
169
+ <input type="text" id="latitude" placeholder="Latitude" class="form-control" required>
170
+ </div>
171
+
172
+ <div class="form-group mx-2">
173
+ <label for="longitude" class="sr-only">Longitude</label>
174
+ <input type="text" id="longitude" placeholder="Longitude" class="form-control" required>
175
+ </div>
176
+
177
+ <button type="submit" class="btn btn-primary mx-2">Find Cluster</button>
178
+ </form>
179
+
180
+ <!-- New chart added below the form -->
181
+ <div class="chart-container">
182
+ <canvas id="radarChart"></canvas>
183
+ </div>
184
+ </div>
185
+ <div class="main-content">
186
+ <div class="header">
187
+ <h1>Analysis</h1>
188
+ </div>
189
+ <div class="content">
190
+ <div class="chart">
191
+ <!-- Inserted iframe in place of the original chart -->
192
+ <iframe src="http://127.0.0.1:5000/Tumakuru" style="width:100%; height:100%; border:none;"></iframe>
193
+ </div>
194
+ <!-- Removed the original 'newChart' canvas element -->
195
+ <div class="chart">
196
+ <!-- Inserted iframe in place of the original chart -->
197
+ <iframe src="http://127.0.0.1:5000/Bagalkot" style="width:100%; height:100%; border:none;"></iframe>
198
+ </div>
199
+
200
+ <div class="forecast">
201
+ <!-- Result section to display the response -->
202
+ <center> <div id="result" class="chart">
203
+ <!-- The results will be displayed here -->
204
+ </div> </center>
205
+ </div>
206
+
207
+ <!-- JavaScript to handle form submission and AJAX -->
208
+ <script>
209
+ document.getElementById('queryForm').addEventListener('submit', function(event) {
210
+ event.preventDefault(); // Prevent the form from submitting in the traditional way
211
+
212
+ const latitude = document.getElementById('latitude').value;
213
+ const longitude = document.getElementById('longitude').value;
214
+
215
+ fetch(`/get-closest-cluster?latitude=${latitude}&longitude=${longitude}`)
216
+ .then(response => response.json())
217
+ .then(data => {
218
+ const resultDiv = document.getElementById('result');
219
+
220
+ if (data.closest_cluster) {
221
+ resultDiv.innerHTML = `
222
+ <div class="highlight">
223
+ <h2>Closest Cluster: ${data.closest_cluster}</h2>
224
+ <p>Centroid: Latitude ${data.cluster_centroid.Latitude}, Longitude ${data.cluster_centroid.Longitude}</p>
225
+ <p><strong>Number of Incidents:</strong> ${data.number_of_incidents}</p>
226
+ <p><strong>Suggestions:</strong> ${data.suggestions}</p>
227
+ </div>
228
+ `;
229
+ } else {
230
+ resultDiv.innerHTML = `<p>Error fetching closest cluster data.</p>`;
231
+ }
232
+ })
233
+ .catch(error => {
234
+ console.error('Error fetching data:', error);
235
+ const resultDiv = document.getElementById('result');
236
+ resultDiv.innerHTML = `<p>Unable to retrieve data.</p>`;
237
+ });
238
+ });
239
+ </script>
240
+ </div>
241
+
242
+
243
+
244
+ <center>
245
+ <div class="chart">
246
+ <!-- Inserted iframe in place of the original chart -->
247
+ <iframe src="http://127.0.0.1:5000/forecast_crime" style="width:100%; height:100%; border:none;"></iframe>
248
+ </div> </center>
249
+
250
+ </div>
251
+ </div>
252
+ </div>
253
+
254
+ <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
255
+ <script src="https://cdn.jsdelivr.net/npm/chartjs-plugin-datalabels"></script>
256
+ <script>
257
+ function goBack() {
258
+ window.location.href = 'http://127.0.0.1:5000/index';
259
+ }
260
+
261
+ document.addEventListener("DOMContentLoaded", function() {
262
+
263
+
264
+
265
+
266
+ // Radar Chart
267
+ const radarCtx = document.getElementById('radarChart').getContext('2d');
268
+ new Chart(radarCtx, {
269
+ type: 'radar',
270
+ type: 'pie',
271
+ data: {
272
+ labels: ['accident non-fatal', 'Theft', 'CrPc', 'Cases of hurd', 'Missing persion'],
273
+ datasets: [{
274
+ label: 'Crime Rate',
275
+ data: [6500, 6000,5600 , 4900, 3200, 2500,],
276
+ backgroundColor: [
277
+ 'rgba(255, 99, 132, 0.2)',
278
+ 'rgba(54, 162, 235, 0.2)',
279
+ 'rgba(255, 206, 86, 0.2)',
280
+ 'rgba(75, 192, 192, 0.2)',
281
+ 'rgba(153, 102, 255, 0.2)',
282
+ 'rgba(255, 159, 64, 0.2)',
283
+ 'rgba(201, 203, 207, 0.2)'
284
+ ],
285
+ borderColor: [
286
+ 'rgba(255, 99, 132, 1)',
287
+ 'rgba(54, 162, 235, 1)',
288
+ 'rgba(255, 206, 86, 1)',
289
+ 'rgba(75, 192, 192, 1)',
290
+ 'rgba(153, 102, 255, 1)',
291
+ 'rgba(255, 159, 64, 1)',
292
+ 'rgba(201, 203, 207, 1)'
293
+ ],
294
+ borderWidth: 1
295
+ }]
296
+ },
297
+ options: {
298
+ responsive: true
299
+ }
300
+ });
301
+
302
+ });
303
+ </script>
304
+ </body>
305
+ </html>
templates/crime_distribution_district.html ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bfb647856484c8f32eaf6875dfd8e493dc7d3bed8c62236cec709ddfc4afca95
3
+ size 27157934
templates/crime_map.html ADDED
@@ -0,0 +1,210 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Crime Dashboard</title>
7
+ <style>
8
+ body {
9
+ font-family: Arial, sans-serif;
10
+ background-color: #121212;
11
+ color: white;
12
+ margin: 0;
13
+ padding: 0;
14
+ }
15
+
16
+ .container {
17
+ display: flex;
18
+ min-height: 100vh;
19
+ }
20
+
21
+ .sidebar {
22
+ width: 300px;
23
+ background-color: #2A2A2A;
24
+ padding: 20px;
25
+ box-sizing: border-box;
26
+ }
27
+
28
+ .sidebar h2, .sidebar h1, .sidebar label {
29
+ color: #EFF204;
30
+ }
31
+
32
+ .sidebar .btn-back {
33
+ background-color: #FF4747;
34
+ border: none;
35
+ width: 100%;
36
+ margin-bottom: 20px;
37
+ }
38
+
39
+ .sidebar nav a {
40
+ display: block;
41
+ color: white;
42
+ padding: 10px 0;
43
+ text-decoration: none;
44
+ font-size: 16px;
45
+ cursor: pointer;
46
+ }
47
+
48
+ .sidebar nav a:hover {
49
+ background-color: #444;
50
+ }
51
+
52
+ .sidebar nav .sub-menu {
53
+ display: none;
54
+ padding-left: 20px;
55
+ }
56
+
57
+ .sidebar nav .sub-menu a {
58
+ padding: 5px 0;
59
+ }
60
+
61
+ .main-content {
62
+ flex: 1;
63
+ padding: 0;
64
+ box-sizing: border-box;
65
+ position: relative;
66
+ }
67
+
68
+ .iframe-container {
69
+ position: relative;
70
+ width: 100%;
71
+ height: 100vh;
72
+ overflow: hidden;
73
+ }
74
+
75
+ .iframe-container iframe {
76
+ position: absolute;
77
+ top: 0;
78
+ left: 0;
79
+ width: 100%;
80
+ height: 100%;
81
+ border: none;
82
+ }
83
+
84
+ .chart-container {
85
+ margin-top: 20px;
86
+ background-color: #1E1E1E;
87
+ padding: 20px;
88
+ border-radius: 8px;
89
+ }
90
+
91
+ canvas {
92
+ height: 100% !important;
93
+ }
94
+ </style>
95
+ </head>
96
+ <body>
97
+ <div class="container">
98
+ <div class="sidebar">
99
+ <button class="btn-back" onclick="goBack()">Back</button>
100
+ <h2>Dashboard</h2>
101
+ <nav>
102
+ <a href="http://127.0.0.1:5000/heat-map">Heat Map</a>
103
+ <a onclick="toggleSubMenu(event)">Prediction</a>
104
+ <div class="sub-menu">
105
+ <a href="http://127.0.0.1:5000/cluster">Crime Suggestion Prediction</a>
106
+ <a href="http://127.0.0.1:5000/predict">Behavior Prediction</a>
107
+ <a href="http://127.0.0.1:5000/future-crime-forecast">Future Crime Prediction</a>
108
+ <a href="http://127.0.0.1:5000/crime-prediction">Crime Prediction</a>
109
+ </div>
110
+ </nav>
111
+
112
+ <div class="chart-container">
113
+ <canvas id="crimeMapChart"></canvas>
114
+ </div>
115
+ <div class="chart-container">
116
+ <canvas id="karnatakaMapChart"></canvas>
117
+ </div>
118
+ </div>
119
+ <div class="main-content">
120
+ <div class="iframe-container">
121
+ <iframe src="https://crime-marker-map.netlify.app/"></iframe>
122
+ </div>
123
+ </div>
124
+ </div>
125
+
126
+ <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
127
+ <script>
128
+ function goBack() {
129
+ window.location.href = 'http://127.0.0.1:5000/index';
130
+ }
131
+
132
+ function toggleSubMenu(event) {
133
+ event.preventDefault();
134
+ const subMenu = event.target.nextElementSibling;
135
+ subMenu.style.display = subMenu.style.display === 'block' ? 'none' : 'block';
136
+ }
137
+
138
+ document.addEventListener("DOMContentLoaded", function() {
139
+
140
+
141
+ // Crime Map Chart
142
+ const crimeMapCtx = document.getElementById('crimeMapChart').getContext('2d');
143
+ new Chart(crimeMapCtx, {
144
+ type: 'bubble',
145
+ data: {
146
+ datasets: [{
147
+ label: 'Crime Map',
148
+ data: [
149
+ { x: 10, y: 20, r: 15 },
150
+ { x: 15, y: 10, r: 10 },
151
+ { x: 20, y: 30, r: 25 },
152
+ { x: 25, y: 20, r: 5 },
153
+ { x: 30, y: 25, r: 20 }
154
+ ],
155
+ backgroundColor: 'rgba(54, 162, 235, 0.8)',
156
+ borderColor: 'rgba(54, 162, 235, 1)',
157
+ borderWidth: 1
158
+ }]
159
+ },
160
+ options: {
161
+ scales: {
162
+ y: {
163
+ beginAtZero: true
164
+ }
165
+ }
166
+ }
167
+ });
168
+
169
+ // Karnataka Map Chart
170
+ const karnatakaMapCtx = document.getElementById('karnatakaMapChart').getContext('2d');
171
+ new Chart(karnatakaMapCtx, {
172
+ type: 'bubble',
173
+ data: {
174
+ datasets: [{
175
+ label: 'Crime Rates in Karnataka',
176
+ data: [
177
+ { x: 12.9716, y: 77.5946, r: 15 }, // Bengaluru
178
+ { x: 12.2958, y: 76.6394, r: 10 }, // Mysuru
179
+ { x: 12.9141, y: 74.8560, r: 12 }, // Mangaluru
180
+ { x: 15.3647, y: 75.1240, r: 8 }, // Hubli
181
+ { x: 15.8497, y: 74.4977, r: 5 } // Belagavi
182
+ ],
183
+ backgroundColor: 'rgba(255, 99, 132, 0.8)',
184
+ borderColor: 'rgba(255, 99, 132, 1)',
185
+ borderWidth: 1
186
+ }]
187
+ },
188
+ options: {
189
+ scales: {
190
+ x: {
191
+ type: 'linear',
192
+ position: 'bottom',
193
+ title: {
194
+ display: true,
195
+ text: 'Latitude'
196
+ }
197
+ },
198
+ y: {
199
+ title: {
200
+ display: true,
201
+ text: 'Longitude'
202
+ }
203
+ }
204
+ }
205
+ }
206
+ });
207
+ });
208
+ </script>
209
+ </body>
210
+ </html>
templates/crime_prediction.html ADDED
@@ -0,0 +1,401 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Crime Dashboard</title>
7
+ <style>
8
+ body {
9
+ font-family: Arial, sans-serif;
10
+ background-color: #121212;
11
+ color: white;
12
+ margin: 0;
13
+ padding: 0;
14
+ }
15
+
16
+ .container {
17
+ display: flex;
18
+ min-height: 100vh;
19
+ }
20
+
21
+ .sidebar {
22
+ width: 300px;
23
+ background-color: #2A2A2A;
24
+ padding: 20px;
25
+ box-sizing: border-box;
26
+ }
27
+
28
+ .sidebar h2, .sidebar h1, .sidebar label {
29
+ color: #FF4747;
30
+ }
31
+
32
+ .sidebar form {
33
+ margin-top: 20px;
34
+ }
35
+
36
+ .sidebar .form-group {
37
+ margin-bottom: 20px;
38
+ }
39
+
40
+ .sidebar .form-control {
41
+ background-color: #121212;
42
+ color: white;
43
+ border: 1px solid #444;
44
+ width: 100%;
45
+ }
46
+
47
+ .sidebar .btn-primary {
48
+ background-color: #FF4747;
49
+ border: none;
50
+ width: 100%;
51
+ }
52
+
53
+ .sidebar .chart-container {
54
+ margin-top: 20px;
55
+ background-color: #1E1E1E;
56
+ padding: 20px;
57
+ border-radius: 8px;
58
+ }
59
+
60
+ .sidebar canvas {
61
+ width: 100% !important;
62
+ height: 300px; /* Set a fixed height for the chart */
63
+ }
64
+
65
+ .main-content {
66
+ flex: 1;
67
+ padding: 20px;
68
+ box-sizing: border-box;
69
+ }
70
+
71
+ .header h1 {
72
+ color: #FF4747;
73
+ }
74
+
75
+ .content {
76
+ display: flex;
77
+ flex-wrap: wrap;
78
+ gap: 20px;
79
+ }
80
+
81
+ .chart {
82
+ background-color: #1E1E1E;
83
+ padding: 20px;
84
+ border-radius: 8px;
85
+ box-sizing: border-box;
86
+ width: calc(50% - 10px); /* Adjusted to fit two charts in a row */
87
+ height: 300px; /* Reduced height */
88
+ }
89
+
90
+ .live-data {
91
+ background-color: #1E1E1E;
92
+ padding: 20px;
93
+ border-radius: 8px;
94
+ box-sizing: border-box;
95
+ width: 100%;
96
+ height: 300px; /* Reduced height */
97
+ margin-bottom: 20px;
98
+ }
99
+
100
+ .statistics {
101
+ background-color: #1E1E1E;
102
+ padding: 20px;
103
+ border-radius: 8px;
104
+ box-sizing: border-box;
105
+ width: 100%;
106
+ margin-bottom: 20px;
107
+ }
108
+
109
+ .statistics h3 {
110
+ color: #FF4747;
111
+ margin: 10px 0;
112
+ }
113
+
114
+ .statistics p {
115
+ color: #FF4747;
116
+ }
117
+
118
+ .forecast {
119
+ background-color: #1E1E1E;
120
+ padding: 20px;
121
+ border-radius: 8px;
122
+ box-sizing: border-box;
123
+ width: 100%;
124
+ text-align: center;
125
+ margin-bottom: 20px;
126
+ }
127
+
128
+ .forecast h2 {
129
+ color: #FF4747;
130
+ }
131
+
132
+ .forecast img {
133
+ max-width: 100%;
134
+ height: auto;
135
+ }
136
+
137
+ .forecast ul {
138
+ list-style: none;
139
+ padding: 0;
140
+ }
141
+ .sidebar .btn-back {
142
+ background-color: #FF4747;
143
+ border: none;
144
+ width: 100%;
145
+ margin-bottom: 20px;
146
+ }
147
+
148
+ .forecast ul li {
149
+ margin: 5px 0;
150
+ }
151
+
152
+ canvas {
153
+ height: 100% !important; /* Ensures the canvas elements take the full height of their container */
154
+ }
155
+ </style>
156
+ </head>
157
+ <body>
158
+ <div class="container">
159
+ <div class="sidebar">
160
+ <button class="btn-back" onclick="goBack()">Back</button>
161
+ <h2>Dashboard</h2>
162
+ <h1 class="mt-4">Crime Prediction for 2025 and 2026</h1>
163
+
164
+ <!-- Form to select a year for prediction -->
165
+ <form method="post" class="mb-4">
166
+ <div class="form-group">
167
+ <label for="year">Select Year to Predict:</label>
168
+ <select name="year" id="year" class="form-control w-25">
169
+ <option value="2025">2025</option>
170
+ <option value="2026">2026</option>
171
+ </select>
172
+ </div>
173
+ <button type="submit" class="btn btn-primary">Show Predictions</button>
174
+ </form>
175
+
176
+ <!-- New chart added below the form -->
177
+ <div class="chart-container">
178
+ <canvas id="newChart"></canvas>
179
+ </div>
180
+ </div>
181
+ <div class="main-content">
182
+ <div class="header">
183
+ <h1>Analysis</h1>
184
+ </div>
185
+ <div class="content">
186
+ <div class="chart">
187
+ <canvas id="barChart"></canvas>
188
+ </div>
189
+ <div class="chart">
190
+ <canvas id="crimeRateChart"></canvas>
191
+ </div>
192
+
193
+ <div class="forecast">
194
+ <!-- Display the Plotly graph if available -->
195
+ {% if graph %}
196
+ <h2>Predicted Crimes</h2>
197
+ <div>
198
+ {{ graph|safe }} <!-- The Plotly graph rendered as HTML -->
199
+ </div>
200
+ {% endif %}
201
+
202
+ <!-- Display error messages if there's an error -->
203
+ {% if error %}
204
+ <div class="alert alert-danger mt-4">
205
+ <strong>Error:</strong> {{ error }}
206
+ </div>
207
+ {% endif %}
208
+ </div>
209
+
210
+ <div class="chart">
211
+ <canvas id="waterfallChart"></canvas>
212
+ </div>
213
+ <div class="chart">
214
+ <canvas id="radarChart"></canvas>
215
+ </div>
216
+ <div class="live-data">
217
+ <canvas id="liveDataChart"></canvas>
218
+ </div>
219
+ <div class="statistics">
220
+ <h3>Crime Statistics</h3>
221
+ <p>Early hours 3am-9am the crime rates are low</p>
222
+ <p>After 9am-12pm the crime rate are low but starts increasing</p>
223
+ <p>After 12pm the crime rates will be moderate but keeps on increasing</p>
224
+ <p>After 6pm the crime rates are high</p>
225
+ <p>Drug abuse and trafficking remain significant issues mainly the increasing of drugs and drug peddlers are high in Bangalore due to extensive networks​</p>
226
+ </div>
227
+ </div>
228
+ </div>
229
+ </div>
230
+
231
+ <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
232
+ <script src="https://cdn.jsdelivr.net/npm/chartjs-plugin-datalabels"></script>
233
+ <script>
234
+ function goBack() {
235
+ window.location.href = 'http://127.0.0.1:5000/index';
236
+ }
237
+ document.addEventListener("DOMContentLoaded", function() {
238
+ // Bar Chart
239
+ const barCtx = document.getElementById('barChart').getContext('2d');
240
+ new Chart(barCtx, {
241
+ type: 'bar',
242
+ data: {
243
+ labels: ["2016","2017","2018","2019","2020","2021","2022","2023","2024"],
244
+ datasets: [{
245
+ label: 'Crime Analysis 2016-2024',
246
+ data: [230.4000,250.12000,222.12000,177.36000,162.29000,177.818000,179.97000,233.781000,42.72000],
247
+ backgroundColor: [
248
+ '#00BFFF', '#7CFC00', '#FF69B4', '#FF4500', '#FFD700', '#ADFF2F', '#00FFFF', '#BA55D3', '#32CD32', '#FF6347'
249
+ ],
250
+ borderColor: [
251
+ '#00BFFF', '#7CFC00', '#FF69B4', '#FF4500', '#FFD700', '#ADFF2F', '#00FFFF', '#BA55D3', '#32CD32', '#FF6347'
252
+ ],
253
+ borderWidth: 1
254
+ }]
255
+ },
256
+ options: {
257
+ scales: {
258
+ y: {
259
+ beginAtZero: true
260
+ }
261
+ }
262
+ }
263
+ });
264
+
265
+ // Crime Rate Pie Chart
266
+ const crimeRateCtx = document.getElementById('crimeRateChart').getContext('2d');
267
+ new Chart(crimeRateCtx, {
268
+ type: 'pie',
269
+ data: {
270
+ labels: ["Motor Vehicle Accident Non-Fatal","Theft","CrPc","Cases of Hurt","Missing Person"],
271
+ datasets: [{
272
+ label: 'Top 5 Crime in Karnataka',
273
+ data: [20.3,13.3,11.5,10.5,10.4],
274
+ backgroundColor: [
275
+ 'rgba(75, 192, 192, 0.8)',
276
+ 'rgba(153, 102, 255, 0.8)',
277
+ 'rgba(255, 159, 64, 0.8)',
278
+ 'rgba(255, 206, 86, 0.8)',
279
+ 'rgba(54, 162, 235, 0.8)',
280
+ 'rgba(255, 99, 132, 0.8)'
281
+ ]
282
+ }]
283
+ },
284
+ options: {
285
+ responsive: true
286
+ }
287
+ });
288
+
289
+ // Live Data Chart
290
+ const liveDataCtx = document.getElementById('liveDataChart').getContext('2d');
291
+ new Chart(liveDataCtx, {
292
+ type: 'line',
293
+ data: {
294
+ labels: ['00:00', '01:00', '02:00', '03:00', '04:00', '05:00', '06:00', '07:00', '08:00', '09:00', '10:00', '11:00','12:00',"13:00",'14:00',"15:00",'16:00','17:00','18:00',"19:00",'20:00','21:00','22:00','23:00'],
295
+ datasets: [{
296
+ label: 'Crime Occuring Probability in a Day',
297
+ data: [86, 87, 90, 55, 45, 24, 17, 6.6, 6, 8, 9, 10, 14, 18, 20,25,30,35,55,62,70,78,82,84],
298
+ backgroundColor: 'rgba(255, 71, 71, 0.2)',
299
+ borderColor: 'rgba(255, 71, 71, 1)',
300
+ borderWidth: 1
301
+ }]
302
+ },
303
+ options: {
304
+ scales: {
305
+ y: {
306
+ beginAtZero: true
307
+ }
308
+ }
309
+ }
310
+ });
311
+
312
+ // Waterfall Chart
313
+ const waterfallCtx = document.getElementById('waterfallChart').getContext('2d');
314
+ new Chart(waterfallCtx, {
315
+ type: 'bar',
316
+ data: {
317
+ labels: ["Bengaluru City","Bengaluru Dist","Tumakuru","Shivamogga","Mandya"],
318
+ datasets: [{
319
+ label: 'Top 5 Most Occured Districts',
320
+ data: [430754,65032,62520,62047,60219],
321
+ backgroundColor: 'rgba(75, 192, 192, 0.8)',
322
+ borderColor: 'rgba(75, 192, 192, 1)',
323
+ borderWidth: 1
324
+ }]
325
+ },
326
+ options: {
327
+ plugins: {
328
+ datalabels: {
329
+ display: true,
330
+ color: 'black',
331
+ align: 'top'
332
+ }
333
+ },
334
+ scales: {
335
+ y: {
336
+ beginAtZero: true
337
+ }
338
+ }
339
+ }
340
+ });
341
+
342
+ // Radar Chart
343
+ const radarCtx = document.getElementById('radarChart').getContext('2d');
344
+ new Chart(radarCtx, {
345
+ type: 'doughnut',
346
+ data: {
347
+ labels: ['Bengalurucity', 'Mandya', 'Shivamogga', 'Bagalkot', 'Tumakuru', 'Mysuru'],
348
+ datasets: [{
349
+ label: '',
350
+ data: [60,50 , 40, 30, 35, 10],
351
+ backgroundColor: [
352
+ 'rgba(255, 99, 132, 0.2)',
353
+ 'rgba(54, 162, 235, 0.2)',
354
+ 'rgba(255, 206, 86, 0.2)',
355
+ 'rgba(75, 192, 192, 0.2)',
356
+ 'rgba(153, 102, 255, 0.2)',
357
+ 'rgba(255, 159, 64, 0.2)',
358
+ 'rgba(201, 203, 207, 0.2)'
359
+ ],
360
+ borderColor: [
361
+ 'rgba(255, 99, 132, 1)',
362
+ 'rgba(54, 162, 235, 1)',
363
+ 'rgba(255, 206, 86, 1)',
364
+ 'rgba(75, 192, 192, 1)',
365
+ 'rgba(153, 102, 255, 1)',
366
+ 'rgba(255, 159, 64, 1)',
367
+ 'rgba(201, 203, 207, 1)'
368
+ ],
369
+ borderWidth: 1
370
+ }]
371
+ },
372
+ options: {
373
+ responsive: true
374
+ }
375
+ });
376
+
377
+ // New Chart
378
+ const newChartCtx = document.getElementById('newChart').getContext('2d');
379
+ new Chart(newChartCtx, {
380
+ type: 'doughnut',
381
+ data: {
382
+ labels: ['Male','Female','Enuch'],
383
+ datasets: [{
384
+ label: 'Sex',
385
+ data: [995123,469964,4690],
386
+ backgroundColor: [
387
+ 'rgba(54, 162, 235, 0.8)',
388
+ 'rgba(255, 206, 86, 0.8)',
389
+ 'rgba(75, 192, 192, 0.8)',
390
+ 'rgba(153, 102, 255, 0.8)'
391
+ ]
392
+ }]
393
+ },
394
+ options: {
395
+ responsive: true
396
+ }
397
+ });
398
+ });
399
+ </script>
400
+ </body>
401
+ </html>
templates/forecast_crime.html ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ <html>
2
+ <head><meta charset="utf-8" /></head>
3
+ <body>
4
+ <div> <script type="text/javascript">window.PlotlyConfig = {MathJaxConfig: 'local'};</script>
5
+ <script src="https://cdn.plot.ly/plotly-2.12.1.min.js"></script> <div id="10a55ede-0e53-4be9-8541-388749fa67dc" class="plotly-graph-div" style="height:100%; width:100%;"></div> <script type="text/javascript"> window.PLOTLYENV=window.PLOTLYENV || {}; if (document.getElementById("10a55ede-0e53-4be9-8541-388749fa67dc")) { Plotly.newPlot( "10a55ede-0e53-4be9-8541-388749fa67dc", [{"line":{"color":"red"},"mode":"lines","name":"Forecasted Crime","x":["2024-04-30T00:00:00","2024-05-31T00:00:00","2024-06-30T00:00:00","2024-07-31T00:00:00","2024-08-31T00:00:00","2024-09-30T00:00:00","2024-10-31T00:00:00","2024-11-30T00:00:00","2024-12-31T00:00:00","2025-01-31T00:00:00","2025-02-28T00:00:00","2025-03-31T00:00:00"],"y":[7334.4935200006685,8495.648952876838,10857.735558768876,10899.51268565768,11786.591380281296,10998.026209786825,10695.814385824617,10369.229525275254,10530.742695584298,10556.978992525956,10707.765319334601,10712.358286657383],"type":"scatter"}], {"template":{"data":{"histogram2dcontour":[{"type":"histogram2dcontour","colorbar":{"outlinewidth":0,"ticks":""},"colorscale":[[0.0,"#0d0887"],[0.1111111111111111,"#46039f"],[0.2222222222222222,"#7201a8"],[0.3333333333333333,"#9c179e"],[0.4444444444444444,"#bd3786"],[0.5555555555555556,"#d8576b"],[0.6666666666666666,"#ed7953"],[0.7777777777777778,"#fb9f3a"],[0.8888888888888888,"#fdca26"],[1.0,"#f0f921"]]}],"choropleth":[{"type":"choropleth","colorbar":{"outlinewidth":0,"ticks":""}}],"histogram2d":[{"type":"histogram2d","colorbar":{"outlinewidth":0,"ticks":""},"colorscale":[[0.0,"#0d0887"],[0.1111111111111111,"#46039f"],[0.2222222222222222,"#7201a8"],[0.3333333333333333,"#9c179e"],[0.4444444444444444,"#bd3786"],[0.5555555555555556,"#d8576b"],[0.6666666666666666,"#ed7953"],[0.7777777777777778,"#fb9f3a"],[0.8888888888888888,"#fdca26"],[1.0,"#f0f921"]]}],"heatmap":[{"type":"heatmap","colorbar":{"outlinewidth":0,"ticks":""},"colorscale":[[0.0,"#0d0887"],[0.1111111111111111,"#46039f"],[0.2222222222222222,"#7201a8"],[0.3333333333333333,"#9c179e"],[0.4444444444444444,"#bd3786"],[0.5555555555555556,"#d8576b"],[0.6666666666666666,"#ed7953"],[0.7777777777777778,"#fb9f3a"],[0.8888888888888888,"#fdca26"],[1.0,"#f0f921"]]}],"heatmapgl":[{"type":"heatmapgl","colorbar":{"outlinewidth":0,"ticks":""},"colorscale":[[0.0,"#0d0887"],[0.1111111111111111,"#46039f"],[0.2222222222222222,"#7201a8"],[0.3333333333333333,"#9c179e"],[0.4444444444444444,"#bd3786"],[0.5555555555555556,"#d8576b"],[0.6666666666666666,"#ed7953"],[0.7777777777777778,"#fb9f3a"],[0.8888888888888888,"#fdca26"],[1.0,"#f0f921"]]}],"contourcarpet":[{"type":"contourcarpet","colorbar":{"outlinewidth":0,"ticks":""}}],"contour":[{"type":"contour","colorbar":{"outlinewidth":0,"ticks":""},"colorscale":[[0.0,"#0d0887"],[0.1111111111111111,"#46039f"],[0.2222222222222222,"#7201a8"],[0.3333333333333333,"#9c179e"],[0.4444444444444444,"#bd3786"],[0.5555555555555556,"#d8576b"],[0.6666666666666666,"#ed7953"],[0.7777777777777778,"#fb9f3a"],[0.8888888888888888,"#fdca26"],[1.0,"#f0f921"]]}],"surface":[{"type":"surface","colorbar":{"outlinewidth":0,"ticks":""},"colorscale":[[0.0,"#0d0887"],[0.1111111111111111,"#46039f"],[0.2222222222222222,"#7201a8"],[0.3333333333333333,"#9c179e"],[0.4444444444444444,"#bd3786"],[0.5555555555555556,"#d8576b"],[0.6666666666666666,"#ed7953"],[0.7777777777777778,"#fb9f3a"],[0.8888888888888888,"#fdca26"],[1.0,"#f0f921"]]}],"mesh3d":[{"type":"mesh3d","colorbar":{"outlinewidth":0,"ticks":""}}],"scatter":[{"fillpattern":{"fillmode":"overlay","size":10,"solidity":0.2},"type":"scatter"}],"parcoords":[{"type":"parcoords","line":{"colorbar":{"outlinewidth":0,"ticks":""}}}],"scatterpolargl":[{"type":"scatterpolargl","marker":{"colorbar":{"outlinewidth":0,"ticks":""}}}],"bar":[{"error_x":{"color":"#2a3f5f"},"error_y":{"color":"#2a3f5f"},"marker":{"line":{"color":"#E5ECF6","width":0.5},"pattern":{"fillmode":"overlay","size":10,"solidity":0.2}},"type":"bar"}],"scattergeo":[{"type":"scattergeo","marker":{"colorbar":{"outlinewidth":0,"ticks":""}}}],"scatterpolar":[{"type":"scatterpolar","marker":{"colorbar":{"outlinewidth":0,"ticks":""}}}],"histogram":[{"marker":{"pattern":{"fillmode":"overlay","size":10,"solidity":0.2}},"type":"histogram"}],"scattergl":[{"type":"scattergl","marker":{"colorbar":{"outlinewidth":0,"ticks":""}}}],"scatter3d":[{"type":"scatter3d","line":{"colorbar":{"outlinewidth":0,"ticks":""}},"marker":{"colorbar":{"outlinewidth":0,"ticks":""}}}],"scattermapbox":[{"type":"scattermapbox","marker":{"colorbar":{"outlinewidth":0,"ticks":""}}}],"scatterternary":[{"type":"scatterternary","marker":{"colorbar":{"outlinewidth":0,"ticks":""}}}],"scattercarpet":[{"type":"scattercarpet","marker":{"colorbar":{"outlinewidth":0,"ticks":""}}}],"carpet":[{"aaxis":{"endlinecolor":"#2a3f5f","gridcolor":"white","linecolor":"white","minorgridcolor":"white","startlinecolor":"#2a3f5f"},"baxis":{"endlinecolor":"#2a3f5f","gridcolor":"white","linecolor":"white","minorgridcolor":"white","startlinecolor":"#2a3f5f"},"type":"carpet"}],"table":[{"cells":{"fill":{"color":"#EBF0F8"},"line":{"color":"white"}},"header":{"fill":{"color":"#C8D4E3"},"line":{"color":"white"}},"type":"table"}],"barpolar":[{"marker":{"line":{"color":"#E5ECF6","width":0.5},"pattern":{"fillmode":"overlay","size":10,"solidity":0.2}},"type":"barpolar"}],"pie":[{"automargin":true,"type":"pie"}]},"layout":{"autotypenumbers":"strict","colorway":["#636efa","#EF553B","#00cc96","#ab63fa","#FFA15A","#19d3f3","#FF6692","#B6E880","#FF97FF","#FECB52"],"font":{"color":"#2a3f5f"},"hovermode":"closest","hoverlabel":{"align":"left"},"paper_bgcolor":"white","plot_bgcolor":"#E5ECF6","polar":{"bgcolor":"#E5ECF6","angularaxis":{"gridcolor":"white","linecolor":"white","ticks":""},"radialaxis":{"gridcolor":"white","linecolor":"white","ticks":""}},"ternary":{"bgcolor":"#E5ECF6","aaxis":{"gridcolor":"white","linecolor":"white","ticks":""},"baxis":{"gridcolor":"white","linecolor":"white","ticks":""},"caxis":{"gridcolor":"white","linecolor":"white","ticks":""}},"coloraxis":{"colorbar":{"outlinewidth":0,"ticks":""}},"colorscale":{"sequential":[[0.0,"#0d0887"],[0.1111111111111111,"#46039f"],[0.2222222222222222,"#7201a8"],[0.3333333333333333,"#9c179e"],[0.4444444444444444,"#bd3786"],[0.5555555555555556,"#d8576b"],[0.6666666666666666,"#ed7953"],[0.7777777777777778,"#fb9f3a"],[0.8888888888888888,"#fdca26"],[1.0,"#f0f921"]],"sequentialminus":[[0.0,"#0d0887"],[0.1111111111111111,"#46039f"],[0.2222222222222222,"#7201a8"],[0.3333333333333333,"#9c179e"],[0.4444444444444444,"#bd3786"],[0.5555555555555556,"#d8576b"],[0.6666666666666666,"#ed7953"],[0.7777777777777778,"#fb9f3a"],[0.8888888888888888,"#fdca26"],[1.0,"#f0f921"]],"diverging":[[0,"#8e0152"],[0.1,"#c51b7d"],[0.2,"#de77ae"],[0.3,"#f1b6da"],[0.4,"#fde0ef"],[0.5,"#f7f7f7"],[0.6,"#e6f5d0"],[0.7,"#b8e186"],[0.8,"#7fbc41"],[0.9,"#4d9221"],[1,"#276419"]]},"xaxis":{"gridcolor":"white","linecolor":"white","ticks":"","title":{"standoff":15},"zerolinecolor":"white","automargin":true,"zerolinewidth":2},"yaxis":{"gridcolor":"white","linecolor":"white","ticks":"","title":{"standoff":15},"zerolinecolor":"white","automargin":true,"zerolinewidth":2},"scene":{"xaxis":{"backgroundcolor":"#E5ECF6","gridcolor":"white","linecolor":"white","showbackground":true,"ticks":"","zerolinecolor":"white","gridwidth":2},"yaxis":{"backgroundcolor":"#E5ECF6","gridcolor":"white","linecolor":"white","showbackground":true,"ticks":"","zerolinecolor":"white","gridwidth":2},"zaxis":{"backgroundcolor":"#E5ECF6","gridcolor":"white","linecolor":"white","showbackground":true,"ticks":"","zerolinecolor":"white","gridwidth":2}},"shapedefaults":{"line":{"color":"#2a3f5f"}},"annotationdefaults":{"arrowcolor":"#2a3f5f","arrowhead":0,"arrowwidth":1},"geo":{"bgcolor":"white","landcolor":"#E5ECF6","subunitcolor":"white","showland":true,"showlakes":true,"lakecolor":"white"},"title":{"x":0.05},"mapbox":{"style":"light"}}},"legend":{"x":0.7,"y":1},"margin":{"l":0,"r":0,"t":50,"b":0},"title":{"text":"Forecast Crime pattern"},"xaxis":{"title":{"text":"Months"}},"yaxis":{"title":{"text":"Crime Count"}},"plot_bgcolor":"rgba(0,0,0,0)"}, {"responsive": true} ) }; </script> </div>
6
+ </body>
7
+ </html>
templates/future_crime.html ADDED
@@ -0,0 +1,390 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Crime Dashboard</title>
7
+ <style>
8
+ body {
9
+ font-family: Arial, sans-serif;
10
+ background-color: #121212;
11
+ color: white;
12
+ margin: 0;
13
+ padding: 0;
14
+ }
15
+
16
+ .container {
17
+ display: flex;
18
+ min-height: 100vh;
19
+ }
20
+
21
+ .sidebar {
22
+ width: 300px;
23
+ background-color: #2A2A2A;
24
+ padding: 20px;
25
+ box-sizing: border-box;
26
+ }
27
+
28
+ .sidebar h2, .sidebar h1, .sidebar label {
29
+ color: #1E90FF; /* Changed color */
30
+ }
31
+
32
+ .sidebar form {
33
+ margin-top: 20px;
34
+ }
35
+
36
+ .sidebar .form-group {
37
+ margin-bottom: 20px;
38
+ }
39
+
40
+ .sidebar .form-control {
41
+ background-color: #121212;
42
+ color: white;
43
+ border: 1px solid #444;
44
+ width: 100%;
45
+ }
46
+
47
+ .sidebar .btn-primary {
48
+ background-color: #1E90FF; /* Changed color */
49
+ border: none;
50
+ width: 100%;
51
+ }
52
+
53
+ .main-content {
54
+ flex: 1;
55
+ padding: 20px;
56
+ box-sizing: border-box;
57
+ }
58
+
59
+ .header h1 {
60
+ color: #1E90FF; /* Changed color */
61
+ }
62
+
63
+ .sidebar .btn-back {
64
+ background-color: #FF4747;
65
+ border: none;
66
+ width: 100%;
67
+ margin-bottom: 20px;
68
+ }
69
+
70
+ .content {
71
+ display: flex;
72
+ flex-wrap: wrap;
73
+ gap: 20px;
74
+ }
75
+
76
+ .chart {
77
+ background-color: #1E1E1E;
78
+ padding: 20px;
79
+ border-radius: 8px;
80
+ box-sizing: border-box;
81
+ width: calc(50% - 10px); /* Adjusted to fit two charts in a row */
82
+ height: 300px; /* Reduced height */
83
+ }
84
+
85
+ .pie-charts {
86
+ display: flex;
87
+ gap: 20px;
88
+ width: 100%;
89
+ flex-wrap: wrap;
90
+ }
91
+
92
+ .pie-chart {
93
+ background-color: #1E1E1E;
94
+ padding: 20px;
95
+ border-radius: 8px;
96
+ box-sizing: border-box;
97
+ width: calc(50% - 10px); /* Adjusted to fit two charts in a row */
98
+ height: 300px; /* Reduced height */
99
+ }
100
+
101
+ .live-data {
102
+ background-color: #1E1E1E;
103
+ padding: 20px;
104
+ border-radius: 8px;
105
+ box-sizing: border-box;
106
+ width: 100%;
107
+ height: 300px; /* Reduced height */
108
+ margin-bottom: 20px;
109
+ }
110
+
111
+ .statistics {
112
+ background-color: #1E1E1E;
113
+ padding: 20px;
114
+ border-radius: 8px;
115
+ box-sizing: border-box;
116
+ width: 100%;
117
+ margin-bottom: 20px;
118
+ }
119
+
120
+ .statistics h3 {
121
+ color: #1E90FF; /* Changed color */
122
+ margin: 10px 0;
123
+ }
124
+
125
+ .statistics p {
126
+ color: #1E90FF; /* Changed color */
127
+ }
128
+
129
+ .forecast-container {
130
+ display: flex;
131
+ flex-direction: column;
132
+ align-items: center;
133
+ width: 100%;
134
+ margin-bottom: 20px;
135
+ }
136
+
137
+ .forecast {
138
+ background-color: #1E1E1E;
139
+ padding: 20px;
140
+ border-radius: 8px;
141
+ box-sizing: border-box;
142
+ width: 100%;
143
+ text-align: center;
144
+ }
145
+
146
+ .forecast h2 {
147
+ color: #1E90FF; /* Changed color */
148
+ }
149
+
150
+ .forecast img {
151
+ max-width: 100%;
152
+ height: auto;
153
+ }
154
+
155
+ .forecast ul {
156
+ list-style: none;
157
+ padding: 0;
158
+ }
159
+
160
+ .forecast ul li {
161
+ margin: 5px 0;
162
+ }
163
+
164
+ canvas {
165
+ height: 100% !important; /* Ensures the canvas elements take the full height of their container */
166
+ }
167
+ </style>
168
+ </head>
169
+ <body>
170
+ <div class="container">
171
+ <div class="sidebar">
172
+ <button class="btn-back" onclick="goBack()">Back</button>
173
+ <h2>Dashboard</h2>
174
+ <h1>Future Crime Pattern Prediction</h1>
175
+ <!-- Form to input forecasting details -->
176
+ <form method="post">
177
+ <div class="form-group">
178
+ <label for="future_steps">Enter number of months to forecast:</label>
179
+ <input type="number" id="future_steps" name="future_steps" class="form-control" min="1" value="{{ future_steps }}">
180
+ </div>
181
+ <div class="form-group">
182
+ <label for="start_date">Enter start date for the forecast:</label>
183
+ <input type="date" id="start_date" name="start_date" class="form-control">
184
+ </div>
185
+ <button type="submit" class="btn btn-primary">Forecast</button>
186
+ </form>
187
+ <!-- Forecasted Values Result -->
188
+ <div class="forecasted-values">
189
+ <h2>Forecasted Values</h2>
190
+ {% if forecast_results %}
191
+ <ul>
192
+ {% for value in forecast_results %}
193
+ <li>{{ value }}</li>
194
+ {% endfor %}
195
+ </ul>
196
+ {% endif %}
197
+ </div>
198
+ </div>
199
+ <div class="main-content">
200
+ <div class="header">
201
+ <h1>Analysis</h1>
202
+ </div>
203
+ <div class="content">
204
+ <div class="chart">
205
+ <canvas id="barChart"></canvas>
206
+ </div>
207
+ <div class="chart">
208
+ <canvas id="crimeRateChart"></canvas>
209
+ </div>
210
+ <div class="forecast-container">
211
+ <!-- Forecast result section -->
212
+ <div class="forecast">
213
+ <h2>Forecast Plot</h2>
214
+ {% if forecast_plot %}
215
+ <img src="data:image/png;base64,{{ forecast_plot }}" alt="Forecast Plot" class="img-fluid">
216
+ {% endif %}
217
+ </div>
218
+ </div>
219
+ <div class="chart">
220
+ <canvas id="waterfallChart"></canvas>
221
+ </div>
222
+ <div class="chart">
223
+ <canvas id="radarChart"></canvas>
224
+ </div>
225
+ <div class="live-data">
226
+ <canvas id="liveDataChart"></canvas>
227
+ </div>
228
+ <div class="statistics">
229
+ <h3>Live Data</h3>
230
+ <p>A Murder every min</p>
231
+ <p>A Suicide every 40 sec</p>
232
+ <p>7812 Sexual Assaults every day</p>
233
+ <p>More than 100,000 pending rape cases in India. Close to 90 Rapes are reported every day in India.</p>
234
+ </div>
235
+ </div>
236
+ </div>
237
+ </div>
238
+
239
+ <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
240
+ <script>
241
+ function goBack() {
242
+ window.location.href = 'http://127.0.0.1:5000/index';
243
+ }
244
+ document.addEventListener("DOMContentLoaded", function() {
245
+ // Bar Chart
246
+ const barCtx = document.getElementById('barChart').getContext('2d');
247
+ new Chart(barCtx, {
248
+ type: 'bar',
249
+ data: {
250
+ labels: ['Cyber Crime', 'Violent Crime', 'Sexual Harassment', 'Rape', 'Kidnapping', 'Property', 'Fraud', 'Childhood Abuse', 'Robbery', 'Under Age Activities'],
251
+ datasets: [{
252
+ label: 'Crime Analysis 2003-2018',
253
+ data: [2300, 1000, 1000, 624, 500, 431, 430, 355, 329.5, 246.5],
254
+ backgroundColor: [
255
+ '#00BFFF', '#7CFC00', '#FF69B4', '#FF4500', '#FFD700', '#ADFF2F', '#00FFFF', '#BA55D3', '#32CD32', '#FF6347'
256
+ ],
257
+ borderColor: [
258
+ '#00BFFF', '#7CFC00', '#FF69B4', '#FF4500', '#FFD700', '#ADFF2F', '#00FFFF', '#BA55D3', '#32CD32', '#FF6347'
259
+ ],
260
+ borderWidth: 1
261
+ }]
262
+ },
263
+ options: {
264
+ scales: {
265
+ y: {
266
+ beginAtZero: true
267
+ }
268
+ }
269
+ }
270
+ });
271
+
272
+ // Crime Rate Pie Chart
273
+ const crimeRateCtx = document.getElementById('crimeRateChart').getContext('2d');
274
+ new Chart(crimeRateCtx, {
275
+ type: 'pie',
276
+ data: {
277
+ labels: ['Bengaluru City ', 'Bengaluru District', 'Tumakuru', 'Shivamogga', 'Mandya', 'Bagalkot'],
278
+ datasets: [{
279
+ label: 'Crime Rate',
280
+ data: [23.2, 20.5, 14.7, 17.8, 12.4, 11.4],
281
+ backgroundColor: [
282
+ 'rgba(75, 192, 192, 0.8)',
283
+ 'rgba(153, 102, 255, 0.8)',
284
+ 'rgba(255, 159, 64, 0.8)',
285
+ 'rgba(255, 206, 86, 0.8)',
286
+ 'rgba(54, 162, 235, 0.8)',
287
+ 'rgba(255, 99, 132, 0.8)'
288
+ ]
289
+ }]
290
+ },
291
+ options: {
292
+ responsive: true
293
+ }
294
+ });
295
+
296
+ // Live Data Chart
297
+ const liveDataCtx = document.getElementById('liveDataChart').getContext('2d');
298
+ new Chart(liveDataCtx, {
299
+ type: 'line',
300
+ data: {
301
+ labels: ['00:00', '01:00', '02:00', '03:00', '04:00', '05:00', '06:00', '07:00', '08:00', '09:00', '10:00', '11:00'],
302
+ datasets: [{
303
+ label: 'Live Data',
304
+ data: [10, 20, 30, 25, 20, 15, 10, 15, 20, 25, 30, 35],
305
+ backgroundColor: 'rgba(255, 71, 71, 0.2)',
306
+ borderColor: 'rgba(255, 71, 71, 1)',
307
+ borderWidth: 1
308
+ }]
309
+ },
310
+ options: {
311
+ scales: {
312
+ y: {
313
+ beginAtZero: true
314
+ }
315
+ }
316
+ }
317
+ });
318
+ });
319
+ // Waterfall Chart
320
+ const crimessolved = document.getElementById('waterfallChart').getContext('2d');
321
+ new Chart(crimessolved, {
322
+ type: 'bar',
323
+ data: {
324
+ labels: ['Bengalurucity', 'Mandya', 'Shivamogga', 'Bagalkot', 'Tumakuru', 'Mysuru'],
325
+ datasets: [{
326
+ label: 'Crimes Solved',
327
+ data: [60,50 , 40, 30, 35, 10],
328
+ backgroundColor: 'rgba(75, 192, 192, 0.8)',
329
+ borderColor: 'rgba(75, 192, 192, 1)',
330
+ borderWidth: 1
331
+ }]
332
+ },
333
+ options: {
334
+ plugins: {
335
+ datalabels: {
336
+ display: true,
337
+ color: 'black',
338
+ align: 'top'
339
+ }
340
+ },
341
+ scales: {
342
+ y: {
343
+ beginAtZero: true
344
+ }
345
+ }
346
+ }
347
+ });
348
+
349
+ // Radar Chart
350
+ const radarCtx = document.getElementById('radarChart').getContext('2d');
351
+ new Chart(radarCtx, {
352
+ type: 'bar',
353
+ data: {
354
+ labels: ['accident non-fatal', 'Theft', 'CrPc', 'Cases of hurd', 'Missing persion'],
355
+ datasets: [{
356
+ label: 'Crime Rate',
357
+ data: [6500, 6000,5600 , 4900, 3200, 2500,],
358
+ backgroundColor: [
359
+ 'rgba(255, 99, 132, 0.2)',
360
+ 'rgba(54, 162, 235, 0.2)',
361
+ 'rgba(255, 206, 86, 0.2)',
362
+ 'rgba(75, 192, 192, 0.2)',
363
+ 'rgba(153, 102, 255, 0.2)',
364
+ 'rgba(255, 159, 64, 0.2)',
365
+ 'rgba(201, 203, 207, 0.2)'
366
+ ],
367
+ borderColor: [
368
+ 'rgba(255, 99, 132, 1)',
369
+ 'rgba(54, 162, 235, 1)',
370
+ 'rgba(255, 206, 86, 1)',
371
+ 'rgba(75, 192, 192, 1)',
372
+ 'rgba(153, 102, 255, 1)',
373
+ 'rgba(255, 159, 64, 1)',
374
+ 'rgba(201, 203, 207, 1)'
375
+ ],
376
+ borderWidth: 1
377
+ }]
378
+ },
379
+ options: {
380
+ responsive: true,
381
+ scales: {
382
+ y: {
383
+ beginAtZero: true
384
+ }
385
+ }
386
+ }
387
+ });
388
+ </script>
389
+ </body>
390
+ </html>
templates/heat-map.html ADDED
@@ -0,0 +1,214 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Crime Dashboard</title>
7
+ <style>
8
+ body {
9
+ font-family: Arial, sans-serif;
10
+ background-color: #121212;
11
+ color: white;
12
+ margin: 0;
13
+ padding: 0;
14
+ }
15
+
16
+ .container {
17
+ display: flex;
18
+ min-height: 100vh;
19
+ }
20
+
21
+ .sidebar {
22
+ width: 300px;
23
+ background-color: #2A2A2A;
24
+ padding: 20px;
25
+ box-sizing: border-box;
26
+ }
27
+
28
+ .sidebar h2, .sidebar h1, .sidebar label {
29
+ color: #EFF204;
30
+ }
31
+
32
+ .sidebar .btn-back {
33
+ background-color: #FF4747;
34
+ border: none;
35
+ width: 100%;
36
+ margin-bottom: 20px;
37
+ }
38
+
39
+ .sidebar nav a {
40
+ display: block;
41
+ color: white;
42
+ padding: 10px 0;
43
+ text-decoration: none;
44
+ font-size: 16px;
45
+ cursor: pointer;
46
+ }
47
+
48
+ .sidebar nav a:hover {
49
+ background-color: #444;
50
+ }
51
+
52
+ .sidebar nav .sub-menu {
53
+ display: none;
54
+ padding-left: 20px;
55
+ }
56
+
57
+ .sidebar nav .sub-menu a {
58
+ padding: 5px 0;
59
+ }
60
+
61
+ .main-content {
62
+ flex: 1;
63
+ padding: 0;
64
+ box-sizing: border-box;
65
+ position: relative;
66
+ }
67
+
68
+ .iframe-container {
69
+ position: relative;
70
+ width: 100%;
71
+ height: 100vh;
72
+ overflow: hidden;
73
+ }
74
+
75
+ .iframe-container iframe {
76
+ position: absolute;
77
+ top: 0;
78
+ left: 0;
79
+ width: 100%;
80
+ height: 100%;
81
+ border: none;
82
+ }
83
+
84
+ .chart-container {
85
+ margin-top: 20px;
86
+ background-color: #1E1E1E;
87
+ padding: 20px;
88
+ border-radius: 8px;
89
+ }
90
+ </style>
91
+ <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
92
+ </head>
93
+ <body>
94
+ <div class="container">
95
+ <div class="sidebar">
96
+ <button class="btn-back" onclick="goBack()">Back</button>
97
+ <h2>Dashboard</h2>
98
+ <nav>
99
+ <a href="http://127.0.0.1:5000/crime-marker">Crime_marker</a>
100
+ <a onclick="toggleSubMenu(event)">Prediction</a>
101
+ <div class="sub-menu">
102
+ <a href="http://127.0.0.1:5000/cluster">Crime Suggestion Prediction</a>
103
+ <a href="http://127.0.0.1:5000/predict">Behavior Prediction</a>
104
+ <a href="http://127.0.0.1:5000/future-crime-forecast">Future Crime Prediction</a>
105
+ <a href="http://127.0.0.1:5000/crime-prediction">Crime Prediction</a>
106
+ </div>
107
+ </nav>
108
+
109
+ <div class="chart-container">
110
+ <canvas id="karnatakaMapChart"></canvas>
111
+ </div>
112
+ <div class="chart-container">
113
+ <canvas id="crimeTrendChart"></canvas>
114
+ </div>
115
+ </div>
116
+ <div class="main-content">
117
+ <div class="iframe-container">
118
+ <iframe src="https://heat-map1.netlify.app"></iframe>
119
+ </div>
120
+ </div>
121
+ </div>
122
+
123
+ <script>
124
+ function goBack() {
125
+ window.location.href = 'http://127.0.0.1:5000/index';
126
+ }
127
+
128
+ function toggleSubMenu(event) {
129
+ event.preventDefault();
130
+ const subMenu = event.target.nextElementSibling;
131
+ subMenu.style.display = subMenu.style.display === 'block' ? 'none' : 'block';
132
+ }
133
+
134
+ document.addEventListener("DOMContentLoaded", function() {
135
+ console.log("DOM content loaded");
136
+
137
+
138
+
139
+ // Karnataka Map Chart
140
+ const karnatakaMapCtx = document.getElementById('karnatakaMapChart').getContext('2d');
141
+ new Chart(karnatakaMapCtx, {
142
+ type: 'bubble',
143
+ data: {
144
+ datasets: [{
145
+ label: 'Crime Rates in Karnataka',
146
+ data: [
147
+ { x: 12.9716, y: 77.5946, r: 15 }, // Bengaluru
148
+ { x: 12.2958, y: 76.6394, r: 10 }, // Mysuru
149
+ { x: 12.9141, y: 74.8560, r: 12 }, // Mangaluru
150
+ { x: 15.3647, y: 75.1240, r: 8 }, // Hubli
151
+ { x: 15.8497, y: 74.4977, r: 5 } // Belagavi
152
+ ],
153
+ backgroundColor: 'rgba(255, 99, 132, 0.8)',
154
+ borderColor: 'rgba(255, 99, 132, 1)',
155
+ borderWidth: 1
156
+ }]
157
+ },
158
+ options: {
159
+ scales: {
160
+ x: {
161
+ type: 'linear',
162
+ position: 'bottom',
163
+ title: {
164
+ display: true,
165
+ text: 'Latitude'
166
+ }
167
+ },
168
+ y: {
169
+ title: {
170
+ display: true,
171
+ text: 'Longitude'
172
+ }
173
+ }
174
+ }
175
+ }
176
+ });
177
+
178
+ // Crime Trend Chart
179
+ const crimeTrendCtx = document.getElementById('crimeTrendChart').getContext('2d');
180
+ new Chart(crimeTrendCtx, {
181
+ type: 'line',
182
+ data: {
183
+ labels: ['2019', '2020', '2021', '2022', '2023'],
184
+ datasets: [{
185
+ label: 'Crime Trends Over the Years',
186
+ data: [120, 150, 180, 130, 170],
187
+ borderColor: 'rgba(75, 192, 192, 1)',
188
+ backgroundColor: 'rgba(75, 192, 192, 0.2)',
189
+ fill: true,
190
+ tension: 0.1
191
+ }]
192
+ },
193
+ options: {
194
+ scales: {
195
+ x: {
196
+ title: {
197
+ display: true,
198
+ text: 'Year'
199
+ }
200
+ },
201
+ y: {
202
+ beginAtZero: true,
203
+ title: {
204
+ display: true,
205
+ text: 'Number of Crimes'
206
+ }
207
+ }
208
+ }
209
+ }
210
+ });
211
+ });
212
+ </script>
213
+ </body>
214
+ </html>
templates/index.html ADDED
@@ -0,0 +1,226 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Crime Prediction</title>
7
+ <link rel="stylesheet" href="styles.css">
8
+ <style>
9
+ body, html {
10
+ margin: 0;
11
+ padding: 0;
12
+ width: 100%;
13
+ height: 100%;
14
+ font-family: Arial, sans-serif;
15
+ background-color: #000;
16
+ color: #fff;
17
+ overflow: hidden; /* Prevents scrollbars */
18
+ }
19
+
20
+ .container {
21
+ position: relative;
22
+ height: 100%;
23
+ }
24
+
25
+ nav {
26
+ display: flex;
27
+ justify-content: space-between;
28
+ align-items: center;
29
+ padding: 10px 20px;
30
+ background-color: rgba(0, 0, 0, 0.7);
31
+ position: absolute;
32
+ width: 100%;
33
+ top: 0;
34
+ left: 0;
35
+ z-index: 1000;
36
+ }
37
+
38
+ .nav-left {
39
+ display: flex;
40
+ align-items: center;
41
+ }
42
+
43
+ .nav-left img {
44
+ width: 50px;
45
+ height: auto;
46
+ margin-right: 10px;
47
+ }
48
+
49
+ .nav-right {
50
+ display: flex;
51
+ align-items: center;
52
+ margin-left: auto;
53
+ }
54
+
55
+ .nav-right ul {
56
+ list-style: none;
57
+ margin: 0;
58
+ padding: 0;
59
+ display: flex;
60
+ align-items: center;
61
+ }
62
+
63
+ .nav-right ul li {
64
+ position: relative;
65
+ margin-left: 20px;
66
+ }
67
+
68
+ .nav-right ul li a {
69
+ text-decoration: none;
70
+ color: #fff;
71
+ font-size: 16px;
72
+ cursor: pointer;
73
+ }
74
+
75
+ .dropdown {
76
+ display: none;
77
+ position: absolute;
78
+ top: 30px;
79
+ left: 0;
80
+ background-color: rgba(0, 0, 0, 0.7);
81
+ border: 1px solid #fff;
82
+ border-radius: 5px;
83
+ z-index: 1001;
84
+ }
85
+
86
+ .dropdown a {
87
+ display: block;
88
+ padding: 10px;
89
+ color: #fff;
90
+ text-decoration: none;
91
+ }
92
+
93
+ .dropdown a:hover {
94
+ background-color: #333;
95
+ }
96
+
97
+ .hero {
98
+ position: absolute;
99
+ top: 0;
100
+ left: 0;
101
+ width: 100%;
102
+ height: 100%;
103
+ display: flex;
104
+ flex-direction: column;
105
+ align-items: center;
106
+ justify-content: center;
107
+ text-align: center;
108
+ background: url("{{ url_for('static', filename='videos/crime.avif') }}") no-repeat center center fixed;
109
+ }
110
+
111
+ .hero-text {
112
+ position: relative;
113
+ color: #ff0000;
114
+ z-index: 1001;
115
+ }
116
+
117
+ .hero-text img {
118
+ width: 100px;
119
+ height: auto;
120
+ margin-bottom: 20px;
121
+ }
122
+
123
+ .hero-text h1 {
124
+ font-size: 6vw;
125
+ margin: 0;
126
+ }
127
+
128
+ .hero-text h3 {
129
+ font-size: 3vw;
130
+ margin: 10px 0;
131
+ }
132
+
133
+ .hero-text p {
134
+ font-size: 2vw;
135
+ }
136
+
137
+ @media (max-width: 768px) {
138
+ .nav-right ul {
139
+ flex-direction: column;
140
+ align-items: flex-start;
141
+ }
142
+
143
+ .nav-right ul li {
144
+ margin-left: 0;
145
+ margin-top: 10px;
146
+ }
147
+
148
+ .dropdown {
149
+ position: static;
150
+ }
151
+
152
+ .hero-text h1 {
153
+ font-size: 8vw;
154
+ }
155
+
156
+ .hero-text h3 {
157
+ font-size: 4vw;
158
+ }
159
+
160
+ .hero-text p {
161
+ font-size: 3vw;
162
+ }
163
+ }
164
+ </style>
165
+ </head>
166
+ <body>
167
+ <div class="container">
168
+ <nav>
169
+ <div class="nav-left">
170
+ <img src="{{ url_for('static', filename='images/Seal_of_Karnataka.png') }}" alt="Logo">
171
+ </div>
172
+ <div class="nav-right">
173
+ <ul>
174
+ <li>
175
+ <a href="#" class="toggle-dropdown">Prediction</a>
176
+ <div class="dropdown">
177
+
178
+ <a href="http://127.0.0.1:5000/crime-prediction">Crime Prediction</a>
179
+ <a href="http://127.0.0.1:5000/future-crime-forecast">Future Crime Prediction</a>
180
+ <a href="http://127.0.0.1:5000/cluster">Crime Solution</a>
181
+ <a href="http://127.0.0.1:5000/predict">Behavior Prediction</a>
182
+ </div>
183
+ </li>
184
+ <li>
185
+ <a href="#" class="toggle-dropdown">Hotspot</a>
186
+ <div class="dropdown">
187
+ <a href="http://127.0.0.1:5000/heat-map">Heat-map</a>
188
+ <a href="http://127.0.0.1:5000/crime-marker">Crime-marker</a>
189
+ </div>
190
+ </li>
191
+ <li><a href="http://127.0.0.1:5000/">Login</a></li>
192
+ </ul>
193
+ </div>
194
+ </nav>
195
+ <div class="hero">
196
+ <div class="hero-text">
197
+ <img src="{{ url_for('static', filename='images/Seal_of_Karnataka.png') }}" alt="Logo">
198
+ <h1>PREDICTIVE CRIME ANALYTICS</h1>
199
+ <h3>POLICE RESCUE</h3>
200
+ <p>KARNATAKA POLICE HACKATHON</p>
201
+ </div>
202
+ </div>
203
+ </div>
204
+ <script>
205
+ document.addEventListener('DOMContentLoaded', function() {
206
+ const dropdownToggles = document.querySelectorAll('.toggle-dropdown');
207
+
208
+ dropdownToggles.forEach(toggle => {
209
+ toggle.addEventListener('click', function(event) {
210
+ event.preventDefault();
211
+ const dropdown = this.nextElementSibling;
212
+ const isOpen = dropdown.style.display === 'block';
213
+ document.querySelectorAll('.dropdown').forEach(drop => drop.style.display = 'none');
214
+ dropdown.style.display = isOpen ? 'none' : 'block';
215
+ });
216
+ });
217
+
218
+ document.addEventListener('click', function(event) {
219
+ if (!event.target.closest('.nav-right ul li')) {
220
+ document.querySelectorAll('.dropdown').forEach(drop => drop.style.display = 'none');
221
+ }
222
+ });
223
+ });
224
+ </script>
225
+ </body>
226
+ </html>
templates/login.html ADDED
@@ -0,0 +1,127 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Login - Crime Prediction System</title>
7
+ <style>
8
+ body {
9
+ font-family: Arial, sans-serif;
10
+ background: url('{{ url_for('static', filename='videos/crime.avif') }}') no-repeat center center fixed;
11
+ background-size: cover;
12
+ color: #fff;
13
+ display: flex;
14
+ justify-content: center;
15
+ align-items: center;
16
+ height: 100vh;
17
+ margin: 0;
18
+ }
19
+
20
+ .video-background {
21
+ position: fixed;
22
+ right: 0;
23
+ bottom: 0;
24
+ min-width: 100%;
25
+ min-height: 100%;
26
+ width: auto;
27
+ height: auto;
28
+ z-index: -1;
29
+ background: url('{{ url_for('static', filename='videos/crime.avif') }}') no-repeat center center fixed;
30
+ background-size: cover;
31
+ }
32
+
33
+ .login-container {
34
+ background: rgba(0, 0, 0, 0.8);
35
+ padding: 30px;
36
+ border-radius: 10px;
37
+ box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
38
+ text-align: center;
39
+ width: 300px;
40
+ position: relative;
41
+ }
42
+
43
+ .login-container h1 {
44
+ margin-bottom: 20px;
45
+ }
46
+
47
+ .logo {
48
+ margin-bottom: 20px;
49
+ }
50
+
51
+ .input-group {
52
+ margin-bottom: 15px;
53
+ text-align: left;
54
+ }
55
+
56
+ .input-group label {
57
+ display: block;
58
+ margin-bottom: 5px;
59
+ }
60
+
61
+ .input-group input {
62
+ width: 100%;
63
+ padding: 10px;
64
+ border: none;
65
+ border-radius: 5px;
66
+ }
67
+
68
+ button {
69
+ width: 100%;
70
+ padding: 10px;
71
+ background: #d63031;
72
+ border: none;
73
+ border-radius: 5px;
74
+ color: #fff;
75
+ font-size: 16px;
76
+ cursor: pointer;
77
+ }
78
+
79
+ button:hover {
80
+ background: #e84343;
81
+ }
82
+
83
+ .error-message {
84
+ margin-top: 15px;
85
+ color: #ff6b6b;
86
+ display: none;
87
+ }
88
+ </style>
89
+ </head>
90
+ <body>
91
+ <video autoplay loop muted class="video-background">
92
+ <source src="{{ url_for('static', filename='videos/crime_login.mp4') }}" type="video/mp4">
93
+ </video>
94
+ <div class="login-container">
95
+ <img src="{{ url_for('static', filename='images/logo.png') }}" alt="Logo" class="logo">
96
+ <h1>Crime Prediction System</h1>
97
+ <form id="loginForm" onsubmit="return validateLogin()">
98
+ <div class="input-group">
99
+ <label for="username">Username</label>
100
+ <input type="text" id="username" name="username" required>
101
+ </div>
102
+ <div class="input-group">
103
+ <label for="password">Password</label>
104
+ <input type="password" id="password" name="password" required>
105
+ </div>
106
+ <button type="submit">Login</button>
107
+ </form>
108
+ <p id="errorMessage" class="error-message"></p>
109
+ </div>
110
+ <script>
111
+ function validateLogin() {
112
+ const username = document.getElementById('username').value;
113
+ const password = document.getElementById('password').value;
114
+ const errorMessage = document.getElementById('errorMessage');
115
+
116
+ if (username === 'admin' && password === 'admin123') {
117
+ window.location.href = 'https://super-umbrella-pj7j4xpp49v9c6g4g-5000.app.github.dev/index';
118
+ return false;
119
+ } else {
120
+ errorMessage.textContent = 'Invalid username or password';
121
+ errorMessage.style.display = 'block';
122
+ return false;
123
+ }
124
+ }
125
+ </script>
126
+ </body>
127
+ </html>