Spaces:
Sleeping
Sleeping
Upload 4 files
Browse files- README.md +8 -5
- app.py +86 -0
- crime_prediction_rr.pkl +3 -0
- requirements.txt +11 -0
README.md
CHANGED
@@ -1,10 +1,13 @@
|
|
1 |
---
|
2 |
-
title: Crime
|
3 |
-
emoji:
|
4 |
-
colorFrom:
|
5 |
-
colorTo:
|
6 |
-
sdk:
|
|
|
|
|
7 |
pinned: false
|
|
|
8 |
---
|
9 |
|
10 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
1 |
---
|
2 |
+
title: Crime Prediction
|
3 |
+
emoji: 🦀
|
4 |
+
colorFrom: yellow
|
5 |
+
colorTo: green
|
6 |
+
sdk: streamlit
|
7 |
+
sdk_version: 1.28.2
|
8 |
+
app_file: app.py
|
9 |
pinned: false
|
10 |
+
license: apache-2.0
|
11 |
---
|
12 |
|
13 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
app.py
ADDED
@@ -0,0 +1,86 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
import numpy as np
|
3 |
+
import pickle
|
4 |
+
import streamlit.components.v1 as components
|
5 |
+
|
6 |
+
# Load the pickled model
|
7 |
+
def load_model():
|
8 |
+
return pickle.load(open('crime_prediction_rr.pkl', 'rb'))
|
9 |
+
|
10 |
+
# Function for model prediction
|
11 |
+
def model_prediction(model, features):
|
12 |
+
predicted = str(model.predict(features)[0])
|
13 |
+
return predicted
|
14 |
+
|
15 |
+
def app_design():
|
16 |
+
# Add input fields for High, Open, and Low values
|
17 |
+
image = '9.png'
|
18 |
+
st.image(image, use_column_width=True)
|
19 |
+
|
20 |
+
st.subheader("Enter the following values:")
|
21 |
+
|
22 |
+
year = st.number_input("Year")
|
23 |
+
month = st.number_input("Month")
|
24 |
+
day = st.number_input("Day")
|
25 |
+
hour = st.number_input("Hour")
|
26 |
+
dayofyear = st.number_input("Day Of Year")
|
27 |
+
week = st.number_input("Week")
|
28 |
+
weekofyear = st.number_input("Week of Year")
|
29 |
+
dayofweek = st.number_input("Day of Week")
|
30 |
+
weekday = st.number_input("Week Day")
|
31 |
+
quarter = st.number_input("Quarter")
|
32 |
+
latitude = st.number_input("Latitude")
|
33 |
+
longitude = st.number_input("Longitude")
|
34 |
+
|
35 |
+
|
36 |
+
|
37 |
+
# Create a feature list from the user inputs
|
38 |
+
features = [[year,month,day,hour,dayofyear,week,weekofyear,dayofweek,weekday,quarter,latitude,longitude]]
|
39 |
+
|
40 |
+
# Load the model
|
41 |
+
model = load_model()
|
42 |
+
|
43 |
+
# Make a prediction when the user clicks the "Predict" button
|
44 |
+
if st.button('Predict Crime'):
|
45 |
+
predicted_value = model_prediction(model, features)
|
46 |
+
|
47 |
+
st.success(f"The Crime analysis is: {predicted_value}")
|
48 |
+
|
49 |
+
|
50 |
+
def about_hidevs():
|
51 |
+
|
52 |
+
components.html("""
|
53 |
+
<div>
|
54 |
+
<h4>🚀 Unlock Your Dream Job with HiDevs Community!</h4>
|
55 |
+
<p class="subtitle">🔍 Seeking the perfect job? HiDevs Community is your gateway to career success in the tech industry. Explore free expert courses, job-seeking support, and career transformation tips.</p>
|
56 |
+
<p class="subtitle">💼 We offer an upskill program in <b>Gen AI, Data Science, Machine Learning</b>, and assist startups in adopting <b>Gen AI</b> at minimal development costs.</p>
|
57 |
+
<p class="subtitle">🆓 Best of all, everything we offer is <b>completely free</b>! We are dedicated to helping society.</p>
|
58 |
+
<p class="subtitle">Book free of cost 1:1 mentorship on any topic of your choice — <a class="link" href="https://topmate.io/deepakchawla1307">topmate</a></p>
|
59 |
+
<p class="subtitle">✨ We dedicate over 30 minutes to each applicant’s resume, LinkedIn profile, mock interview, and upskill program. If you’d like our guidance, check out our services <a class="link" href="https://hidevscommunity.wixsite.com/hidevs">here</a></p>
|
60 |
+
<p class="subtitle">💡 Join us now, and turbocharge your career!</p>
|
61 |
+
<p class="subtitle"><a class="link" href="https://hidevscommunity.wixsite.com/hidevs" target="__blank">Website</a>
|
62 |
+
<a class="link" href="https://www.youtube.com/@HidevsCommunity1307/" target="__blank">YouTube</a>
|
63 |
+
<a class="link" href="https://www.instagram.com/hidevs_community/" target="__blank">Instagram</a>
|
64 |
+
<a class="link" href="https://medium.com/@hidevscommunity" target="__blank">Medium</a>
|
65 |
+
<a class="link" href="https://www.linkedin.com/company/hidevs-community/" target="__blank">LinkedIn</a>
|
66 |
+
<a class="link" href="https://github.com/hidevscommunity" target="__blank">GitHub</a></p>
|
67 |
+
</div>
|
68 |
+
""",
|
69 |
+
height=600)
|
70 |
+
|
71 |
+
def main():
|
72 |
+
|
73 |
+
# Set the app title and add your website name and logo
|
74 |
+
st.set_page_config(
|
75 |
+
page_title="Crime Prediction",
|
76 |
+
page_icon=":chart_with_upwards_trend:",
|
77 |
+
)
|
78 |
+
|
79 |
+
st.title("Welcome to our Crime Prediction App!")
|
80 |
+
|
81 |
+
app_design()
|
82 |
+
st.header("About HiDevs Community")
|
83 |
+
about_hidevs()
|
84 |
+
|
85 |
+
if __name__ == '__main__':
|
86 |
+
main()
|
crime_prediction_rr.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:0f36ff0478003217b32a78d551252450670613009f44ebb6fefacf21e4837870
|
3 |
+
size 2023829
|
requirements.txt
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
transformers
|
2 |
+
torch
|
3 |
+
numpy==1.21.4
|
4 |
+
pandas==1.5.1
|
5 |
+
ply==3.11
|
6 |
+
pickleshare==0.7.5
|
7 |
+
matplotlib==3.6.0
|
8 |
+
scikit-learn==1.1.2
|
9 |
+
seaborn==0.12.1
|
10 |
+
statsmodels==0.13.5
|
11 |
+
sklearn
|